brightway-lca / enhancement-proposals

Formal process for making large or breaking changes to Brightway ecosystem
Creative Commons Zero v1.0 Universal
4 stars 4 forks source link

G Infrastructure: Homogeneous build, test and deploy metrics #3

Open cmutel opened 2 years ago

cmutel commented 2 years ago

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:

Adapting the hypermodern template

A lot of these attributes are found in the hypermodern template, though @cmutel would argue against the following:

We should use the following (copied from their docs):

pre-commit hooks

Note that we assume the following are done as pre-commit hooks by the template (instead of by Github Workflows):

cookiecutter instead of pyscaffold

pyscaffold ticks a lot of boxes, but has some controversial choices which are hard to remove, including the use of setuptools-scm and tox, has custom commands instead of pip 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 the cookiecutter ecosystem is large, but no suitable template was found browsing cookiecutter-templates.

pip, not poetry or pipenv

Let's skip the drama, pip with pip-tools and pipreqs works just fine.

Useful links

Tasks

tngTUDOR commented 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

tngTUDOR commented 1 year ago

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.

cmutel commented 1 year ago

Here is a job description to find a freelancer to work on this:

Update Python packaging and CI scripts for an open source framework for life cycle assessment

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:

(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/).

cmutel commented 1 year ago

Note the following changes to the original plan: