Closed Domejko closed 6 months ago
Good work!
I think I'd prefer not to add httpx
to requirements. Additional requirements makes pip install
more painful for users.
If the functions still work if a user is missing httpx
, I'd motion for keeping it out of requirements
. Let me know if that sounds wrong.
I left some more comments :) Sorry this is a slightly complicated task.
I think I'd prefer not to add
httpx
to requirements. Additional requirements makespip install
more painful for users.If the functions still work if a user is missing
httpx
, I'd motion for keeping it out ofrequirements
. Let me know if that sounds wrong.
If we remove it from requirements we won't be able to perform strict type check provided by this module on timeout
argument.
I think we should use string-based type hint for timeout
instead of adding httpx
.
I think we should use string-based type hint for
timeout
instead of addinghttpx
.
But in that case we either simplify our type hint but just removing Timeout
, or we pass this hint Union[Optional[float], Tuple[Optional[float], Optional[float], Optional[float], Optional[float]], "Timeout", ]
that TimeoutTypes
suggests.
Hrm. I guess using the Union[Optional[float], Tuple[Optional[float], Optional[float], Optional[float], Optional[float]], "Timeout", ]
hint looks fine, if a bit verbose.
Ok, so I'll add now discussed changes and push them. But if ever mypy
would be implemented I assume that the Timeout
still maybe be causing errors.
Discussed changes have been added so PR is ready to test and merge.
Good work! Sorry it might take a few days to for me to get around to fully review. Busy recently.
Merging.
Sadly this PR caused some issues:
NotGiven
should be from anthropic._types
not from anthropic
)While I was able to resolve the unit test failures easily, the typing errors were harder to resolve.
As a result, we rollback this PR for now.
Hopefully we can reimplement it in the future.
Good effort in any case! I should've done more thorough review before merging. You're also welcome to try again.
You are running mypy
on the code, or some other type checking module ?
Should be PyRight
Ok, but which packages have showed you typing errors ? I'm asking because I would like to check it with this package and if possible fix it. If it was mypy
then I already mentioned in comments before that mypy
will probably show errors on that one.
Also for the future you should also specify this is README which type checking packages are you using so the contributor could also check code with them.
And so to be clear, since now on you will be using PyRight
for type checking ?
Hi Domejko!
Yes you're right. Sorry about the confusion, it's a very new module and I don't have processes in place yet.
The errors are pylance errors raised on prompt.py
that were resolved with 16c6b9f.
Yes. I run PyRight on my dev environment with standard type checking mode.
Regarding #2
RequestParams
class with type annotations used increate
method of AnthropicMessages
class and set it withtotal
flagFalse
**kwargs
following type hintUnpack[RequestParams]
httpx
package to setup.py requirements and updated importsCloses #2