Python packaging standards have evolved in recent years. This PR creates a pyproject.toml file to specify Pandana's build-time requirements, and streamlines setup.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 and numpy to be present for compilation. PEP 517/518 solves this with the new pyproject.toml standard.
Build tools (like pip or build) 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, and CustomBuildExtCommand, 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 cap pytest at <4.0.
New commands
To run tests: pytest -s
To install Pandana from source: pip install -e . (don't run setup.py directly)
To build source and binary distributions: pip install build, then build --sdist --wheel
Before merging
[ ] update all documentation referring to test, build, and installation procedures
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