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

[WIP, Proposal] Improve argument annotations interface #10746

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JeppeKlitgaard
Copy link
Contributor

@JeppeKlitgaard JeppeKlitgaard commented May 17, 2022

This PR introduces a container class with a bit of additional logic sprinkled on top in order to consistently handle argument annotations.

I propose argument annotations are parsed into an ArgumentAnnotation object as part of the input validation of all transformations (jit, grad, ...). These are then the objects that are passed around instead of tuples of argnums and argnames. These tuples can be accessed when needed by lower level functions.

This enables an easy and idiomatic way of ensuring arguments are validated while simultaneously providing an easy way to implement backwards compatibility through a subclass (not yet done).

@JeppeKlitgaard

This comment was marked as outdated.

@JeppeKlitgaard JeppeKlitgaard force-pushed the consistent-arg-annotations branch 5 times, most recently from 66fe0cb to ed0c7fa Compare May 19, 2022 21:44
@JeppeKlitgaard JeppeKlitgaard force-pushed the consistent-arg-annotations branch 10 times, most recently from a31ff31 to 94140c8 Compare May 21, 2022 07:45
@JeppeKlitgaard
Copy link
Contributor Author

Read The Docs error seems unrelated (404 HTTP error on intersphinx with SciPy)

@jakevdp
Copy link
Collaborator

jakevdp commented May 23, 2022

The RTD failure should be fixed now

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.

None yet

2 participants