Releases: typeddjango/django-stubs
6.0.2
What's Changed
We now officially support mypy@1.20.
Since this release we run ty over our test cases.
- Add missing
swappableparameter to ForeignKey and OneToOneField by @emmanuel-ferdman in #3204 - Support WithAnnotations TypedDict fields in queryset validation by @emmanuel-ferdman in #3208
- Add
backendattribute stub for authenticated users by @emmanuel-ferdman in #3210 - [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in #3214
- chore(deps): update dependency uv_build to >=0.11.0,<0.12.0 by @renovate[bot] in #3216
- Reparametrize implicit generic QuerySet subclasses by @federicobond in #3217
- Fix
inoperator false positive with union types by @emmanuel-ferdman in #3206 - Refactor auto reparametrize to reduce code duplication by @UnknownPlatypus in #3219
- Allow missing config section when
DJANGO_SETTINGS_MODULEis set by @emmanuel-ferdman in #3223 - Fix
NestedObjects.nestedreturn type tolist[Any]by @emmanuel-ferdman in #3226 - Update HttpRequest path methods to match Django 5.x defaults by @01xnikhil in #3227
- Resolve queryset annotate types for expressions with static ClassVar by @federicobond in #3221
- Use
Modelinstead ofSelfin parms and addAltersDatainheritance by @emmanuel-ferdman in #3228 - Expose django admin fieldset types in
django_stubs_extby @UnknownPlatypus in #3237 - Migrate more typecheck tests to assert_type by @UnknownPlatypus in #3234
- Include django and django-stubs versions in plugin config data by @UnknownPlatypus in #3236
- Make Lookup type argument optional by defaulting _T to Any by @UnknownPlatypus in #3235
- Fix mypy crash on QuerySet subclass with forward-referenced TypeVar by @UnknownPlatypus in #3241
- Disallow mutually exclusive arguments
booleanandempty_valuein admindisplaydecorator by @UnknownPlatypus in #3242 - Use getattr for
field.attnamewith fallback tofield.nameby @UnknownPlatypus in #3248 - Resolve
.values()field types on annotated querysets by @federicobond in #3232 - Use newer syntax and enable more mypy configuration options by @ngnpope in #3203
New Contributors
- @01xnikhil made their first contribution in #3227
Full Changelog: 6.0.1...6.0.2
6.0.1
What's Changed
- Fix
serve()return type to includeHttpResponseby @emmanuel-ferdman in #3199 - Add missing
Metaclass stubs for auth and session models by @emmanuel-ferdman in #3200 - Fix crash in
.order_byvalidation for abstract models by @UnknownPlatypus in #3197
Full Changelog: 6.0.0...6.0.1
6.0.0
This version add stubs coverage to all known Django 6.0 functionality. If you find anything missing, please open an issue.
Besides Django 6.0 updates, there is an even larger number of other improvements.
Many thanks to everyone who helped out, the amount of contributions has been amazing!
⚠️ Known issues
There is a crash bug in the mypy plugin, when checking code that uses QuerySet.order_by() with abstract models. Please follow #3184
Django 6.0 stubs updates
- Add Model.NotUpdated & ObjectNotUpdated exceptions by @intgr in #2940
- Add stubs for built-in CSP support by @federicobond in #2931
- Add
databases=parameter tocheck_generic_foreign_keys,check_model_name_lengthsby @Tosinibikunle in #2951 - Add stubs for django.db.models.StringAgg and Aggregate order_by fields by @federicobond in #2960
- Add stubs for django.contrib.postgres.search.Lexeme and CombinedLexeme by @federicobond in #2961
- Update ADMINS and MANAGERS setting type by @federicobond in #2965
- Require kwargs for optional parameters in mail functions by @federicobond in #2966
- Add hints support to postgres extension classes by @federicobond in #2972
- Fix missing stubs for
__del__methods by @UnknownPlatypus in #2974 - Require kwargs for optional parameters in EmailMessage by @federicobond in #2975
- Support passing MIMEPart object to EmailMessage.attach by @federicobond in #2976
- Add Django Tasks framework by @federicobond in #2967
- Add
SetPasswordMixin.__class_getitem__by @sobolevn in #2985 - Remove useless decorators from
main/django/contrib/auth/admin.pyby @sobolevn in #2986 - Remove default value from check functions by @brianhelba in #2993
- Allow plain
ForminDeleteViewtype parameters by @emmanuel-ferdman in #2996 - Fix
FileFieldandImageFieldinstance access return types by @emmanuel-ferdman in #2997 - Fix window function parameter types by @emmanuel-ferdman in #2999
- Add support for AnyValue aggregate by @federicobond in #3002
- Add missing database backend feature flags by @emmanuel-ferdman in #3005
- Add TASKS setting by @federicobond in #3006
- Add async pagination support by @emmanuel-ferdman in #3009
- Add template partials support by @emmanuel-ferdman in #3010
- Update deprecation module by @emmanuel-ferdman in #3013
- Add missing migration serializers by @emmanuel-ferdman in #3016
- Add system checks support by @emmanuel-ferdman in #3019
- Add missing mail module signatures by @emmanuel-ferdman in #3023
- Add auth module stubs by @emmanuel-ferdman in #3024
- Add http utilities support by @emmanuel-ferdman in #3025
- Add form constraint validation support by @emmanuel-ferdman in #3026
- Add test module stubs by @emmanuel-ferdman in #3027
- Add contenttypes module stubs by @emmanuel-ferdman in #3029
- Add missing migration operation stubs by @emmanuel-ferdman in #3032
- Add postgres module stubs by @emmanuel-ferdman in #3037
- Add utils module stubs by @emmanuel-ferdman in #3043
- Update conf settings stubs by @emmanuel-ferdman in #3045
- Add tasks module stubs by @emmanuel-ferdman in #3044
- Update admin module stubs by @emmanuel-ferdman in #3048
- Update constraint, index, and migration stubs by @emmanuel-ferdman in #3051
- Update GIS module stubs by @emmanuel-ferdman in #3054
- Update PostgreSQL backend stubs by @emmanuel-ferdman in #3070
- Update Oracle utils stubs by @emmanuel-ferdman in #3066
- Update SQLite backend stubs by @emmanuel-ferdman in #3072
- Update base database backend stubs by @emmanuel-ferdman in #3075
- Update MySQL and Oracle backend stubs by @emmanuel-ferdman in #3078
- Update compiler stubs by @emmanuel-ferdman in #3079
- Remove deprecated stubs and add referenced_fields by @emmanuel-ferdman in #3081
- Add missing JSON lookup method stubs by @emmanuel-ferdman in #3082
- Add types for BaseBinaryDumper in postgis base by @ahmedasar00 in #3099
- Add missing Model base class stubs by @emmanuel-ferdman in #3101
- Add model expressions stubs by @emmanuel-ferdman in #3096
Other stubs improvements
- Fix
SessionBasedict method signatures by @emmanuel-ferdman in #3020 - Fix WSGI
LimitedStreamstub signatures by @emmanuel-ferdman in #3022 - Replaced
IO[bytes]with_PostDataProtocolto fixHttpRequestcompatibility by @Skyiesac in #3167 ResponseHeaderscan take any mapping, not justdictby @sobolevn in #3014- Allow
formfield_callbackto returnNoneby @emmanuel-ferdman in #3021 - Add overloads to Library.inclusion_tag for proper type inference by @rgant in #3039
- Add missing items across contrib module stubs by @emmanuel-ferdman in #3049
- Add missing items across core module stubs by @emmanuel-ferdman in #3058
- Fix lower bound for
response_gone_classby @UnknownPlatypus in #3061 - Add admin helper and autocomplete stubs by @emmanuel-ferdman in #3063
- Fix auth and contenttypes stub signatures by @emmanuel-ferdman in #3069
- Allow
get_violation_error_messageto return dictionaries by @meunomemauricio in #3065 - Fix database router type hints by @emmanuel-ferdman in #3074
- Allow UserAdmin with custom user models by @emmanuel-ferdman in #3076
- Fix conflated decorator and decorator factory return types by @emmanuel-ferdman in #3080
- Add form_class stubs on auth views by @emmanuel-ferdman in #3083
- Fix password hasher stubs and add missing members by @emmanuel-ferdman in #3084
- Allow TransactionTestCase.assertQuerySetEqual to take values=Iterable by @cjwatson in #3087
- Update min/max/step parameters of IntegerField to accept Callables by @LincolnPuzey in #3093
- Fix login_required overloads and auth model stubs by @emmanuel-ferdman in #3090
- Add migration autodetector and questioner stubs by @emmanuel-ferdman in #3095
- Add types BaseTextDumper in postgis base by @ahmedasar00 in #3100
- Add missing GIS geometry and measure stubs by @emmanuel-ferdman in #3102
- Fix
SubqueryandExiststo accept subquery inputs by @emmanuel-ferdman in #3103 - Add missing GDAL geometry and SRS stubs by @emmanuel-ferdman in #3104
- Fix encoding functions returning Any instead of str/bytes by @emmanuel-ferdman in #3106
- Add GIS management command stubs by @emmanuel-ferdman in https://gi...
5.2.9
Version 5.2.9 will be the last version to target Django 5.2 -- the next version will be updating to 6.0!
🚀 We need your help: Adding Django 6.0 stubs
Many new Django 6.0 APIs are still missing stubs coverage, and changes to existing APIs are not covered.
If you are interested in contributing, please help by opening PRs (check that a PR does not exist already for your topic).
👉 Starting points
And by the way, we are still missing some things from previous Django versions too! Check earlier release note, other allowlist_todo*.txt files and #1493 (comment)
🤝 You help us, we help you
If want to help but you are not sure how to implement something in stubs:
- Check tutorials listed here
- Or just open a discussion topic, feel free to ping @intgr in the message.
What's Changed
- fix: allow
EmailMultiAlternativesinoutboxby @alexei in #2922 - Fix infinite semantic analysis loop when using from_queryset by @lee3jjang in #2935
- Fix dispatch_uid type: str -> _AnyHashable by @craigds in #2950
- Update
get_auto_imports()to also allow returningNoneby @jamesbeith in #2956 - Make LoginView generic over its form class by @slafs in #2959
- fix: template type in template response by @alexei in #2964
- fix: Annotate SessionStore with a type var for the Session type (#2056) by @CharString in #2969
- fix:
prefetch_related_objectsrequiresSequencenotIterableby @emmanuel-ferdman in #2970 - Fix kwargs for
forms.widgets.Scriptby @brianhelba in #2973 - fix: django.contrib.gis.utils.LayerMapping attribute types by @kelvan in #2988
- Make all system checks return a
list, not aSequenceby @brianhelba in #2992 - Improve database-related check signatures by @brianhelba in #2994
Housekeeping
- Update pyrefly to 0.44.0 by @sobolevn in #2927
- Update django to 5.2.9 by @sobolevn in #2928
- Renovate: mypy updates to widen accepted version range by @intgr in #2921
- CI: Downgrade to Python 3.10 for 'test-older-django' by @intgr in #2955
- Prepare for 5.2.9 release (without Django 6.0 changes) by @intgr in #2995
- Version 5.2.9 release by @intgr in #3007
New Contributors
- @lee3jjang made their first contribution in #2935
- @jamesbeith made their first contribution in #2956
- @slafs made their first contribution in #2959
- @CharString made their first contribution in #2969
- @emmanuel-ferdman made their first contribution in #2970
- @kelvan made their first contribution in #2988
Full Changelog: 5.2.8...5.2.9
5.2.8
What's Changed
- Run tests against the lowest supported django version by @UnknownPlatypus in #2862
- fix: allow
django.shortcuts.resolve_urlto receive a str-promise by @alexei in #2869 - fix: add type declarations for some missing settings by @alexei in #2870
- fix: import all forms widgets by @alexei in #2871
- Update assertContains and assertNotContains signatures by @SebCorbin in #2880
- Update middleware types by @UnknownPlatypus in #2884
- Remove
strfrom enum label types when we know for sure the labels are lazy by @rchen152 in #2888 - Switch Dependabot to Renovate by @intgr in #2893
- CI: Only run branch tests on Renovate branches where it's needed by @intgr in #2899
- fix: in db.models make required_db_vendor str by @Tatsh in #2909
- Run pyrefly over test cases by @rchen152 in #2914
- Mypy 1.19 by @sobolevn in #2919
New Contributors
- @alexei made their first contribution in #2869
- @SebCorbin made their first contribution in #2880
- @rchen152 made their first contribution in #2888
- @renovate[bot] made their first contribution in #2895
Full Changelog: 5.2.7...5.2.8
5.2.7
5.2.6
What's Changed
Improvements
- Update
add_orderingsignature too by @UnknownPlatypus in #2822 - Support
related_query_nameinModel._meta.get_fieldsby @UnknownPlatypus in #2821 - django.urls.resolve can also take _StrPromise by @asottile in #2826
- Add
strict_model_abstract_attrssetting to allowmodels.Model.objectsaccess by @sobolevn in #2830 - Refactor
_replace_type_varthat can potentially cause cache problems by @sobolevn in #2834 - Fix
union/intersection/differenceto support QuerySet usingvalues_listandvaluesby @UnknownPlatypus in #2829 - fix: allow to query decimal fields with int by @sk- in #2838
- Fix the
log_actiondeprecation notice by @UnknownPlatypus in #2839 - BaseForm.add_error: Use covariant types by @inducer in #2849
- Allow to annotate existing model field de-selected via prior
.values/.values_listcalls by @UnknownPlatypus in #2836 - Support
GenericPrefetchby @UnknownPlatypus in #2851 - Also typecheck
agetcalls by @UnknownPlatypus in #2856 - Validation of the
fieldsargument tobulk_updateby @UnknownPlatypus in #2808
Housekeeping & CI
- Add
mypy_primerworkflow by @sobolevn in #2819 - Remove magically added
django.contrib.contenttypesinstalled app in tests by @UnknownPlatypus in #2853 - Use consistent indentation in
pyproject.tomlby @intgr in #2847 - Version 5.2.6 release by @intgr in #2859
Ruff
- Bump
ruffto0.13.0by @sobolevn in #2828 - Add some RET plugin ruff rules by @UnknownPlatypus in #2852
- Enable more ruff rules by @UnknownPlatypus in #2855
- Fix merge conflict + re-run pre-commit on all files by @UnknownPlatypus in #2854
uv package manager
- Update release documentation, workflow and build-and-check job to
uvby @intgr in #2846 - Switch to
uv_buildbuild system & cleanup by @intgr in #2848 - Use same
uvworkspace fordjango-stubs-extalso by @intgr in #2857 - Test updated release workflow - Version 5.2.6a1 release by @intgr in #2858
New Contributors
Full Changelog: 5.2.5...5.2.6
5.2.6a1 (testing)
Testing updated release workflow.
Using alpha version in case anything goes wrong -- so users won't be updated automatically.