-
Notifications
You must be signed in to change notification settings - Fork 62
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
Parameter 'class_or_builder' unfilled #228
Comments
@prkumar care to weigh in? This looks like it affects anything that inherits from |
You can also reproduce with a toy example like this: from uplink import Consumer, returns
@returns.json
class MyAPI(Consumer):
"""Reproduces"""
my_api = MyAPI(base_url="https://example.com/") That one gets the same error because |
Hey @bjornsnoen - I'm unable to reproduce this on the latest version of uplink, What version are you using? |
@prkumar I made a small repo that reproduces it, here https://github.com/bjornsnoen/uplink-toy |
@bjornsnoen - Thanks for providing the helpful sample repo. I was able to reproduce locally using it! A couple quick thoughts:
|
@prkumar yes, you understand correctly, the code works as expected and the only reason to expect static typing to work is because things like the returns.from_json decorator actively use type annotations. If you search the docs for "typing" some things do come up, the top hit seeming to be a core python module for PEP 484? I want to make clear that the from uplink import Consumer, get, returns
class MyAPI(Consumer):
"""Reproduces"""
@returns.json
@get("test")
def test():
"""Also reproduces"""
my_api = MyAPI(base_url="https://example.com/")
my_api.test() The call to |
@bjornsnoen - Gotchu. As you mentioned, I think it makes sense to assume that the package supports type checking, considering the usage of type annotations throughout the docs. IIUC, to fix this, we need to add type annotations to the library. Notably, we've avoided adding these because of our advertised support for Python 2.7. However, version 0.9.* will be the last minor version to support Python 2.7. Starting with version 0.10, we can start adding type annotations in the library, which should address this issue. |
class Test(Consumer):
@returns.json
@JSON
@patch("orders/address/pickup")
def task_updatePickupLoc(self, **body: Body):
"""Updates Pickup Location of a given order"""
When the method is called using required parameters the code runs and performs a patch request but gives me a warning to provide 'class_or_builder' why?
The text was updated successfully, but these errors were encountered: