Revamp Python build system to fix multiple build problems #6
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.
Use
pyproject.toml
to define build metadata. This enables the following improvements:pycocotools.mask
previously failed to load if the NumPy version was downgraded afterpycocotools
was installed, due to an ABI mismatch. This is fixed by using the oldest supported NumPy version for the current environment as the build dependency.Installing
pycocotools
no longer installs Cython as a dependency (it's not needed at runtime).pycocotools
can now be installed without havingsetuptools
in your environment.All this is accomplished at the price of more strict system requirements:
Required Python version is now 3.5+, primarily because that is what
oldest-supported-numpy
requires. Notably, this means that Python 2 support is dropped.pip 10 or higher is required to install
pycocotools
from an sdist.The setuptools requirement is bumped to 43, because setuptools includes pyproject.toml in the sdist starting with this version. However, this has no impact on users, since pip will automatically fetch the correct version.
Additionally, update the documentation to recommend using
pip
to install the project, instead of runningsetup.py
directly. This ensures that the build result is the same as you would get by installing from an sdist. pip 21.1+ is required for this, because it uses thein-tree-build
feature.