Adopt new setup.py/pyproject.toml packaging standards #165
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Python packaging standards have evolved in recent years. This PR creates a
pyproject.toml
file to specify Pandana's build-time requirements, and streamlinessetup.py
. This was prompted in part by issue #164.As a result of these updates, the appropriate commands for running unit tests, installing Pandana from source, and building installers for PyPI will change. Read on for details.
Build requirements now in pyproject.toml
Python projects did not used to have a way to specify build-time requirements that are distinct from runtime requirements. This has always caused headaches for Pandana, which requires
cython
andnumpy
to be present for compilation. PEP 517/518 solves this with the newpyproject.toml
standard.Build tools (like
pip
orbuild
) now look in here, create a temporary build environment, compile Pandana, and then install it in the parent environment along with its runtime requirements. This makes installation from source more consistent and reliable.pyproject.toml
can ensure support for an appropriate range of NumPy versions, which resolves issue #164.Updating setup.py
Cython is only a build-time requirement, so it's now removed from the requirements in
setup.py
.New packaging standards discourage arbitrary code in
setup.py
, so I'm removing the sections for linting, running tests, andCustomBuildExtCommand
, which are not really needed.Updating tests
When I tried to run the tests with a stand-alone command, it raised an error about the test scripts being in
/pandana/tests/
rather than the now-standard/tests/
. I moved them, this fixed it, and it also resolved the problem where we needed to cappytest
at<4.0
.New commands
pytest -s
pip install -e .
(don't runsetup.py
directly)pip install build
, thenbuild --sdist --wheel
Before merging