Skip to content

Clean up project configuration

Miron van der Kolk requested to merge feature/package-structure into develop

As a prerequisite for #604 (closed) . see whether it is possible to declare dependencies in a smaller amount of files. Plus a general cleanup of the packaging/building stuff

Changes:

  • Move project configuration from setup.cfg to pyproject.toml including dependency specification (except for flake8 config, had to be moved to tox.ini. This could be fixed by moving to ruff which supports pyproject.toml config)
  • Add a pre-commit hook that checks for consistency between the pyproject.toml and both environment.yml files
  • Extract the conda environment updating into a separate make target, conda-update
  • Make the MakeFile autodetect mamba when available, always use the libmamba solver and automatically select the correct environment.yml file
  • Update documentation accordingly

To-do

  • Verify different installation methods
  • Update developer and user documentation
  • Review and update make targets

To-do separate issue

  • Switch to build for building wheels (is recommended in the setuptools documentation)
  • Investigate switching to meson, currently used by numpy. Would replace setup.py with some meson specific file

Verify locally

Developer install using only pip

pip install -e .[test,docs,inplacebuild,lint]
pytest tests

Should still be the same. Equal to make develop-pep517

Building a wheel

pip wheel .
# switch to clean environment
pip install <path_to_wheel>[test,docs,inplacebuild,lint] # extras syntax also works when installing a wheel file
pytest tests

Using the conda make target

conda create -n test_finesse # if executed in root dir, will already use environment.yml?
make conda-develop  # calls the `conda-update` target internally
pytest tests 

Testing the precommit hook

Is included in the automated test, but the precommit hook should:

  • Be ran when you change the pyproject.toml file or either environment.yml or environment-win.yml
  • Detect when there is a mismatch list of packages or the version of package between both yml files
  • Detect any mismatch is the list of packages or their versions between the yml files and pyproject.toml
  • In any file, detect whether a package is listed twice with different versions (in the future their might be a reason for this, but for now seems safe to assume this is unintentional)
  • Detect whether the [build-system] requires section is identical to the inplacebuild section of optional-dependencies in pyproject.toml
Edited by Miron van der Kolk

Merge request reports