Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modernize build infrastructure #4

Merged
merged 6 commits into from
Jul 1, 2024
Merged

Conversation

JostMigenda
Copy link
Member

Python packaging documentation explicitly warns that commands like python setup.py sdist bdist_wheel are deprecated and “MUST NOT be run anymore”.
The recommended replacement is the build module. This also ensures more reproducible builds by requiring build dependencies to be explicitly declared (in a pyproject.toml file) and building the project in an isolated virtual environment.

This PR updates the build infrastructure accordingly. It also moves all package metadata to the pyproject.toml file and leaves setup.py to focus solely on the code needed to build the binary extension.

(This is laying the groundwork for #3, which will be in a separate PR for clarity.)

This is the "src-layout" directory structure expected by setuptools, which helps automate discovery and packaging
https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#automatic-discovery
This is strongly deprecated, see https://packaging.python.org/en/latest/discussions/setup-py-deprecated/#:~:text=However,run%20anymore
so we use the `build` module instead.
Also adds a basic pyproject.toml to explicitly list build dependencies.
Use standard config format instead of (setuptools-specific) Python code; eliminate code to manually read README and requirements.txt files
`provides` and `zip_safe` are ignored/deprecated, see https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#setuptools-specific-configuration
`pytest` and `numpydoc` aren’t actually used; seem to be copy & paste artefacts from snewpy
Without this, *.h files are not automatically included in the sdist, so building from the sdist (e.g. using `python -m build`) fails
@JostMigenda JostMigenda force-pushed the JostMigenda/modernBuild branch from aaa295c to 22d78d1 Compare July 1, 2024 17:22
@jpkneller jpkneller merged commit 4abb918 into main Jul 1, 2024
1 check passed
@JostMigenda JostMigenda deleted the JostMigenda/modernBuild branch August 12, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants