ImperialCollegeLondon / pyrealm

Development of the pyrealm package, providing an integrated toolbox for modelling plant productivity, growth and demography using Python.
https://pyrealm.readthedocs.io/
MIT License
21 stars 8 forks source link

Adding compatibility for Python 3.12 #226

Closed AmyOctoCat closed 4 months ago

AmyOctoCat commented 5 months ago

Is your feature request related to a problem? Please describe. Currently, the pyrealm unit tests will not run and flake8 will not run from the command line when running with Python 3.12.0. This is due to a flake8 and pytest-flake8 version incompatibility with the newer version of python. We should also update our test runners and docs accordingly.

Describe the solution you'd like Option 1: Remove pytest-flake8 and bump version of flake8 to 7.0.0 One potential option is to upgrade the version of flake8 specified in pyproject.toml (7.0.0 is compatible with the newer python). However, pytest-flake8 does not have a version compatible with Python 3.12.0. We are currently considering removing this from the pytest config so that it no longer runs as part of the unit tests, since flake8 is already run as part of the pre-commit step. This solution has been confirmed to be backwards compatible with Python 3.10 and 3.11 too.

Option 2: Switch to using ruff and remove the use of flake8 and pytest-flake8 We currently have an open issue to investigate the use of ruff: https://github.com/ImperialCollegeLondon/pyrealm/issues/219 We may decide to replace flake8 entirely with ruff.

Whichever option is chosen, we should also add test runners for Python 3.12 and potentially considering adding explicit upper bound to the compatible python versions listed in our docs.

Describe alternatives you've considered Pending investigation into ruff, both solutions are a possibility.

Additional context N/A