cryotools / cosipy

Coupled snowpack and ice surface energy and mass balance model in Python
GNU General Public License v3.0
53 stars 31 forks source link

merge(build): Feat pip installation #67

Closed gampnico closed 5 months ago

gampnico commented 8 months ago

Refactors:

Adds:

New configuration system

The new configuration system uses .toml files. Users can pass optional CLI arguments to read configuration files with any name from any directory - a single source tree now supports multiple glaciers.

If installed as a package or editable, users can use entry points to run COSIPY/utilities/postprocessing from any working directory. Just add the path to data directory to config.toml and you're good to go. cosipy-help shows all the entry points available.

For cluster jobs, these entry points can be chained in a bash script to run consecutive simulations using different configurations.

The conversion utility convert_config.py is provided to help users migrate to the new system. Before merging the new update:

git fetch --all
git checkout master -- convert_config.py
python convert_config.py  # generate .toml files

Once uploaded to pip, this gives the workflow:

pip install cosipy
setup-cosipy  # generate .toml files
cosipy-create-static
cosipy-aws2cosipy ...
cosipy-help
run-cosipy

Changes to folder structure

To avoid breaking everything, everywhere, all at once, COSIPY is now partly in src layout. It isn't PEP-compliant, but allows it to be run from source, installed as an editable, and built as a package, whilst preserving python COSIPY.py for existing users.

Closes: #42