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

Array API compatibility #67

Open
ntessore opened this issue Mar 3, 2023 · 0 comments
Open

Array API compatibility #67

ntessore opened this issue Mar 3, 2023 · 0 comments
Assignees
Labels
api An (incompatible) API change array-api Work is related to the Array API
Milestone

Comments

@ntessore
Copy link
Collaborator

ntessore commented Mar 3, 2023

As much as possible of the core library should be made to work with compatible array types (numpy, torch, jax, dask, cupy, ...).

There is a nascent standard to support this: Array API

For the time being, the array-api-compat library can be used to get a universal namespace that replaces np, jnp, etc.

@ntessore ntessore added the api An (incompatible) API change label Mar 3, 2023
@ntessore ntessore added this to the v2023.3 milestone Mar 3, 2023
@ntessore ntessore modified the milestones: v2023.3, v2022.4 Mar 14, 2023
@ntessore ntessore modified the milestones: v2022.5, future May 17, 2023
paddyroddy added a commit that referenced this issue Oct 4, 2024
Closes #198. For Array API support (#67), we need minimum versions of:

1. `Python 3.9` as specified here
https://data-apis.org/array-api-compat/changelog.html#id9
2. `NumPy 1.22` as specified here
https://numpy.org/doc/stable/reference/array_api.html#array-api-standard-compatibility

In this PR I have enforced both of these. The code changes have come
from `ruff` linting, utilising the benefits from
[3.9](https://docs.python.org/3/whatsnew/3.9.html).

I also removed some of the overzealous comments on imports. They weren't
adding anything and meant the imports took up more room.
paddyroddy added a commit that referenced this issue Oct 15, 2024
Adding `mypy` to a pre-existing codebase is never easy. I initially
attempted this in #308, but have since split this up into separate
issues:
- [x] #347
- [x] #356
- [ ] #358

In this PR, `mypy` is added but in order for CI to pass, the `# type:
ignore[]` syntax is used throughout. I didn't want to tackle these here
too (see #308) as it gets quite messy.

One thing I have done (following #356) is change every empty
`npt.NDArray` to `npt.NDArray[typing.Any]` (see #330), as this actually
results in fewer errors than leaving them all blank. Ideally, we'd like
to fill in as many of the `typing.Any` as possible - they're a bit
useless by themselves. However, that is not the priority for now. Plus,
I expect typing to change when #67 is tackled.
@ntessore ntessore pinned this issue Nov 13, 2024
@paddyroddy paddyroddy added the array-api Work is related to the Array API label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api An (incompatible) API change array-api Work is related to the Array API
Projects
None yet
Development

No branches or pull requests

3 participants