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

Make FlowUtils (and Flowkit) compatible with NumPy >= 2.0 #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BastienDussap
Copy link

Hi,
FlowUtils (and therefore Flowkit) are blocked to (at best) numpy=1.26 because of the change in its C API. This PR updates the package to ensure compatibility with NumPy version 2.0 and above.

What changes have been made?.

In both _logicle.c and gate_helpers.c :

  • Replaced outdated NPY_IN_ARRAY with NPY_ARRAY_IN_ARRAY
  • Use PyArrayObject instead of PyObject when calling C functions like PyArray_DATA
  • Change the way we throw exception if the array doesn't exist

In the setup files:

  • Set the minimum NumPy version to 2.0 in pyproject.toml and setup.py.
  • Add the tag -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION in the extra_compile_args
    -> This new version must be compiled with numpy>=2.x, but the python can be used with older versions of numpy (at least 1.26 works for me).

Breaking changes
The package now requires NumPy >= 2.0 to compile the C files. Older versions are no longer supported.

How was this tested?
I use run_test.py, no changes where made in the unit tests.

Bonus
In gate_helpers.c you mention that the algorithm you use for points_in_polygon is based on a website. But this website now seems to be a scam.

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.

1 participant