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

Properly handle types for Invokables with multiple args. #76

Open
isaacery opened this issue Sep 28, 2023 · 0 comments
Open

Properly handle types for Invokables with multiple args. #76

isaacery opened this issue Sep 28, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@isaacery
Copy link
Contributor

As it stands Invokables can only be called with a single (or no) arg(s). To call an Invokable with multiple args, they must be they must be wrapped in a resource, which either requires the user to define a new resource that repeats the information already in the type signature and leads to awkward user experience or loses type information (e.g. using CallArgs). Ideally, Invokables could be defined with arbitrary args, and the types could be dynamically determined from the call signature at registration time.

A sketch of what to do at registration time:

  1. Parse out its arguments using inspect.
  2. Create a new dynamically generated type that represents the signature. Register it and store it on the invokable class as the input type.
  3. Then in __call__ wrap *args and *kwargs in the new dynamic type, commit it, unwrap it and pass it to call.
@isaacery isaacery added the enhancement New feature or request label Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant