Metadata-Version: 2.4
Name: mpec_extract
Version: 0.1.6
Summary: A library to extract from CEPAC and STOP output files
Author-email: Livia Qoshe <lqoshe@mgh.harvard.edu>
License-Expression: MIT
Project-URL: Homepage, https://gitlab-scm.partners.org/mpec-dev/extract_backend
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file


Note: make sure that twine distribution is <= 6.0.1 to be compatible with pyproject.toml.

Note: out_data files need to be regenerated with the current library structure in place (i.e. the module, class, and 
function definitions). So the library needs to be created then used to generate new out_data files, before others can 
use it. (I have already done this for the current library structure, but if it changes, the out_data might need to be 
regenerated.) See Developer's Notes below. 

-----

### Commands to build 

Remember to update the version number in the pyproject.toml file, and delete any old distributions. The twine upload 
will not work if there's any old versions around.

``` py -m build ```

This should create a dist folder with a tar.gz and a wheel build. 

### Commands to upload to PyPi or TestPyPi

``` py -m twine upload --repository pypi dist/*```

``` py -m twine upload --repository testpypi dist/*```

Note you'll need to create a PyPi and/or TestPyPi account and an API access token, and provide the token to twine, either via the 
commandline or via a .pypirc file. PyPi and TestPyPi are separate: they will require separate accounts and separate access tokens. 

If you choose to use a .pypirc file, an example is provided in this repo, but it needs to be placed in your local home 
directory, not the project directory!

### Commands to install the package

In general, you can find the correct command easily on the package webpage: 
- TestPyPi: https://test.pypi.org/project/mpec-extract/
- PyPi: https://pypi.org/project/mpec-extract/

The command should be something like: 

- Test PyPi: ``` pip install -i https://test.pypi.org/simple/ mpec-extract ```

- PyPi: ``` pip install mpec-extract ```

## Developer's Notes 

### Generating .out_data files 

This is what the error might look like for an out of date out_data file: 

```
Error in py_call_impl(callable, call_args$unnamed, call_args$named) : 
  ModuleNotFoundError: No module named 'm_cohorts'
```

You need to go to the MCT repo to recreate the out_data files. As of 8/20/25, the script is in a separate branch of the 
MCT repo, called extract_library. The script is called generate_data_file.py. That repo should already include the newer
files, marked with "_new". Also, they should be in the MPEC Model Resources folder for now. 

The reason the out_data files need to be regenerated is because when the out_data file is pickled, it will save
references to the module and class whose data it is saving. The old files are saving references to m_cohorts.CohortData 
and m_cohorts.GenericMonth, which is not ok because the pickle file needs to be loaded via the import_data_file() 
function in the extract_backend package, which cannot access m_cohorts.py. The data file needs to be saved within the 
structure of the package.
