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

Describe what extensions are and how to use them #470

Merged
merged 1 commit into from
Nov 28, 2022

Conversation

rgommers
Copy link
Member

@rgommers rgommers commented Aug 4, 2022

Note that an alternative idea discussed earlier was a separate function get_extension(), but IIRC that was not considered a good idea. Now that we have module-level __getattr__'s, it should not be a problem for any library to use a specified name like linalg or fft.

Whether the functions in the linalg extensions should all be required to exist or not was discussed in gh-403 (no clear conclusion there). One option discussed there to deal with hard to implement or more niche APIs is to create a separate status/label or some other way to track desired signatures (details to be worked out if we want to go that way).

Quoting @shoyer: My two cents is that it would be valuable if the standard specified the interface for these functions, even if not every library is going to implement them. It's really not a big deal to need to look up a compatibility table for advanced linear algebra functionality.

There is something to say for that as well (once we have a single easy to use compatibility table in a central place - see gh-402 and gh-462); I see both pros and cons. The pro is easy:

  • having a signature & semantics defined for a larger set of functions is, over time, going to lead to fewer differences between libraries.

Concerns I have are:

  • Scope management: until now it was relatively easy to draw a line about what included in the standard yes or no; this would make the scope significant wider (and that also implies more work I suspect),
  • Spending a lot of time on existing mismatches for fairly niche functionality, e.g. see this comment for the matrix exponential function(s).
  • We also do not do this for other functionality (e.g., most libraries have a median function, but we left it out on purpose because it's not great for distributed libraries; the median interface is not available anywhere in this repo).

Note that an alternative idea discussed earlier was a separate function
`get_extension()`, but IIRC that was not considered a good idea.
Now that we have module-level `__getattr__`'s, it should not be
a problem for any library to use a specified name like `linalg` or
`fft`.

Whether the functions in the `linalg` extensions should all be required
to exist or not was discussed in data-apisgh-403 (no clear conclusion there).
One option discussed there to deal with hard to implement or more niche
APIs is to create a separate status/label or some other way to track
desired signatures (details to be worked out if we want to go that way).
@rgommers rgommers added the Narrative Content Narrative documentation content. label Aug 4, 2022
@rgommers rgommers changed the title Describe what extensions are and how to use themo Describe what extensions are and how to use them Aug 4, 2022
@rgommers
Copy link
Member Author

rgommers commented Aug 4, 2022

One issue I still punted on was static typing; the type hint for an extension module like linalg should probably be the same as that for the main namespace - see gh-267.

@kgryte kgryte added this to the v2022 milestone Nov 21, 2022
@rgommers
Copy link
Member Author

There were no more comments on this. What is here should be pretty straightforward. It also closes issue gh-501, which was opened after this PR.

A separate list of signatures for fft/linalg functions that are not included in the standard can always be worked on separately.

Let's get this in.

@rgommers rgommers merged commit d5f252b into data-apis:main Nov 28, 2022
@rgommers rgommers deleted the describe-extensions branch November 28, 2022 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Narrative Content Narrative documentation content.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants