Skip to content

Pyproject.toml#720

Merged
neworderofjamie merged 20 commits intomasterfrom
pyproject
Nov 24, 2025
Merged

Pyproject.toml#720
neworderofjamie merged 20 commits intomasterfrom
pyproject

Conversation

@neworderofjamie
Copy link
Contributor

@neworderofjamie neworderofjamie commented Nov 18, 2025

I have been putting this off for several years as I hate build systems but, installing Python projects using python setup.py develop or python setup.py install has been deprecated for some time now and warnings have become increasingly aggressive. The final straw is that the latest pip seems to default to building packages (like GeNN) which only provide a setup.py in an isolated environment (this is why mlGeNN builds have been failing) and the main issue with setup.py is that there's no (sensible) way of handling build dependencies meaning there's no way to setup this isolated environment (see https://peps.python.org/pep-0518/ for a more complete story)!

The modern approach centres around a file called pyproject.toml (this format is somewhere between yaml and a classic config file). Projects with a pyproject.toml can be built using a whole bunch of different frontends e.g. pip or build and, as a minimum, it provides the information to select a backend e.g. setuptools and install whatever dependencies are required for the build process. In python-only projects, it can fully replace setup.py by also providing meta-data.

Because it's still not clear to me how you pass build options right through the frontend and backend all the way to setup.py (which we need to do to generate debug and coverage-recording GeNN builds), we want to be able to still build the old way so, in this PR, I have followed the minimum pathway outlined in https://packaging.python.org/en/latest/guides/modernize-setup-py-project/ and:

  • Left the metadata in setup.py so, for now at least, you can still create coverage or debug builds for development as before
  • Added a very minimal pyproject.toml that bootstraps the setuptools build system.
  • Made a few very minor fixes to setup.py to make all the paths that go into setuptools relative
  • Add the python wrapper around pkg-config as a dependency and use this to correctly link/include pkg-config on Linux and Mac
  • Updated Jenkins to build its final wheels using the build frontend

I have done the following testing in clean venvs/conda environemnts using pip install git+https://github.com/genn-team/genn.git@pyproject to test pip (having run pip install -U pip first and python setup.py install to test the legacy route:

OS Python version pip legacy
Windows 3.14 ✔️ ✔️
Windows 3.13 ✔️ ✔️
Windows 3.12 ✔️ ✔️
Windows 3.9 ✔️ ✔️
Ubuntu 20 3.11 ✔️ ✔️
Ubuntu 20 3.9 ✔️ ✔️
Ubuntu 20 3.8 ✔️ ✔️

Using all this magic, installing GeNN is now pretty easy so I've taken the opportunity to simplify the README (and remembered to add references to HIP where appropriate).

TODO @tnowotny , it would be great if you could try and install both ways from this branch on Mac! Once you're happy with the readme, I'll copy-paste into the documentation

@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.55%. Comparing base (f5f53be) to head (6864a47).
⚠️ Report is 21 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #720      +/-   ##
==========================================
+ Coverage   88.47%   88.55%   +0.08%     
==========================================
  Files         107      107              
  Lines       14262    14836     +574     
==========================================
+ Hits        12618    13138     +520     
- Misses       1644     1698      +54     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@neworderofjamie neworderofjamie merged commit e2a3df2 into master Nov 24, 2025
3 checks passed
@neworderofjamie neworderofjamie deleted the pyproject branch November 24, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant