-
Notifications
You must be signed in to change notification settings - Fork 1
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
chore: fix typing, formatting and tests #31
Conversation
Did you try pyright without strict? |
@alejandrodnm without strict it looks a lot better:
But this allows untyped functions and Any returns which essentially allows circumventing the type checker altogether. Not great imo. For reference this is how it looks with strict:
|
The main problem is that some libraries in the python ecosystem still don't have types (noteably asyncpg and pgvector). So for Asyncpg I (or rather Claude) typed the functions as returning an Pyright works differently, I can ignore the error in that location but it doesn't trust my annotation afterwards it instead build a union type I haven't really figured out how to change this behaviour, there doesn't seem to be away to say: Trust my annotation. The only recommendation that pyright has for untyped third party libraries is to write stub files yourself, which works but honestly is a bit too much effort right now. Asyncpg e.g. has a PR to add types since 4 years here. I get that in pgai we use pyright and would need to use the same typechecker. It just seems that once you have some sort of untyped dependencies the pyright strict mode no longer really works. Kinda sucks 🤷♂️ |
I've fixed the typing issues by providing stubs for everything in use. Took a while but with Claudes help it was doable. So now we can use pyright in strict and dont have to change anything about the config for pgai. @alejandrodnm |
8eb554b
to
91bfb10
Compare
The PR is based on the ruff changes earlier so overall it does:
Note that the recording is extremely large because tiktoken downloads the whole encoding vocab through an http request.
I've added a filter for removing authorization tokens and cookies to vcr.py. But I do feel like this is a bit of a time bomb until someone accidentally commits a secret. If a filter doesn't catch a header and the author doesn't see it before pushing 🤷♂️