Repository navigation
Adapt type annotations to django-stubs 6.1.2 (unblocks lock file maintenance) - #343
Open
NumericalAdvantage wants to merge 1 commit into
Open
NumericalAdvantage wants to merge 1 commit into
NumericalAdvantage wants to merge 1 commit into
Conversation
The lock file maintenance brings django-stubs 6.1.2 and pyright 1.1.414, under which pyright rejects the bare BaseModelForm parameter of the collection views' form_valid (the model-form views now default their form type to ModelForm[_M]) and the reads of the DRF groups field's queryset attribute (Manager gained a descriptor __get__). Annotate the forms as ModelForm[Collection], kept out of runtime evaluation, and read the queryset through get_queryset(). No behaviour change.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unblocks #305 (Renovate's lock file maintenance), whose CI has been failing the pyright step for three weeks, so its automerge never fired.
radis/collections/views.py,radis/reports/api/serializers.pyform_validin the collection create/update views takesModelForm[Collection]instead of a bareBaseModelForm; django-stubs 6.1.2 givesCreateView/UpdateViewa default form type (ModelForm[_M]), and the bare annotation is no longer assignable to itradis/collections/views.pygetsfrom __future__ import annotations, because Django'sModelFormis not subscriptable at runtime (RADIS does not use the django-stubs-ext monkeypatch) and the annotation must not be evaluatedReportSerializerreads the groups field's queryset throughget_queryset()(which already returns a fresh.all()), instead of thequerysetattribute; django-stubs 6.1.2 adds a descriptor__get__toManager, which makes pyright reject attribute reads typedQuerySet | Manager | Noneon DRF fieldsHow this was verified
Reproduced the four CI errors locally with the environment from the Renovate branch (
uv sync --frozenonrenovate/lock-file-maintenance), applied the two changes, and ran pyright over the whole project in both environments: 0 errors in each. The affected test suites pass; nothing changes at runtime.Once this is on main, Renovate rebases #305 and the lock file maintenance should automerge as configured.
🤖 Generated with Claude Code