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

DM-27354: Enable pip installation using pyproject.toml / PEP 517 #30

Merged
merged 6 commits into from Nov 5, 2020

Conversation

jonathansick
Copy link
Member

This PR makes sphgeom pip installable by downstream packages without requiring a requirements.txt file to pre-populate the environment. The solution here relies on the pyproject.toml file to ensure that build dependencies are installed before setuptools is called to build and install the package. This relies on the new-ish PEP 517 mechanism for specifying the build requirements.

This work also removes the extra setuptools_cpp dependency as it didn't seem to add any value compared to pybind11's built-in setuptools integration.

- Removed license field because it's not recommended when there is a
  license classifier.
- Moved long_description to setup.cfg, removing that logic from setup.py
- Formatting consistency
tests_require is deprecated, so instead we've created a "test" extra.
This is for consistency with the original requirements.txt file.
setuptools_cpp doesn't offer any obvious functionality over pybind11's
built-in setuptools integration, so we'll use the pybind11 recipe. Based
on: https://github.com/pybind/python_example/blob/master/setup.py

Also package headers with MANIFEST.in This appears necessary for a pip
installation when building the pybind11 extension.
pyroject.toml and PEP 517 is really the only way to ensure that certain
python dependencies are present *before* a package is built.

This replaces the setup_requires section in setup.cfg (it didn't install
build dependencies in time) and requirements.txt (it's not a viable
solution for installing dependencies for a library).

Update GitHub Actions to use this installation method.
Copy link
Member

@timj timj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. One question.

@@ -45,8 +39,6 @@

setup(
version=version,
long_description=long_description,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is long_description no longer something that is used then? I thought it was how you got the readme onto the PyPI page?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timj This is handled by the file: directive in the setup.cfg file for code-less import of the README into the package metadata.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see file in setup.cfg...

@timj timj merged commit fbfe500 into master Nov 5, 2020
@timj timj deleted the tickets/DM-27354 branch November 5, 2020 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants