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

Wheel files that support numpy 2.0 #24

Merged
merged 12 commits into from
Apr 10, 2024
Merged

Conversation

Bing-su
Copy link
Contributor

@Bing-su Bing-su commented Apr 10, 2024

numpy is approaching its 2.0 release.
https://numpy.org/devdocs/dev/depending_on_numpy.html#numpy-2-0-specific-advice

According to numpy's documentation, packages built with numpy 2.0 will work with numpy 1.x, so modifying the build requirements to numpy 2.0 should be fine.

In addition, I've updated to support more platforms.

@ppwwyyxx
Copy link
Owner

According to #6 , code built with newer numpy does not work with older ones, even in the 1.x era. So I'm not sure whether we could upgrade like this.

At least we should figure out for code built with numpy2.0, what is the oldest numpy that can work with it. Then decide how to upgrade.

@ppwwyyxx
Copy link
Owner

So to proceed I think we'll need a CI test to build with 2.0, then install an older numpy and call the pycocotools C API to verify the build works. And we want this "older" numpy to be as old as possible because it will become the required minimum for future releases that builds with numpy2.0.

@Bing-su
Copy link
Contributor Author

Bing-su commented Apr 10, 2024

According to #6 , code built with newer numpy does not work with older ones, even in the 1.x era. So I'm not sure whether we could upgrade like this.

At least we should figure out for code built with numpy2.0, what is the oldest numpy that can work with it. Then decide how to upgrade.

Since with numpy 1.25.0, numpy works with older version. You can read about it in the deprecated oldest-supported-numpy repository and in the numpy documentation.

  1. When you build wheels for your package using a NumPy 1.xx version at build time, those will not work with NumPy 2.0.
  2. When you build wheels for your package using a NumPy 2.x version at build time, those will work with NumPy 1.xx.

@Bing-su
Copy link
Contributor Author

Bing-su commented Apr 10, 2024

I think I can modify the unittest.yml file to run the tests on different versions of numpy.
Would it be okay to remove the install_from: [source, source_with_pre, sdist] is it okay to remove it? It doesn't seem to have any meaning at this point, and it makes the workflow too long.

@ppwwyyxx
Copy link
Owner

Thanks. I think source_with_pre can be removed. source and sdist installation are quite different IIRC, so it would be good to keep them.

@Bing-su
Copy link
Contributor Author

Bing-su commented Apr 10, 2024

I modified the unittest.yml and you can see that oldest-supported-numpy, numpy<2, and numpy>=2.0.0rc1 all pass the test.

env:
CIBW_BUILD_FRONTEND: build
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.7"
Copy link
Owner

Choose a reason for hiding this comment

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

Is this going to break python3.7 & 3.8 users?

3.8 seems to have a good amount of users: https://pypistats.org/packages/pycocotools

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because numpy no longer supports versions lower than 3.9 😿.
https://numpy.org/neps/nep-0029-deprecation_policy.html#support-table

The other dependency, matplotlib, also does not support below 3.9.
https://github.com/matplotlib/matplotlib/blob/d45dfbb245b991e51f60a5083d61d0130b2ecc1b/pyproject.toml#L45

By modifying python_requires in setup.py, we can ensure that pycocotools 2.0.7 is selected for Python 3.8 and below. (pip or other dependency manager select the appropriate version.)

@ppwwyyxx ppwwyyxx merged commit f2417e1 into ppwwyyxx:master Apr 10, 2024
21 checks passed
@Bing-su
Copy link
Contributor Author

Bing-su commented Jun 17, 2024

2.0 is out today, can you make a release?

@ppwwyyxx
Copy link
Owner

Just made a release from https://github.com/ppwwyyxx/cocoapi/actions/runs/9540578245 . Let me know if you noticed any problems.

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.

2 participants