-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[django-filter] Absorb django-filter-stubs into typeshed #10919
base: main
Are you sure you want to change the base?
Conversation
pre-commit.ci autofix |
This comment has been minimized.
This comment has been minimized.
ecdac04
to
1e34eaa
Compare
This comment has been minimized.
This comment has been minimized.
9cf4747
to
1549268
Compare
6b08536
to
63e9ab6
Compare
This should be more or less ready for initial merge. If we can get this merged, I can look into the stubtest allowlist issues separately. Unless you think I should fix them immediately here? Some questions:
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some further questions. Personally I'd prefer to get this merged first and then do further improvements in follow-up PRs.
from django import forms | ||
|
||
from .conf import settings as settings | ||
from .constants import EMPTY_VALUES as EMPTY_VALUES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are lots of re-exports that shouldn't be re-exported. Should I clean these up before initial merge, or in follow-up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow-up is fine imo
def __init__(self, *args: Any, **kwargs: Any) -> None: ... | ||
|
||
class TimeRangeField(RangeField): | ||
widget: Any = ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I clean up attribute assignments?
widget: Any = ... | |
widget: Any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine to do this in a follow-up imo
(Writing from my phone, I have limited access to a laptop with Internet until Tuesday) In general, I think it's fine to tackle issues with these stubs in followup PRs, now you've got CI passing (thanks!). Most things in For your question (1) — I can't remember off the top of my head what the exact rules are, but unfortunately adding For your question (2), I think we're reasonably open to adding special-casing for specific stubs packages if it means we can run stubtest on them in CI. If you look at |
Yep, that's also mentioned in typeshed-internal/stub_uploader#90 (comment) Ideally these wouldn't be hard dependencies of the pacakge, but would only be installed in CI when testing. But there seems to be no such option currently? Users of There are two different stubs packages for Django: |
This comment has been minimized.
This comment has been minimized.
0bc7b19
to
63e9ab6
Compare
This comment has been minimized.
This comment has been minimized.
I think anything else we can fix/improve afterwards, but the One idea would be to create a new |
I'd prefer to avoid doing that, if at all possible. In 99% of cases in typeshed, if an external package is needed to make our tests pass, it's also needed for the stubs to make sense when they're installed by a user. I worry that by adding this option to our I believe that if a stubs package from typeshed imports a type that mypy can't resolve (because a dependency is missing), the imported type will just get silently resolved as For the specific case of I'm going to take a look now and see if there are any other ways of solving this problem. |
Many months have gone past. Has anything changed in terms of introducing a dependency on There are a few other Django-related or djangorestframework-related projects I might want to provide stubs for, but no point in undertaking that work until this blocker has been cleared. And maintaining a 3rd party stubs project outside of |
This comment has been minimized.
This comment has been minimized.
@intgr Sorry for the long process. I've added the Django stubs to the stub uploader allowlist. I see this as uncritical. There are some type errors now, though. |
Thanks for helping push this forward. Note that stub_uploader tests are giving the following error:
This blocker was described in typeshed-internal/stub_uploader#111 (comment) / typeshed-internal/stub_uploader#90 (comment) Do you have an idea what to do about this error? I suspect django-filter upstream will not want to add django-stubs to its dependencies. |
@intgr maybe we can try try to make a PR with django-stubs as a dependency to django-filter? |
Sorry for the inaction here. I feel we should be able to address this with changes in stub-uploader. (Maybe a rule that if you depend on X at runtime, the stubs may depends on X-stubs, for some trusted values of X?) |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
As described in #10918, I have added stubs from
django-filter-stubs
project. Upstream issue: DavisRayM/django-filter-stubs#13Please don't use squash merge to merge this (unless there's explicit decision to reconsider #10918). I have preserved original commit authors. There really weren't many changes in stubs files.
django-filter-stubs
into typeshed #10918typeshed
? DavisRayM/django-filter-stubs#13