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

Add types #2822

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

last-partizan
Copy link
Contributor

@last-partizan last-partizan commented Jul 9, 2024

This PR adds types.

Partially, from https://github.com/sbdchd/mongo-types/ by @sbdchd
Partially, generated by monkeytype
Partially handwritten and generated by included gen.py script (i'll remove it before merging)

I inlined most of the types, but fieds require lot of @overloads - so i put that into separate .pyi.

Note to self, check:

  • Passing generic types to fields when using string (like ReferenceField[Image]('Image'))

@last-partizan
Copy link
Contributor Author

@bagerard And now i need some guidance.

How to best approach testing types? For start i just put some tests into 'tests/test_typing.yml`, but running these tests requires mypy and all optional dependencies.

And that's probably will be slowest tests, due to mypy being not so fast.

pytest tests/test_typing.yml  18.11s user 0.98s system 99% cpu 19.144 total

If speed is a priority, we can put this into separate folder and run once on single python version.
But, we can also run this on all supported python versions (greater than 3.9) - this is probably better, but slower option.

@jokester
Copy link

jokester commented Dec 1, 2024

great work 🦸🏽

@last-partizan last-partizan force-pushed the merge-stubs branch 4 times, most recently from 2da7633 to 82647e2 Compare December 1, 2024 12:57
@last-partizan last-partizan marked this pull request as ready for review December 1, 2024 13:52
@last-partizan
Copy link
Contributor Author

@bagerard this is ready for review.

That one CI fail looks like unrelated to my changes.

But, maybe it's time to drop 3.8 and 3.7 from CI and add 3.12 and 13? I can handle this in separate PR if you wish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants