Skip to content

Commit 1fe7811

Browse files
authored
Update and prepare for Django 5.0 (#1859)
* Updated Django dependency to 5.0.0 (when using Python 3.10 or newer -- older Pythons continue with Django 4.2.7) * Created a separate allowlist `allowlist_todo_django50.txt` for new stubtest errors. * Bumped `setup.py` version to `5.0.0.dev1` for the time being. Final release will be `5.0.0`. * Django version 4.1 is now officially EOL by Django project, but let's take that separately (there may be some cleanups we can do).
1 parent e8bb1ff commit 1fe7811

File tree

10 files changed

+350
-46
lines changed

10 files changed

+350
-46
lines changed

.github/workflows/test.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,17 @@ jobs:
101101
strategy:
102102
fail-fast: false
103103
matrix:
104-
python-version: ['3.8', '3.9', '3.10', '3.11']
105-
django-version: ['3.2', '4.2']
104+
python-version: ['3.10', '3.11']
105+
django-version: ['3.2', '4.2', '5.0']
106106
include:
107+
- python-version: '3.8'
108+
django-version: '3.2'
109+
- python-version: '3.8'
110+
django-version: '4.2'
111+
- python-version: '3.9'
112+
django-version: '3.2'
113+
- python-version: '3.9'
114+
django-version: '4.2'
107115
- python-version: '3.12'
108116
django-version: '4.1'
109117
steps:

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ We rely on different `django` and `mypy` versions:
4949

5050
| django-stubs | Mypy version | Django version | Django partial support | Python version |
5151
|----------------|--------------|----------------|------------------------|----------------|
52+
| (next release) | 1.7.x | 5.0 | 4.2, 4.1, 3.2 | 3.8 - 3.12 |
5253
| 4.2.7 | 1.7.x | 4.2 | 4.1, 3.2 | 3.8 - 3.12 |
5354
| 4.2.6 | 1.6.x | 4.2 | 4.1, 3.2 | 3.8 - 3.12 |
5455
| 4.2.5 | 1.6.x | 4.2 | 4.1, 3.2 | 3.8 - 3.12 |

ext/setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# It's fine to skip django-stubs-ext releases, but when doing a release, update this to newest django-stubs version.
1616
setup(
1717
name="django-stubs-ext",
18-
version="4.2.7",
18+
version="5.0.0.dev1",
1919
description="Monkey-patching and extensions for django-stubs",
2020
long_description=readme,
2121
long_description_content_type="text/markdown",
@@ -44,6 +44,7 @@
4444
"Framework :: Django :: 3.2",
4545
"Framework :: Django :: 4.1",
4646
"Framework :: Django :: 4.2",
47+
"Framework :: Django :: 5.0",
4748
],
4849
project_urls={
4950
"Release notes": "https://github.com/typeddjango/django-stubs/releases",

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ line-length = 120
44
include = '\.pyi?$'
55

66
[tool.codespell]
7-
ignore-words-list = "aadd,acount,nam"
7+
ignore-words-list = "aadd,acount,nam,asend"
88

99
[tool.ruff]
1010
# Adds to default excludes: https://ruff.rs/docs/settings/#exclude

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ pytest-shard==0.1.2
77

88
# Django deps:
99
psycopg2-binary
10-
Django==4.2.7
10+
Django==4.2.7; python_version < '3.10'
11+
Django==5.0.0; python_version >= '3.10'
1112
-e ./ext
1213
-e .[compatible-mypy]
1314

scripts/stubtest.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ stubtest django \
1111
--mypy-config-file mypy.ini \
1212
--ignore-positional-only \
1313
--allowlist scripts/stubtest/allowlist.txt \
14-
--allowlist scripts/stubtest/allowlist_todo.txt
14+
--allowlist scripts/stubtest/allowlist_todo.txt \
15+
--allowlist scripts/stubtest/allowlist_todo_django50.txt

scripts/stubtest/allowlist.txt

-3
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ django.core.cache.backends.memcached.MemcachedCache
156156

157157
# We re-export `functools.cached_property` which has different semantics
158158
django.utils.functional.cached_property.__class_getitem__
159-
django.utils.functional.cached_property.__init__
160159
django.utils.functional.cached_property.__set__
161160
django.utils.functional.cached_property.name
162161

@@ -250,7 +249,6 @@ django.db.backends.mysql.features.DatabaseFeatures.can_introspect_check_constrai
250249
django.db.backends.mysql.features.DatabaseFeatures.can_introspect_foreign_keys
251250
django.db.backends.mysql.features.DatabaseFeatures.can_introspect_json_field
252251
django.db.backends.mysql.features.DatabaseFeatures.can_return_columns_from_insert
253-
django.db.backends.mysql.features.DatabaseFeatures.has_select_for_update_nowait
254252
django.db.backends.mysql.features.DatabaseFeatures.has_select_for_update_of
255253
django.db.backends.mysql.features.DatabaseFeatures.has_select_for_update_skip_locked
256254
django.db.backends.mysql.features.DatabaseFeatures.has_zoneinfo_database
@@ -263,7 +261,6 @@ django.db.backends.mysql.features.DatabaseFeatures.supports_default_in_lead_lag
263261
django.db.backends.mysql.features.DatabaseFeatures.supports_explain_analyze
264262
django.db.backends.mysql.features.DatabaseFeatures.supports_expression_indexes
265263
django.db.backends.mysql.features.DatabaseFeatures.supports_index_column_ordering
266-
django.db.backends.mysql.features.DatabaseFeatures.supports_over_clause
267264
django.db.backends.mysql.features.DatabaseFeatures.supports_transactions
268265
django.db.backends.mysql.features.DatabaseFeatures.update_can_self_select
269266
django.db.backends.postgresql.base.DatabaseWrapper.pg_version

scripts/stubtest/allowlist_todo.txt

-35
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33

44
django.__main__
55
django.apps.registry.Apps.populate
6-
django.conf.CSRF_COOKIE_MASKED_DEPRECATED_MSG
76
django.conf.DEFAULT_FILE_STORAGE_DEPRECATED_MSG
87
django.conf.LazySettings.DEFAULT_FILE_STORAGE
98
django.conf.LazySettings.STATICFILES_STORAGE
10-
django.conf.LazySettings.USE_L10N
119
django.conf.STATICFILES_STORAGE_DEPRECATED_MSG
12-
django.conf.USE_DEPRECATED_PYTZ_DEPRECATED_MSG
13-
django.conf.USE_L10N_DEPRECATED_MSG
1410
django.conf.global_settings.Router
1511
django.conf.global_settings.gettext_noop
1612
django.conf.urls.IncludedURLConf
@@ -125,7 +121,6 @@ django.contrib.auth.forms.UserChangeForm.declared_fields
125121
django.contrib.auth.forms.UserCreationForm.declared_fields
126122
django.contrib.auth.forms.UserModel
127123
django.contrib.auth.hashers.Argon2PasswordHasher.params
128-
django.contrib.auth.hashers.CryptPasswordHasher.__init__
129124
django.contrib.auth.hashers.SHA1PasswordHasher.__init__
130125
django.contrib.auth.hashers.ScryptPasswordHasher
131126
django.contrib.auth.hashers.UnsaltedMD5PasswordHasher.__init__
@@ -450,7 +445,6 @@ django.contrib.gis.db.models.QuerySet.__contains__
450445
django.contrib.gis.db.models.QuerySet.__deepcopy__
451446
django.contrib.gis.db.models.QuerySet.__reversed__
452447
django.contrib.gis.db.models.QuerySet.__xor__
453-
django.contrib.gis.db.models.QuerySet.datetimes
454448
django.contrib.gis.db.models.RasterField.contribute_to_class
455449
django.contrib.gis.db.models.SlugField.formfield
456450
django.contrib.gis.db.models.SmallAutoField.rel_db_type
@@ -501,7 +495,6 @@ django.contrib.gis.forms.BaseModelForm.__init__
501495
django.contrib.gis.forms.BaseModelForm.save_m2m
502496
django.contrib.gis.forms.BaseModelFormSet.model
503497
django.contrib.gis.forms.BaseModelFormSet.save_m2m
504-
django.contrib.gis.forms.BoundField.__html__
505498
django.contrib.gis.forms.BoundWidget
506499
django.contrib.gis.forms.ChoiceField.__deepcopy__
507500
django.contrib.gis.forms.ChoiceWidget
@@ -580,28 +573,14 @@ django.contrib.messages.storage.cookie.CookieStorage.key_salt
580573
django.contrib.messages.storage.cookie.MessageDecoder.decode
581574
django.contrib.messages.storage.cookie.MessageEncoder.default
582575
django.contrib.messages.storage.cookie.MessageSerializer
583-
django.contrib.postgres.aggregates.ArrayAgg.deprecation_msg
584-
django.contrib.postgres.aggregates.ArrayAgg.deprecation_value
585576
django.contrib.postgres.aggregates.CovarPop.__init__
586577
django.contrib.postgres.aggregates.JSONBAgg.__init__
587-
django.contrib.postgres.aggregates.JSONBAgg.deprecation_empty_result_set_value
588-
django.contrib.postgres.aggregates.JSONBAgg.deprecation_msg
589-
django.contrib.postgres.aggregates.JSONBAgg.deprecation_value
590578
django.contrib.postgres.aggregates.RegrCount.empty_result_set_value
591579
django.contrib.postgres.aggregates.StatAggregate.__init__
592580
django.contrib.postgres.aggregates.StringAgg.__init__
593-
django.contrib.postgres.aggregates.StringAgg.deprecation_msg
594-
django.contrib.postgres.aggregates.StringAgg.deprecation_value
595-
django.contrib.postgres.aggregates.general.ArrayAgg.deprecation_msg
596-
django.contrib.postgres.aggregates.general.ArrayAgg.deprecation_value
597581
django.contrib.postgres.aggregates.general.BitXor
598582
django.contrib.postgres.aggregates.general.JSONBAgg.__init__
599-
django.contrib.postgres.aggregates.general.JSONBAgg.deprecation_empty_result_set_value
600-
django.contrib.postgres.aggregates.general.JSONBAgg.deprecation_msg
601-
django.contrib.postgres.aggregates.general.JSONBAgg.deprecation_value
602583
django.contrib.postgres.aggregates.general.StringAgg.__init__
603-
django.contrib.postgres.aggregates.general.StringAgg.deprecation_msg
604-
django.contrib.postgres.aggregates.general.StringAgg.deprecation_value
605584
django.contrib.postgres.aggregates.mixins.OrderableAggMixin.__init__
606585
django.contrib.postgres.aggregates.mixins.OrderableAggMixin.as_sql
607586
django.contrib.postgres.aggregates.mixins.OrderableAggMixin.get_source_expressions
@@ -715,7 +694,6 @@ django.contrib.sessions.models.Session.get_previous_by_expire_date
715694
django.contrib.sessions.models.Session.session_data
716695
django.contrib.sessions.models.Session.session_key
717696
django.contrib.sessions.models.SessionManager.__slotnames__
718-
django.contrib.sessions.serializers.PickleSerializer.__init__
719697
django.contrib.sitemaps.views.SitemapIndexItem
720698
django.contrib.sites.admin.SiteAdmin
721699
django.contrib.sites.models.Site.domain
@@ -793,17 +771,14 @@ django.core.signing.b62_encode
793771
django.core.signing.loads
794772
django.db.backends.ddl_references.Expressions
795773
django.db.backends.mysql.base
796-
django.db.backends.mysql.features.DatabaseFeatures.can_release_savepoints
797774
django.db.backends.mysql.features.DatabaseFeatures.can_rename_index
798775
django.db.backends.mysql.features.DatabaseFeatures.can_return_rows_from_bulk_insert
799776
django.db.backends.mysql.features.DatabaseFeatures.django_test_skips
800777
django.db.backends.mysql.features.DatabaseFeatures.minimum_database_version
801-
django.db.backends.mysql.features.DatabaseFeatures.supports_frame_range_fixed_distance
802778
django.db.backends.mysql.features.DatabaseFeatures.supports_select_difference
803779
django.db.backends.mysql.features.DatabaseFeatures.supports_select_intersection
804780
django.db.backends.mysql.features.DatabaseFeatures.supports_table_check_constraints
805781
django.db.backends.mysql.features.DatabaseFeatures.test_collations
806-
django.db.backends.mysql.features.DatabaseFeatures.uses_savepoints
807782
django.db.backends.mysql.introspection
808783
django.db.backends.mysql.schema.DatabaseSchemaEditor.sql_alter_column_comment
809784
django.db.backends.oracle.base
@@ -849,17 +824,14 @@ django.db.backends.sqlite3.base.adapt_date
849824
django.db.backends.sqlite3.base.adapt_datetime
850825
django.db.backends.sqlite3.base.check_sqlite_version
851826
django.db.backends.sqlite3.features.DatabaseFeatures.can_alter_table_drop_column
852-
django.db.backends.sqlite3.features.DatabaseFeatures.can_alter_table_rename_column
853827
django.db.backends.sqlite3.features.DatabaseFeatures.can_introspect_json_field
854828
django.db.backends.sqlite3.features.DatabaseFeatures.can_return_columns_from_insert
855829
django.db.backends.sqlite3.features.DatabaseFeatures.can_return_rows_from_bulk_insert
856830
django.db.backends.sqlite3.features.DatabaseFeatures.django_test_skips
857831
django.db.backends.sqlite3.features.DatabaseFeatures.has_json_object_function
858832
django.db.backends.sqlite3.features.DatabaseFeatures.introspected_field_types
859-
django.db.backends.sqlite3.features.DatabaseFeatures.supports_atomic_references_rename
860833
django.db.backends.sqlite3.features.DatabaseFeatures.supports_json_field
861834
django.db.backends.sqlite3.introspection.FieldInfo
862-
django.db.backends.sqlite3.schema.DatabaseSchemaEditor.alter_db_table
863835
django.db.backends.sqlite3.schema.DatabaseSchemaEditor.delete_model
864836
django.db.backends.sqlite3.schema.DatabaseSchemaEditor.sql_create_fk
865837
django.db.backends.utils.debug_transaction
@@ -1056,7 +1028,6 @@ django.db.models.QuerySet.__contains__
10561028
django.db.models.QuerySet.__deepcopy__
10571029
django.db.models.QuerySet.__reversed__
10581030
django.db.models.QuerySet.__xor__
1059-
django.db.models.QuerySet.datetimes
10601031
django.db.models.SlugField.formfield
10611032
django.db.models.SmallAutoField.rel_db_type
10621033
django.db.models.StdDev.__init__
@@ -1454,7 +1425,6 @@ django.db.models.query.QuerySet.__contains__
14541425
django.db.models.query.QuerySet.__deepcopy__
14551426
django.db.models.query.QuerySet.__reversed__
14561427
django.db.models.query.QuerySet.__xor__
1457-
django.db.models.query.QuerySet.datetimes
14581428
django.db.models.query.RawQuerySet.__aiter__
14591429
django.db.models.query.RawQuerySet.__init__
14601430
django.db.models.query.RelatedPopulator
@@ -1581,7 +1551,6 @@ django.forms.BaseModelForm.__init__
15811551
django.forms.BaseModelForm.save_m2m
15821552
django.forms.BaseModelFormSet.model
15831553
django.forms.BaseModelFormSet.save_m2m
1584-
django.forms.BoundField.__html__
15851554
django.forms.BoundWidget
15861555
django.forms.ChoiceField.__deepcopy__
15871556
django.forms.ChoiceWidget
@@ -1616,7 +1585,6 @@ django.forms.TextInput.__slotnames__
16161585
django.forms.Widget.__deepcopy__
16171586
django.forms.Widget.subwidgets
16181587
django.forms.Widget.use_fieldset
1619-
django.forms.boundfield.BoundField.__html__
16201588
django.forms.boundfield.BoundWidget.__html__
16211589
django.forms.fields.ChoiceField.__deepcopy__
16221590
django.forms.fields.Field.__deepcopy__
@@ -1651,7 +1619,6 @@ django.forms.models.inlineformset_factory
16511619
django.forms.models.modelform_factory
16521620
django.forms.models.modelformset_factory
16531621
django.forms.renderers.DjangoDivFormRenderer
1654-
django.forms.utils.DEFAULT_TEMPLATE_DEPRECATION_MSG
16551622
django.forms.widgets.ChoiceWidget.__deepcopy__
16561623
django.forms.widgets.ChoiceWidget.subwidgets
16571624
django.forms.widgets.ChoiceWidget.template_name
@@ -1727,8 +1694,6 @@ django.template.utils.EngineHandler.__init__
17271694
django.templatetags.i18n.BlockTranslateNode.__init__
17281695
django.templatetags.static.PrefixNode.__init__
17291696
django.templatetags.static.StaticNode.__init__
1730-
django.templatetags.tz.UnknownTimezoneException
1731-
django.templatetags.tz.timezone_constructor
17321697
django.test.SimpleTestCase.assertFormError
17331698
django.test.SimpleTestCase.assertFormSetError
17341699
django.test.SimpleTestCase.assertTemplateNotUsed

0 commit comments

Comments
 (0)