-
Notifications
You must be signed in to change notification settings - Fork 8
Cythonizing pyx files
Moses Chan edited this page Apr 30, 2025
·
2 revisions
.pyx files that use numpy must be cythonized with respect to a target version of numpy. In accord with surmise packaging requirements, that same version of numpy must be used to compile the generated C code.
To manage this, we have added a cythonize task to tox, which lists numpy as a dependence with the target version specified as the only acceptable version. That same fixed version is specified as a build system environment requirement in pyproject.toml. Therefore, we strongly suggest that all cythonization of .pyx files be carried out with tox and using a current version of tox.ini.
TODO: How does this work with both the coverage and nocoverage tox tasks?
- If necessary, merge into your feature branch the current
pyproject.tomlandtox.inifiles frommain. - Confirm that the two files have matching numpy versions and that this version is acceptable for your work.
- From a system that has
toxinstalled, runtox -r -e cythonize(optionally without-rif you understand what that means) and confirm creation/update of the associated.cfile. - Runs tests that use the new
.cfile to confirm that the generated code is functioning. - Commit functioning code and have this aspect of your work carefully reviewed and tested as part of your branch's PR.