Uh oh!
There was an error while loading. Please reload this page.
chore: fix typing, formatting and tests - #31
Conversation
alejandrodnm
commented
Oct 18, 2024
Did you try pyright without strict? |
Askir
commented
Oct 18, 2024
@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: |
Askir
commented
Oct 19, 2024
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 🤷♂️ |
Askir
commented
Oct 25, 2024
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
91bfb10Compare
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 🤷♂️