UC-Davis-molecular-computing / ppsim

Python package for simulating population protocols
MIT License
10 stars 5 forks source link

make GitHub action for publishing Python package automatically to PyPI #1

Open dave-doty opened 3 years ago

dave-doty commented 3 years ago

See here for example:

https://github.com/UC-Davis-molecular-computing/scadnano-python-package/blob/b6cd6984c66e766b20b5a7a34654d3ca3fba42bf/.github/workflows/release.yml#L27-L43

dave-doty commented 3 years ago

Note that this is a bit of a pain to set up because packages can only be published to PyPI if they increment the version number, so you need to set up some way to track the version.

I do it in scadnano with a top-level variable in my main python file (like https://github.com/UC-Davis-molecular-computing/population-protocols-python-package/blob/main/ppsim/ppsim.py here):

https://github.com/UC-Davis-molecular-computing/scadnano-python-package/blob/b6cd6984c66e766b20b5a7a34654d3ca3fba42bf/scadnano/scadnano.py#L57

There's some ugly code in both setup.py (https://github.com/UC-Davis-molecular-computing/scadnano-python-package/blob/master/setup.py, for PyPI) and doc/conf.py (https://github.com/UC-Davis-molecular-computing/scadnano-python-package/blob/master/doc/conf.py, for sphinx to generate API documentation), so that they both only read the official version number from one place.