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

Revamp Python build system to fix multiple build problems #6

Merged
merged 3 commits into from
Jan 8, 2022
Merged

Revamp Python build system to fix multiple build problems #6

merged 3 commits into from
Jan 8, 2022

Conversation

IRDonch
Copy link

@IRDonch IRDonch commented Sep 7, 2021

Use pyproject.toml to define build metadata. This enables the following improvements:

  • pycocotools.mask previously failed to load if the NumPy version was downgraded after pycocotools 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 having setuptools 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 running setup.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 the in-tree-build feature.

Use `pyproject.toml` to define build metadata. This enables the following
improvements:

* `pycocotools.mask` previously failed to load if the NumPy version was downgraded
  after `pycocotools` 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 having `setuptools` 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 running `setup.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 the `in-tree-build` feature.
@IRDonch
Copy link
Author

IRDonch commented Sep 16, 2021

@ppwwyyxx Ping?

@23pointsNorth
Copy link

This looks like a much-needed improvement, given that installing pycocotools has always been a hit and miss. Any updates?

@ppwwyyxx ppwwyyxx merged commit 142d746 into ppwwyyxx:master Jan 8, 2022
@ppwwyyxx
Copy link
Owner

ppwwyyxx commented Jan 8, 2022

Thanks a lot. Now merged!

@fcakyon
Copy link

fcakyon commented Jan 8, 2022

@IRDonch @ppwwyyxx this update doesnt break the windows installation, right?

@IRDonch IRDonch deleted the pep-517 branch January 9, 2022 15:47
@IRDonch
Copy link
Author

IRDonch commented Jan 9, 2022

@fcakyon I tested it on Windows; works fine for me.

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.

4 participants