Open cmutel opened 2 years ago
Starting with PEP 621, the Python community selected pyproject.toml as a standard way of specifying project metadata https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
Repository cookiecutter-brightwaylib is a starting point. It contains already a basic cookiecutter template, and issues related to each of the specification requirements described here.
Here is a job description to find a freelancer to work on this:
Brightway (https://brightway.dev/) is an open source framework for life cycle assessment. Our packaging concept and CI infrastructure needs to be updated to use modern tools and make our lives easier. Specifically, the following changes need to be made:
setup.py
to pyproject.toml
. No need to switch to anything like poetry or any other fancy build system. (The reason we are hiring someone to do this in the first place is that we can build libraries using pyproject.toml
and upload them to PyPI but these libraries raise errors when running pip install
afterwards.)
Tagged releases for anaconda should be built by conda-forge, and their robot will automatically notice new PyPI releases and create pull requests.
The following libraries need to be updated and can have a single, version/OS independent wheel:
https://github.com/brightway-lca/brightway2-data https://github.com/brightway-lca/brightway2-io https://github.com/brightway-lca/brightway2-analyzer
This library needs to be updated, but needs version/OS-specific wheels:
https://github.com/brightway-lca/brightway2-calc
See https://github.com/brightway-lca/brightway2-speedups/blob/master/.github/workflows/build_wheels.yaml for an example of such wheels. The calc library relies on linear algebra libraries which are compiled separately for each version and OS. It should have pypardiso
as a dependency, but note that no wheel for ARM Macs is available, as this can't use pypardiso, but instead should use scikit-umfpack
, but it doesn't have binary distributions (https://pypi.org/project/scikit-umfpack/0.3.3/).
Note the following changes to the original plan:
napoleon
for documentation, just using numpy
docstrings
Motivation
Every time we need to make a change, e.g. add a tool, update Github Workflows system images, etc. we need to manually change every library. Manual changes can be inconsistent and are a pain, leading to procrastination. Larger changes are basically impossible to imagine.
Desired template attributes
We need a standard template and guide for libraries which has the following qualities:
conda
andpip
setup.cfg
instead ofsetup.py
. Include sections fordev
(has e.g.pytest
,pip-tools
),stable
(all requirements pinned), and normal installation (requirements have ranges of>=
)anaconda
on tagged commitsAdapting the
hypermodern
templateA lot of these attributes are found in the hypermodern template, though @cmutel would argue against the following:
poetry
: Better to stick with standard tools instead of more opinionated ones in components designed to be integrated into applications.tox
ornox
: Not necessary, we do testing in CI, and setting up a venv for each test run is quite heavy for our components.We should use the following (copied from their docs):
pre-commit
hooksNote that we assume the following are done as pre-commit hooks by the template (instead of by Github Workflows):
cookiecutter
instead ofpyscaffold
pyscaffold ticks a lot of boxes, but has some controversial choices which are hard to remove, including the use of
setuptools-scm
andtox
, has custom commands instead ofpip
and friends (not great for new users), and would need to adapted to include the Azure Workflows config in any case. @cmutel thinks that a custom cookiecutter template is probably the best choice. Ideally, someone would already have such a template, as thecookiecutter
ecosystem is large, but no suitable template was found browsing cookiecutter-templates.pip
, notpoetry
orpipenv
Let's skip the drama,
pip
withpip-tools
andpipreqs
works just fine.Useful links
setup.cfg
Tasks
cookiecutter
template that satisfies the required attributes