Update dependency django-stubs to v5
This MR contains the following updates:
Package | Type | Update | Change |
---|---|---|---|
django-stubs (changelog) | dependencies | major |
^4.2 -> ^5.0
|
Release Notes
typeddjango/django-stubs
v5.0.0
Announcements
-
QuerySet
class no longer derives fromCollection
. If you run into errors likeincompatible type "_QuerySet[User, User]"; expected "Collection[User]"
, please read this announcement.
Headline changes
- Remove incorrect
Collection
base class and__contains__
method fromQuerySet
by @fidoriel in https://github.com/typeddjango/django-stubs/pull/1925 - Pyright joins the workflow in an advisory capacity by @jorenham in https://github.com/typeddjango/django-stubs/pull/2019
- feat: Allow setting django_settings_module from env by @armanckeser in https://github.com/typeddjango/django-stubs/pull/2021
- Add
ManyRelatedManager.through
attribute and generic type parameter by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2026
What's Changed
- Make
StrPromise
not inherit fromSequence[str]
by @intgr in https://github.com/typeddjango/django-stubs/pull/1841 - Update and prepare for Django 5.0 by @intgr in https://github.com/typeddjango/django-stubs/pull/1859
- Ensure mypy plugin processes inherited many to many fields by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1864
- Include ModelBase subclasses in plugin base class hook condition by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1863
- [5.0] Added many new a-prefixed asynchronous methods by @bigfootjon in https://github.com/typeddjango/django-stubs/pull/1741
- Remove section regarding custom queryset methods from README by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1865
- Fix type of
AppConfig.models_module
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1866 - Allow
None
in settingsMIGRATION_MODULES
dict values by @asottile in https://github.com/typeddjango/django-stubs/pull/1871 - Add type hints for
JSONField.from_db_value
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1879 - Fix/pyright unknown by @dephiros in https://github.com/typeddjango/django-stubs/pull/1873
- Fix type hints of
converters
inurls.resolvers
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1892 - Update mypy to 1.8.0 by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1885
- Add
@type_check_only
to all Protocols and known stubs-only classes by @intgr in https://github.com/typeddjango/django-stubs/pull/1894 - Fix types for UniqueConstraint instantiation by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1880
- Add
ModuleType
as a possible type toURLResolver.urlconf_name
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1891 - Fix type hint of
URLPattern.default_args
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1895 - Update ruff and silence
PYI046
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1907 - Use PEP 570 syntax by @Viicos in https://github.com/typeddjango/django-stubs/pull/1908
- Fix readme settings example by @Viicos in https://github.com/typeddjango/django-stubs/pull/1910
- Fix type hint of
EmailBackend.ssl_keyfile
andEmailBackend.ssl_certfile
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1911 - Add type of
django.VERSION
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1916 - Added
CommandParser
tocommands.__init__
by @jamesbraza in https://github.com/typeddjango/django-stubs/pull/1927 - [5.0] add
assume_scheme
to forms.URLField by @asottile in https://github.com/typeddjango/django-stubs/pull/1929 - Fix return type of
BaseModelAdmin.formfield_for_dbfield
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1934 - Revert
pre-commit==3.6.1
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1936 - Fix type hint of
Response.set_cookie.max_age
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1941 - 5.0: Add ChoicesType by @q0w in https://github.com/typeddjango/django-stubs/pull/1942
- Add through_defaults for RelatedManager methods by @mfosterw in https://github.com/typeddjango/django-stubs/pull/1943
- Update type hints of
core.signing
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1945 - [5.0] Update
core.validators
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1947 - [5.0] Update
core.paginator
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1946 - Generic
forms.ModelChoiceField
by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1889 - Support processing of other relations and fields when one is broken by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1877
- Allowing
set
inmodel_to_dict
'sexclude
by @jamesbraza in https://github.com/typeddjango/django-stubs/pull/1952 - [5.0] Add django.db.models.GeneratedField by @palfrey in https://github.com/typeddjango/django-stubs/pull/1944
- Fix type hint of
BaseEngine.template_dirs
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1954 - Update type hints of contrib.auth.hashers by @yhay81 in https://github.com/typeddjango/django-stubs/pull/1955
- deps: Upgrade pre-commit for newer versions of python by @delfick in https://github.com/typeddjango/django-stubs/pull/1961
- 5.0: Add auth.middleware.auser by @q0w in https://github.com/typeddjango/django-stubs/pull/1966
- 5.0: Add ModelAdmin.show_facets by @q0w in https://github.com/typeddjango/django-stubs/pull/1967
- ruff: Fix config warnings by @q0w in https://github.com/typeddjango/django-stubs/pull/1964
- 5.0: Add BaseConstraint.violation_error_code by @q0w in https://github.com/typeddjango/django-stubs/pull/1969
- 5.0: Add Signal.asend and Signal.asend_robust by @q0w in https://github.com/typeddjango/django-stubs/pull/1965
- 5.0: Add QuerySet.(a)update_or_create new create_defaults arg by @q0w in https://github.com/typeddjango/django-stubs/pull/1970
- 5.0: Add AdminSite.get_log_entries by @q0w in https://github.com/typeddjango/django-stubs/pull/1963
- 5.0: Add gis ClosestPoint by @q0w in https://github.com/typeddjango/django-stubs/pull/1968
- 5.0: Rename save_existing arg instance to obj by @q0w in https://github.com/typeddjango/django-stubs/pull/1971
- 5.0: Remove admin.helpers.checkbox by @q0w in https://github.com/typeddjango/django-stubs/pull/1972
- 5.0: Change annotation_select_mask from set[str] to list[str] by @q0w in https://github.com/typeddjango/django-stubs/pull/1973
- fixup: Pass violation_error_code to init by @q0w in https://github.com/typeddjango/django-stubs/pull/1975
- Avoid returning None from get_field_related_model_cls by @SingingTree in https://github.com/typeddjango/django-stubs/pull/1956
- 5.0: Pass positional args name and violation_error_message to BaseConstraint by @q0w in https://github.com/typeddjango/django-stubs/pull/1974
- 5.0: Remove pytz support by @q0w in https://github.com/typeddjango/django-stubs/pull/1980
- 5.0: Remove global setting USE_L10N by @q0w in https://github.com/typeddjango/django-stubs/pull/1979
- 5.0: Remove OSMGeoAdmin, GeoModelAdmin by @q0w in https://github.com/typeddjango/django-stubs/pull/1981
- 5.0: Remove extra_tests arg for DiscoverRunner.build_suite/run_tests by @q0w in https://github.com/typeddjango/django-stubs/pull/1978
- 5.0: Remove django.utils baseconv and datetime_safe modules by @q0w in https://github.com/typeddjango/django-stubs/pull/1977
- 5.0: Add request arg to ModelAdmin.lookup_allowed by @q0w in https://github.com/typeddjango/django-stubs/pull/1976
- Add URL converter protocol type by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1984
- Fix type annotation for RegisterLookupMixin.class_lookups by @avoronov-box in https://github.com/typeddjango/django-stubs/pull/1962
- Update django to 5.0.3 by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1990
- Remove some deprecated Django 3.x APIs by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1991
- Fix BaseModelAdmin.view_on_site annotation by @cuu508 in https://github.com/typeddjango/django-stubs/pull/1993
- Allow immutable
extra_context
onTemplateView
s by @samueljsb in https://github.com/typeddjango/django-stubs/pull/1994 - Add BoundField.html() by @pelme in https://github.com/typeddjango/django-stubs/pull/1999
- Allow timedelta type for session.set_expiry() argument by @mlazar-endear in https://github.com/typeddjango/django-stubs/pull/2001
- Bump
pytest-mypy-plugins
to 3.1.1 by @sobolevn in https://github.com/typeddjango/django-stubs/pull/2003 - Update mypy, add a bit more metadata by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1997
- 5.0: Update
django.contrib.auth
by @ngnpope in https://github.com/typeddjango/django-stubs/pull/2009 - 5.0: Update
django.conf
by @ngnpope in https://github.com/typeddjango/django-stubs/pull/2008 - 5.0: Update
django.views
by @ngnpope in https://github.com/typeddjango/django-stubs/pull/2007 - 5.0: Update
django.test
by @ngnpope in https://github.com/typeddjango/django-stubs/pull/2005 - 5.0: Update
django.utils
by @ngnpope in https://github.com/typeddjango/django-stubs/pull/2006 - Specify d.c.serializers.base.DeserializedObject.object type by @j00bar in https://github.com/typeddjango/django-stubs/pull/2010
- Clean the cache on each run of
stubtest
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/2015 - Keep abstract Django models internally in the plugin by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2017
- Add GitHub actions release workflow by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1950
- Adding missing
Q
methods:check()
,flatten()
by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1899 - Improve types in
utils.termcolors
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1901 - Set the calculated metaclass when creating type info in the plugin by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2025
- Do not annotate MRs with pyright by @sobolevn in https://github.com/typeddjango/django-stubs/pull/2023
- Use
MRI_MYPY
inget_additional_deps
hook by @sobolevn in https://github.com/typeddjango/django-stubs/pull/2024 - Update
_default_manager
and_base_manager
to beManager
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2022 - Determine the type of queryset methods on unions by @delfick in https://github.com/typeddjango/django-stubs/pull/2027
- Add first stub for get_model_admin by @nebiyuelias1 in https://github.com/typeddjango/django-stubs/pull/2029
- 5.0: Update
django.contrib.admin
by @ngnpope in https://github.com/typeddjango/django-stubs/pull/2004 - [5.0] Update
core.files
by @Viicos in https://github.com/typeddjango/django-stubs/pull/1949 - [5.0] Update
core.cache.backends
, addRedisCache
and related classes by @Viicos in https://github.com/typeddjango/django-stubs/pull/1948 - Fix
AsyncClient.defaults
attribute typing by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1878 - Relax type for
fields
argument ofModel.refresh_from_db()
by @mthuurne in https://github.com/typeddjango/django-stubs/pull/2035 - [5.0] Add missing stubs for geos by @nebiyuelias1 in https://github.com/typeddjango/django-stubs/pull/2034
- Make
AdminSite.get_model_admin
generic by @Viicos in https://github.com/typeddjango/django-stubs/pull/2038 - [5.0] Add
db_default=
parameter to modelsField
classes by @Skorpyon in https://github.com/typeddjango/django-stubs/pull/1876 - Remove
class Meta
fromModel
andForm
class stubs by @jorenham in https://github.com/typeddjango/django-stubs/pull/2000 - Add datetime.timedelta as valid type for HttpRequest.get_signed_cookie() max_age argument. by @pelme in https://github.com/typeddjango/django-stubs/pull/2045
- CI: Update Django 4.2 version used for test suite by @intgr in https://github.com/typeddjango/django-stubs/pull/2049
- Refine return type for
ManyToOneRel.get_accessor_name()
by @mthuurne in https://github.com/typeddjango/django-stubs/pull/2052 - Add
DeferredAttribute.__get__()
by @mthuurne in https://github.com/typeddjango/django-stubs/pull/2050 - Add missing methods and superclass to
FieldFile
by @mthuurne in https://github.com/typeddjango/django-stubs/pull/2051 - Add
db_comment=
parameter to Postgres and GIS model fields by @saJaeHyukc in https://github.com/typeddjango/django-stubs/pull/2054 - Correct type for
db.models.sql.query.Query.join()
argument by @mthuurne in https://github.com/typeddjango/django-stubs/pull/2055 - 5.0: Update
django.db.backends.oracle.base
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2057 - 5.0: Update
django.test.client
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2059 - 5.0: Update
django.test.html
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2060 - 5.0: Update
django.test.runner
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2061 - 5.0: Update
django.template
,django.templatetags
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2063 - 5.0: Update
django.test.testcases
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2062 - 5.0: Update
django.http
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2064 - 5.0: Update
django.core.management
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2067 - 5.0: Update
django.core.handlers
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2066 - 5.0: Update
django.contrib.sessions.serializers
,django.core.serializers
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2068 - Update django app related types by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2071
- Add a
returncode
attribute toCommandError
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2072 - Disable mypy
ignore_missing_imports
option by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2058 - fix typing for URL validator.call by @asottile in https://github.com/typeddjango/django-stubs/pull/2074
- Use field generic types for descriptors by @md384 in https://github.com/typeddjango/django-stubs/pull/2048
- 5.0: Update
django.core.servers.basehttp
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2070 - Update
django.template.base.Template.render()
argument type by @Majsvaffla in https://github.com/typeddjango/django-stubs/pull/1160 - 5.0: Add
django.utils.choices
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2075 - 5.0: Update
django.contrib.sitemaps
,django.contrib.staticfiles
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2076 - Update pyright report options (
reportMissingTypeArgument
,reportPrivateUsage
) by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2077 - 5.0: Update
django.contrib.postgres
by @sudosubin in https://github.com/typeddjango/django-stubs/pull/2078 - Add
path
signature for async views by @jlost in https://github.com/typeddjango/django-stubs/pull/2085 - Remove incorrect
Reversible
base class fromQuerySet
by @intgr in https://github.com/typeddjango/django-stubs/pull/2094 - Version 5.0.0 release (django-stubs, django-stubs-ext) by @flaeppe in https://github.com/typeddjango/django-stubs/pull/2087
New Contributors
- @Viicos made their first contribution in https://github.com/typeddjango/django-stubs/pull/1866
- @dephiros made their first contribution in https://github.com/typeddjango/django-stubs/pull/1873
- @jamesbraza made their first contribution in https://github.com/typeddjango/django-stubs/pull/1927
- @mfosterw made their first contribution in https://github.com/typeddjango/django-stubs/pull/1943
- @palfrey made their first contribution in https://github.com/typeddjango/django-stubs/pull/1944
- @yhay81 made their first contribution in https://github.com/typeddjango/django-stubs/pull/1955
- @delfick made their first contribution in https://github.com/typeddjango/django-stubs/pull/1961
- @SingingTree made their first contribution in https://github.com/typeddjango/django-stubs/pull/1956
- @avoronov-box made their first contribution in https://github.com/typeddjango/django-stubs/pull/1962
- @cuu508 made their first contribution in https://github.com/typeddjango/django-stubs/pull/1993
- @samueljsb made their first contribution in https://github.com/typeddjango/django-stubs/pull/1994
- @pelme made their first contribution in https://github.com/typeddjango/django-stubs/pull/1999
- @mlazar-endear made their first contribution in https://github.com/typeddjango/django-stubs/pull/2001
- @j00bar made their first contribution in https://github.com/typeddjango/django-stubs/pull/2010
- @jorenham made their first contribution in https://github.com/typeddjango/django-stubs/pull/2019
- @fidoriel made their first contribution in https://github.com/typeddjango/django-stubs/pull/1925
- @armanckeser made their first contribution in https://github.com/typeddjango/django-stubs/pull/2021
- @nebiyuelias1 made their first contribution in https://github.com/typeddjango/django-stubs/pull/2029
- @Skorpyon made their first contribution in https://github.com/typeddjango/django-stubs/pull/1876
- @saJaeHyukc made their first contribution in https://github.com/typeddjango/django-stubs/pull/2054
- @sudosubin made their first contribution in https://github.com/typeddjango/django-stubs/pull/2057
- @md384 made their first contribution in https://github.com/typeddjango/django-stubs/pull/2048
- @Majsvaffla made their first contribution in https://github.com/typeddjango/django-stubs/pull/1160
- @jlost made their first contribution in https://github.com/typeddjango/django-stubs/pull/2085
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.7...5.0.0
v4.2.7
Headline changes
- mypy 1.7: Recommended mypy version updated to 1.7.x
- Improved type inference for
ManyToManyField
andModel.<manytomany>.through
- If you previously imported
RelatedManager
orManyRelatedManager
, update those to django-stubs-ext:from django_stubs_ext.db.models.manager import ManyRelatedManager, RelatedManager
- It's now allowed to override Django's
@cached_property
properties with class variables or@property
properties. - Even though Django 5.0 was released yesterday, this version does not yet include any changes specific to Django 5.0.
Plugin improvements
- Improved
ManyToManyDescriptor
and fixedModel.<manytomany>.through
typing by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1805 - Fixed
Self
-typed custom queryset methods to be compatible withQuerySet
by @moranabadie in https://github.com/typeddjango/django-stubs/pull/1852
django-stubs-ext
- django-stubs-ext: Export
RelatedManager
,ManyRelatedManager
stub-only classes by @intgr in https://github.com/typeddjango/django-stubs/pull/1834 - Updated
TypedModelMeta
ordering
attribute to allowOrderBy
objects by @HansAarneLiblik in https://github.com/typeddjango/django-stubs/pull/1847
Stubs fixes
- Added missing
search_help_text=
parameter toChangeList.__init__()
by @quinox in https://github.com/typeddjango/django-stubs/pull/1801 - Allow additional types for SQL parameters in
migrations.RunSQL()
by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1803 - Allow custom Form class in
SuccessMessageMixin.form_valid()
by @SukiCZ in https://github.com/typeddjango/django-stubs/pull/1812 - Fixed
db_comment=
parameter position fordjango.db.models.Field.__init__()
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1815 - Added missing
RelatedField.__init__()
method and removedForeignObject.__init__(db_constraint=)
parameter in Field constructors by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1816 - Fixed argument types of
assertNumQueries()
andassertQuerySetEqual()
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1823 - Fixed
get_deleted_objects()
return fromlist[Model]
->list[str]
by @golgor in https://github.com/typeddjango/django-stubs/pull/1825 - Removed incorrect
django.db.models
re-exports by @intgr in https://github.com/typeddjango/django-stubs/pull/1835 - Fixed
TemplateResponse.cookies
attribute andSimpleCookie
type by @apollo13 in https://github.com/typeddjango/django-stubs/pull/1702
Stubs improvements
- Added stubs for
django.contrib.postgres.expressions
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1765 - Improved hints of
django.contrib.gis.gdal.libgdal
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1811 - Simulate
@deconstructible
as a mixin class by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1818 - Improved types for
django.db.models.enums.*
modules by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1819 - Added
BaseExpression.contains_subquery()
method (update to Django 4.2.7) by @intgr in https://github.com/typeddjango/django-stubs/pull/1827 - Improved types for multiple methods of
QuerySet
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1822 - Improved
Collector
andNestedObjects
attributes, methods by @intgr in https://github.com/typeddjango/django-stubs/pull/1826 - Added
django.db.models.functions.MD5()
database function by @kevinmarsh in https://github.com/typeddjango/django-stubs/pull/1830 - Constrained multiple
BaseModelAdmin
attributes to be either list or tuple by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1832 - Constrained multiple
BaseModelAdmin
methods to return either list or tuple by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1833 - Accurately infer
capfirst()
None
return by @intgr in https://github.com/typeddjango/django-stubs/pull/1842 - Various improvements in
django.core.management.commands
modules by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1829 - Added
Model._do_update()
method signature by @pfouque in https://github.com/typeddjango/django-stubs/pull/1854
Stubs improvements: @cached_property
- Reuse
functools.cached_property
definition instead of defining our own by @intgr in https://github.com/typeddjango/django-stubs/pull/1771 - Updated
@property
attributes to@cached_property
part 1 by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1761 - Updated
@property
attributes to@cached_property
part 2 by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1768 - Updated Expression classes
output_field
to@cached_property
orClassVar
and improves type by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1769
Housekeeping
- Moved plugin generated
<Model>_RelatedManager
entries to allowlist by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1806 - Moved
RelatedManager
todjango.db.models.fields.related_descriptors
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1814 - Restored
RelatedManager
,ManyRelatedManager
to inherit fromManager
notBaseManager
by @intgr in https://github.com/typeddjango/django-stubs/pull/1843 - Upgraded to mypy 1.7.0 by @intgr in https://github.com/typeddjango/django-stubs/pull/1837
- Unify plugin check for model type info by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1853
- Version 4.2.7 release (django-stubs, django-stubs-ext) by @intgr in https://github.com/typeddjango/django-stubs/pull/1856
New Contributors
- @SukiCZ made their first contribution in https://github.com/typeddjango/django-stubs/pull/1812
- @golgor made their first contribution in https://github.com/typeddjango/django-stubs/pull/1825
- @HansAarneLiblik made their first contribution in https://github.com/typeddjango/django-stubs/pull/1847
- @apollo13 made their first contribution in https://github.com/typeddjango/django-stubs/pull/1702
- @pfouque made their first contribution in https://github.com/typeddjango/django-stubs/pull/1854
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.6...4.2.7
v4.2.6
Headline changes
-
Fixed several bugs in version 4.2.5. Thanks to everyone for contributing fixes on a short order!
-
Removed direct mypy dependency. If you are using mypy, please add an explicit
mypy
dev dependency to your project, or install django-stubs with the extradjango-stubs[compatible-mypy]
.Mypy remains the only supported type checker. Improvements for other type checkers may be considered in the future, pull requests welcome. See #1628 for details.
Plugin fixes
- Fixed
as_manager()
andfrom_queryset()
when combined withSelf
types (#1788) by @moranabadie in https://github.com/typeddjango/django-stubs/pull/1789 - Fix IndexError crash when using
from_queryset()
of custom Manager subclass by @moranabadie in https://github.com/typeddjango/django-stubs/pull/1786 - Revert "Use
parse_bool
implementation from mypy" by @intgr in https://github.com/typeddjango/django-stubs/pull/1792 (Turns out this was not necessary and will be reverted)
Stubs fixes
- Fixed
Field.formfield()
,GeometryField.formfield()
method arguments by @brianhelba in https://github.com/typeddjango/django-stubs/pull/1778
Stubs improvements
- Various improvements in
django.core.management
modules by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1787 - Various improvments in
django.db.backend.base
modules by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1791
Housekeeping
- Drop hard dependency on mypy by @intgr in https://github.com/typeddjango/django-stubs/pull/1782
- Version 4.2.6 release (django-stubs only) by @intgr in https://github.com/typeddjango/django-stubs/pull/1794
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.5...4.2.6
v4.2.5
Headline changes
-
mypy 1.6: Recommended mypy version updated to 1.6.x
-
Next django-stubs version (4.2.6) will remove direct mypy dependency. If you are using mypy, please add an explicit
mypy
dev dependency to your project, or install django-stubs with the extradjango-stubs[compatible-mypy]
.Mypy remains the only supported type checker. Improvements for other type checkers may be considered in the future, pull requests welcome. See #1628 for details.
-
Officially added Python 3.12 support
Stubs fixes
- Made
default_storage
produce aStorage
object by @brianhelba in https://github.com/typeddjango/django-stubs/pull/1665 - Fixed wrong type hints for
SyndicationFeed
methods by @WhyNotHugo in https://github.com/typeddjango/django-stubs/pull/1705 - Fixed variance of
Migration.operations
attribute by @asottile in https://github.com/typeddjango/django-stubs/pull/1707 - Fixed variance of all
Migration
list attributes by @brianhelba in https://github.com/typeddjango/django-stubs/pull/1710 - Adjust
bases=
parameter inCreateModel
migration op to allow for mixins by @asottile in https://github.com/typeddjango/django-stubs/pull/1708 - Fixed
_Composable
protocol for compatibility withpsycopg2-stubs
change by @andersk in https://github.com/typeddjango/django-stubs/pull/1714 - Various fixes and improvements in
django.views
modules by @GabDug in https://github.com/typeddjango/django-stubs/pull/1716 - Removed
null
andvalidators
arguments fromManyToManyField.__init__
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1720 - Various fixes and improvements in
django.test
modules by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1752 - Fixed
BaseModelForm
,ErrorList
,ErrorDict
constructorrenderer=
parameter by @GabDug in https://github.com/typeddjango/django-stubs/pull/1690
Stubs improvements
- Annotated return value of all
deconstruct
methods by @brianhelba in https://github.com/typeddjango/django-stubs/pull/1695 - Added missing arguments to
SQLCompiler
methods by @ashm-tech in https://github.com/typeddjango/django-stubs/pull/1689 - Added missing
max_length
attribute toforms.FileField
by @GabDug in https://github.com/typeddjango/django-stubs/pull/1715 - Added missing type arguments to various generic classes by @GabDug in https://github.com/typeddjango/django-stubs/pull/1717
- Added missing
Layer.num_feat
attribute (GeoDjango) by @niconoe in https://github.com/typeddjango/django-stubs/pull/1722 - Specify
AbstractBaseUser.REQUIRED_FIELDS
asClassVar
by @WhyNotHugo in https://github.com/typeddjango/django-stubs/pull/1737 - Improve
fields.Field.formfield()
method by @WhyNotHugo in https://github.com/typeddjango/django-stubs/pull/1739 - Added
ModelStateFieldsCacheDescriptor.__get__
method by @asottile in https://github.com/typeddjango/django-stubs/pull/1743 - Update
Model._meta
toClassVar[Options[Self]]
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1732 - Improved
django.test.signals
types by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1751 - Updated Django to 4.2.6 and updated stubs by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1757
- Require 1 callable argument for
@cached_property
decorated method by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1766 - Allow
psycopg2.sql.SQL
inQuerySet.raw()
by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1767 - Added missing stubs in
django.middleware.csrf
module by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1770 - Various improvements in
django.core.cache
modules by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1774 - Improved
Field.formfield()
,GeometryField.formfield()
methods by @brianhelba in https://github.com/typeddjango/django-stubs/pull/1724 - Fixed query
F.resolve_expression()
return type by @schinckel in https://github.com/typeddjango/django-stubs/pull/1659
Plugin improvements
- Resolve dynamic
Manager
methods through manager MRO by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1701 - Use
functools.cached_property
instead of Django's in mypy plugin by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1721 - Improved hints for
ReverseOneToOneDescriptor
and start using it by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1733 - Add better support for
ManyToManyField
'sthrough
model by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1719 - Resolve any
settings.AUTH_USER_MODEL
used asto=
in relation by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1746 - Added missing
_default_manager
symbol to generatedthrough
model by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1745
Plugin crash fixes
- Gracefully handle unwanted types when creating fallback managers by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1728
Fixes some
AssertionError
crashes. - Handle mismatching types in queryset method resolving gracefully by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1727
Fixes some
AssertionError
crashes. - Fixed crash on bad arguments for model relationship fields by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1735
Fixes some
ValueError
crashes.
Documentation
- Fixed link to
django_stubs_ext
by @tony in https://github.com/typeddjango/django-stubs/pull/1747 & https://github.com/typeddjango/django-stubs/pull/1748 - Add version 4.2.4 to version compatibility table by @intgr in https://github.com/typeddjango/django-stubs/pull/1758
Housekeeping
- Removed a bunch of unused code by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1687
- Removed redefinition of inherited
deconstruct
methods. by @brianhelba in https://github.com/typeddjango/django-stubs/pull/1693 & https://github.com/typeddjango/django-stubs/pull/1694 - Use
parse_bool
implementation from mypy by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1703 - Specify error codes in
# type: ignore
comments for plugin code by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1726 - Specify error codes in
# type: ignore
comments in stubs files by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1734 - CI: Enable testing with Python 3.12 by @intgr in https://github.com/typeddjango/django-stubs/pull/1759
- Bump mypy from 1.5.1 to 1.6.0 by @dependabot in https://github.com/typeddjango/django-stubs/pull/1764
- Tests: Add mypy error codes to typecheck by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1773
- chore: Migrate from flake8 to ruff by @GabDug in https://github.com/typeddjango/django-stubs/pull/1718
- Update black version by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1776
- Added test to verify that
Manager.from_queryset()
handles invalid argument types by @flaeppe in https://github.com/typeddjango/django-stubs/pull/1731 - Version 4.2.5 release (django-stubs, django-stubs-ext) by @intgr in https://github.com/typeddjango/django-stubs/pull/1777
New Contributors
- @ashm-tech made their first contribution in https://github.com/typeddjango/django-stubs/pull/1689
- @WhyNotHugo made their first contribution in https://github.com/typeddjango/django-stubs/pull/1705
- @niconoe made their first contribution in https://github.com/typeddjango/django-stubs/pull/1722
- @schinckel made their first contribution in https://github.com/typeddjango/django-stubs/pull/1659
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.4...4.2.5
v4.2.4
Most important changes:
- This version add Mypy
1.5.*
support and update[compatible-mypy]
extra to use1.5.*
. - We also update our stubs to be compatible with Django
4.2.5
(and all prior versions of4.2
). -
django_stubs_ext/
folder was renamed to be justext/
, it should not affect users (unless you install it from git) - We no longer assume the
objects
attribute to be present on generic Model classes. As per the django documentation, code working with generic models should use the_default_manager
attribute instead.
This time there is no corresponding release of django-stubs-ext
.
Plugin changes
- We now forbid to instantiate abstract models https://github.com/typeddjango/django-stubs/pull/1663 @flaeppe
- Manager attributes are now
ClassVar
s https://github.com/typeddjango/django-stubs/pull/1672 @flaeppe
Thanks a lot to all contributors and maintainers!
v4.2.3
This version fixes two regressions in previons django-stubs
release and also a few other fixes and improvements. Special thanks to @GabDug for contributing regression fixes on a short order.
This time there is no corresponding release of django-stubs-ext
.
Stubs fixes
- Fixed type error when subclassing
AppConfig
and assigning string todefault_auto_field
by @GabDug in https://github.com/typeddjango/django-stubs/pull/1596 - Fixed type error when subclassing
MiddlewareMixin.__call__()
and usingreturn self.get_response()
by @GabDug in https://github.com/typeddjango/django-stubs/pull/1595 - Allow
None
asredirect_field_name
value for@user_passes_test
and@login_required
decorators by @JoeHitchen in https://github.com/typeddjango/django-stubs/pull/1600
Plugin fixes
- Fixed long-standing issue with
Date(Time)Field
when using mypy settingdisallow_any_explicit
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1599
Stubs changes
- Added
BigIntegerField.MAX_BIGINT
attribute by @asottile in https://github.com/typeddjango/django-stubs/pull/1598 - Improved Jinja2 types and updated
pytest-mypy-plugins
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1601
CI/Testing
- Run tests in multiple shards and all Python versions by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1603
Housekeeping
- Converted
_typeshed.Self
usages totyping_extensions.Self
(PEP 673) by @intgr in https://github.com/typeddjango/django-stubs/pull/1591 - Version 4.2.3 release (django-stubs only) by @intgr in https://github.com/typeddjango/django-stubs/pull/1604
New Contributors
- @JoeHitchen made their first contribution in https://github.com/typeddjango/django-stubs/pull/1600
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.2...4.2.3
v4.2.2
Headline changes
-
mypy 1.4: Recommended mypy version updated to 1.4.x
-
Support for
django-split-settings
,django-configurations
and other Django settings addons withstrict_settings = false
option, see README for details -
We have now adopted mypy's stubtest to automatically find discrepancies between Django and django-stubs.
If you want to contribute to django-stubs but are not sure where to start, have a look at stubtest's TODO list file, which lists the many issues discovered by stubtest.
Django 4.2 changes
- Applied Django 4.2 deprecations by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1523
- Updated global settings and
AppConfig
class to match Django 4.2 by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1524 - Added types for new 'system checks' in Django 4.2 by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1526
- Added
ManifestStaticFilesStorage
new parameters by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1528 - Added new methods to
Sitemap
class by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1527 - Added new
headers=
parameter to(Async)RequestFactory
and(Async)Client
classes by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1529- Additional fixes by @intgr in https://github.com/typeddjango/django-stubs/pull/1537
- GDAL-related GeoDjango updates in Django 4.2 by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1525
- Added ORM
^
and~
operator support, JSON lookup classes, Postgres lookup classes,ModelForm
changes,json_script
template filter parameters by @Alexerson in https://github.com/typeddjango/django-stubs/pull/1536 - Added and updated
db.backends
DatabaseIntrospection
andDatabaseOperations
classes by @GabDug in https://github.com/typeddjango/django-stubs/pull/1571
Stubs additions
- Added
QuerySet._result_cache
attribute and_fetch_all()
method by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1505 - Added
ModelAdmin.search_help_text
attribute by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1546 - Added email console handler
EmailBackend.write_message()
method by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1547 - Added
ModelAdmin.get_formset_kwargs()
method by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1545 - Added
Signal._live_receivers()
method by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1551 - Added
SQLCompiler._order_by_pairs()
method by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1586 - Added
memcache_key_warnings()
function by @rvanlaar in https://github.com/typeddjango/django-stubs/pull/1562
Stubs fixes
- Fixed
create_model_instance
incorrect data argument type by @namper in https://github.com/typeddjango/django-stubs/pull/1521 - Marked
RequestSite.{save,delete}
methods asNoReturn
since they always raise by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1530 - Updated
SafeExceptionReporterFilter
attributes and removed obsoleteCLEANSED_SUBSTITUTE
by @mthuurne in https://github.com/typeddjango/django-stubs/pull/1540 - Changed
AppConfig.default_auto_field
to attribute instead of method by @mthuurne in https://github.com/typeddjango/django-stubs/pull/1541 - Fixed
default_error_messages
attribute type of baseField
andGenericIPAddressField
classes by @asottile in https://github.com/typeddjango/django-stubs/pull/1538 - Improved spatialite
DatabaseWrapper
attributes by @filbasi in https://github.com/typeddjango/django-stubs/pull/1544 - Improved types for Signal
dispatch.dispatcher
by @GabDug in https://github.com/typeddjango/django-stubs/pull/1567 - Accept
str
field names forWindow.order_by()
, allowNone
forasc/desc
arguments by @GabDug in https://github.com/typeddjango/django-stubs/pull/1574 - Updated many
django.utils.*
types from stubtest by @GabDug in https://github.com/typeddjango/django-stubs/pull/1575 - Updated many
db.migrations.operations
types from stubtest by @GabDug in https://github.com/typeddjango/django-stubs/pull/1583 - Added
StepValueValidator
, fixed argument forSRIDCacheEntry
/EmailValidator
, improvedurls.resolvers
types by @GabDug in https://github.com/typeddjango/django-stubs/pull/1589
Plugin changes
- Fixed
ForeignKey
queryset filters on un-swapped models by @UnknownPlatypus in https://github.com/typeddjango/django-stubs/pull/1495 - Add
strict_settings
option, allow runtime fallbacks for custom settings by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1557- Add "Settings" section to README by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1581
- Automatically reset mypy cache when plugin settings change by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1578
- Fixed unhandled exception
KeyError: 'model_bases'
and related errors by @intgr in https://github.com/typeddjango/django-stubs/pull/1563
django-stubs-ext
- Added
TypedDatabaseRouter
as database router base class by @intgr in https://github.com/typeddjango/django-stubs/pull/1522
CI/testing
- CI: Replace isort with Ruff import sorting by @intgr in https://github.com/typeddjango/django-stubs/pull/1507
- CI: Auto-remove unused imports using Ruff by @intgr in https://github.com/typeddjango/django-stubs/pull/1508
- CI: Enable Ruff pyupgrade fixes by @intgr in https://github.com/typeddjango/django-stubs/pull/1509
- CI: Run django-stubs-ext tests in full build matrix by @intgr in https://github.com/typeddjango/django-stubs/pull/1552
- Remove typecheck test and clean things up by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1556
- Add stubtest with lots of errors (currently) by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1560
- Removed extra
--generate-allowlist
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1576
- Removed extra
Housekeeping
- Removed unsupported Django versions from package classifiers by @intgr in https://github.com/typeddjango/django-stubs/pull/1553
- Removed try-except around import of
ArrayField
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1558- Reverted: Fix crash when psycopg2 is not installed by @intgr in https://github.com/typeddjango/django-stubs/pull/1565
- Removed usage of
mypy_extensions
by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1566 - Upgrade to Mypy 1.4.0 by @christianbundy in https://github.com/typeddjango/django-stubs/pull/1572
- Chore: set Black Python target to 3.8+ explicitely by @GabDug in https://github.com/typeddjango/django-stubs/pull/1573
- Update
flake8
plugins by @sobolevn in https://github.com/typeddjango/django-stubs/pull/1579 - CI: Run tests and pre-commit using newest Python version by @intgr in https://github.com/typeddjango/django-stubs/pull/1582
- Removed duplicate "import all" test file by @adamchainz in https://github.com/typeddjango/django-stubs/pull/1587
- Update compatible-mypy to 1.4.x by @intgr in https://github.com/typeddjango/django-stubs/pull/1588
- Version 4.2.2 release (django-stubs, django-stubs-ext) by @intgr in https://github.com/typeddjango/django-stubs/pull/1590
New Contributors
- @namper made their first contribution in https://github.com/typeddjango/django-stubs/pull/1521
- @filbasi made their first contribution in https://github.com/typeddjango/django-stubs/pull/1544
- @GabDug made their first contribution in https://github.com/typeddjango/django-stubs/pull/1567
- @rvanlaar made their first contribution in https://github.com/typeddjango/django-stubs/pull/1562
Full Changelog: https://github.com/typeddjango/django-stubs/compare/4.2.1...4.2.2
Configuration
-
If you want to rebase/retry this MR, click this checkbox.
This MR has been generated by Renovate Bot.