Skip to content
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

Update and prepare for Django 5.0 #1859

Merged
merged 4 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,17 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
django-version: ['3.2', '4.2']
python-version: ['3.10', '3.11']
django-version: ['3.2', '4.2', '5.0']
include:
- python-version: '3.8'
django-version: '3.2'
- python-version: '3.8'
django-version: '4.2'
- python-version: '3.9'
django-version: '3.2'
- python-version: '3.9'
django-version: '4.2'
- python-version: '3.12'
django-version: '4.1'
steps:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ We rely on different `django` and `mypy` versions:

| django-stubs | Mypy version | Django version | Django partial support | Python version |
|----------------|--------------|----------------|------------------------|----------------|
| (next release) | 1.7.x | 5.0 | 4.2, 4.1, 3.2 | 3.8 - 3.12 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that 3.8 - 3.12 is not correct for [email protected]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but that's Django's constraint, not ours. django-stubs itself still supports Python 3.8 with Django 4.2.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I count this as approval to merge?

| 4.2.7 | 1.7.x | 4.2 | 4.1, 3.2 | 3.8 - 3.12 |
| 4.2.6 | 1.6.x | 4.2 | 4.1, 3.2 | 3.8 - 3.12 |
| 4.2.5 | 1.6.x | 4.2 | 4.1, 3.2 | 3.8 - 3.12 |
Expand Down
3 changes: 2 additions & 1 deletion ext/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# It's fine to skip django-stubs-ext releases, but when doing a release, update this to newest django-stubs version.
setup(
name="django-stubs-ext",
version="4.2.7",
version="5.0.0.dev1",
description="Monkey-patching and extensions for django-stubs",
long_description=readme,
long_description_content_type="text/markdown",
Expand Down Expand Up @@ -44,6 +44,7 @@
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
],
project_urls={
"Release notes": "https://github.com/typeddjango/django-stubs/releases",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ line-length = 120
include = '\.pyi?$'

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

[tool.ruff]
# Adds to default excludes: https://ruff.rs/docs/settings/#exclude
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ pytest-shard==0.1.2

# Django deps:
psycopg2-binary
Django==4.2.7
Django==4.2.7; python_version < '3.10'
Django==5.0.0; python_version >= '3.10'
Comment on lines +10 to +11
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one weird trick actually works...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this can cause us problems down the road. I'm sure we will be able to solve them in the future as they pop up.

If we need to write Django 5.0-specific tests, we can specifically add skip: sys.version_info < (3, 10) to them.

-e ./ext
-e .[compatible-mypy]

Expand Down
3 changes: 2 additions & 1 deletion scripts/stubtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ stubtest django \
--mypy-config-file mypy.ini \
--ignore-positional-only \
--allowlist scripts/stubtest/allowlist.txt \
--allowlist scripts/stubtest/allowlist_todo.txt
--allowlist scripts/stubtest/allowlist_todo.txt \
--allowlist scripts/stubtest/allowlist_todo_django50.txt
3 changes: 0 additions & 3 deletions scripts/stubtest/allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ django.core.cache.backends.memcached.MemcachedCache

# We re-export `functools.cached_property` which has different semantics
django.utils.functional.cached_property.__class_getitem__
django.utils.functional.cached_property.__init__
django.utils.functional.cached_property.__set__
django.utils.functional.cached_property.name

Expand Down Expand Up @@ -250,7 +249,6 @@ django.db.backends.mysql.features.DatabaseFeatures.can_introspect_check_constrai
django.db.backends.mysql.features.DatabaseFeatures.can_introspect_foreign_keys
django.db.backends.mysql.features.DatabaseFeatures.can_introspect_json_field
django.db.backends.mysql.features.DatabaseFeatures.can_return_columns_from_insert
django.db.backends.mysql.features.DatabaseFeatures.has_select_for_update_nowait
django.db.backends.mysql.features.DatabaseFeatures.has_select_for_update_of
django.db.backends.mysql.features.DatabaseFeatures.has_select_for_update_skip_locked
django.db.backends.mysql.features.DatabaseFeatures.has_zoneinfo_database
Expand All @@ -263,7 +261,6 @@ django.db.backends.mysql.features.DatabaseFeatures.supports_default_in_lead_lag
django.db.backends.mysql.features.DatabaseFeatures.supports_explain_analyze
django.db.backends.mysql.features.DatabaseFeatures.supports_expression_indexes
django.db.backends.mysql.features.DatabaseFeatures.supports_index_column_ordering
django.db.backends.mysql.features.DatabaseFeatures.supports_over_clause
django.db.backends.mysql.features.DatabaseFeatures.supports_transactions
django.db.backends.mysql.features.DatabaseFeatures.update_can_self_select
django.db.backends.postgresql.base.DatabaseWrapper.pg_version
Expand Down
35 changes: 0 additions & 35 deletions scripts/stubtest/allowlist_todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@

django.__main__
django.apps.registry.Apps.populate
django.conf.CSRF_COOKIE_MASKED_DEPRECATED_MSG
django.conf.DEFAULT_FILE_STORAGE_DEPRECATED_MSG
django.conf.LazySettings.DEFAULT_FILE_STORAGE
django.conf.LazySettings.STATICFILES_STORAGE
django.conf.LazySettings.USE_L10N
django.conf.STATICFILES_STORAGE_DEPRECATED_MSG
django.conf.USE_DEPRECATED_PYTZ_DEPRECATED_MSG
django.conf.USE_L10N_DEPRECATED_MSG
django.conf.global_settings.Router
django.conf.global_settings.gettext_noop
django.conf.urls.IncludedURLConf
Expand Down Expand Up @@ -125,7 +121,6 @@ django.contrib.auth.forms.UserChangeForm.declared_fields
django.contrib.auth.forms.UserCreationForm.declared_fields
django.contrib.auth.forms.UserModel
django.contrib.auth.hashers.Argon2PasswordHasher.params
django.contrib.auth.hashers.CryptPasswordHasher.__init__
django.contrib.auth.hashers.SHA1PasswordHasher.__init__
django.contrib.auth.hashers.ScryptPasswordHasher
django.contrib.auth.hashers.UnsaltedMD5PasswordHasher.__init__
Expand Down Expand Up @@ -450,7 +445,6 @@ django.contrib.gis.db.models.QuerySet.__contains__
django.contrib.gis.db.models.QuerySet.__deepcopy__
django.contrib.gis.db.models.QuerySet.__reversed__
django.contrib.gis.db.models.QuerySet.__xor__
django.contrib.gis.db.models.QuerySet.datetimes
django.contrib.gis.db.models.RasterField.contribute_to_class
django.contrib.gis.db.models.SlugField.formfield
django.contrib.gis.db.models.SmallAutoField.rel_db_type
Expand Down Expand Up @@ -501,7 +495,6 @@ django.contrib.gis.forms.BaseModelForm.__init__
django.contrib.gis.forms.BaseModelForm.save_m2m
django.contrib.gis.forms.BaseModelFormSet.model
django.contrib.gis.forms.BaseModelFormSet.save_m2m
django.contrib.gis.forms.BoundField.__html__
django.contrib.gis.forms.BoundWidget
django.contrib.gis.forms.ChoiceField.__deepcopy__
django.contrib.gis.forms.ChoiceWidget
Expand Down Expand Up @@ -580,28 +573,14 @@ django.contrib.messages.storage.cookie.CookieStorage.key_salt
django.contrib.messages.storage.cookie.MessageDecoder.decode
django.contrib.messages.storage.cookie.MessageEncoder.default
django.contrib.messages.storage.cookie.MessageSerializer
django.contrib.postgres.aggregates.ArrayAgg.deprecation_msg
django.contrib.postgres.aggregates.ArrayAgg.deprecation_value
django.contrib.postgres.aggregates.CovarPop.__init__
django.contrib.postgres.aggregates.JSONBAgg.__init__
django.contrib.postgres.aggregates.JSONBAgg.deprecation_empty_result_set_value
django.contrib.postgres.aggregates.JSONBAgg.deprecation_msg
django.contrib.postgres.aggregates.JSONBAgg.deprecation_value
django.contrib.postgres.aggregates.RegrCount.empty_result_set_value
django.contrib.postgres.aggregates.StatAggregate.__init__
django.contrib.postgres.aggregates.StringAgg.__init__
django.contrib.postgres.aggregates.StringAgg.deprecation_msg
django.contrib.postgres.aggregates.StringAgg.deprecation_value
django.contrib.postgres.aggregates.general.ArrayAgg.deprecation_msg
django.contrib.postgres.aggregates.general.ArrayAgg.deprecation_value
django.contrib.postgres.aggregates.general.BitXor
django.contrib.postgres.aggregates.general.JSONBAgg.__init__
django.contrib.postgres.aggregates.general.JSONBAgg.deprecation_empty_result_set_value
django.contrib.postgres.aggregates.general.JSONBAgg.deprecation_msg
django.contrib.postgres.aggregates.general.JSONBAgg.deprecation_value
django.contrib.postgres.aggregates.general.StringAgg.__init__
django.contrib.postgres.aggregates.general.StringAgg.deprecation_msg
django.contrib.postgres.aggregates.general.StringAgg.deprecation_value
django.contrib.postgres.aggregates.mixins.OrderableAggMixin.__init__
django.contrib.postgres.aggregates.mixins.OrderableAggMixin.as_sql
django.contrib.postgres.aggregates.mixins.OrderableAggMixin.get_source_expressions
Expand Down Expand Up @@ -715,7 +694,6 @@ django.contrib.sessions.models.Session.get_previous_by_expire_date
django.contrib.sessions.models.Session.session_data
django.contrib.sessions.models.Session.session_key
django.contrib.sessions.models.SessionManager.__slotnames__
django.contrib.sessions.serializers.PickleSerializer.__init__
django.contrib.sitemaps.views.SitemapIndexItem
django.contrib.sites.admin.SiteAdmin
django.contrib.sites.models.Site.domain
Expand Down Expand Up @@ -793,17 +771,14 @@ django.core.signing.b62_encode
django.core.signing.loads
django.db.backends.ddl_references.Expressions
django.db.backends.mysql.base
django.db.backends.mysql.features.DatabaseFeatures.can_release_savepoints
django.db.backends.mysql.features.DatabaseFeatures.can_rename_index
django.db.backends.mysql.features.DatabaseFeatures.can_return_rows_from_bulk_insert
django.db.backends.mysql.features.DatabaseFeatures.django_test_skips
django.db.backends.mysql.features.DatabaseFeatures.minimum_database_version
django.db.backends.mysql.features.DatabaseFeatures.supports_frame_range_fixed_distance
django.db.backends.mysql.features.DatabaseFeatures.supports_select_difference
django.db.backends.mysql.features.DatabaseFeatures.supports_select_intersection
django.db.backends.mysql.features.DatabaseFeatures.supports_table_check_constraints
django.db.backends.mysql.features.DatabaseFeatures.test_collations
django.db.backends.mysql.features.DatabaseFeatures.uses_savepoints
django.db.backends.mysql.introspection
django.db.backends.mysql.schema.DatabaseSchemaEditor.sql_alter_column_comment
django.db.backends.oracle.base
Expand Down Expand Up @@ -849,17 +824,14 @@ django.db.backends.sqlite3.base.adapt_date
django.db.backends.sqlite3.base.adapt_datetime
django.db.backends.sqlite3.base.check_sqlite_version
django.db.backends.sqlite3.features.DatabaseFeatures.can_alter_table_drop_column
django.db.backends.sqlite3.features.DatabaseFeatures.can_alter_table_rename_column
django.db.backends.sqlite3.features.DatabaseFeatures.can_introspect_json_field
django.db.backends.sqlite3.features.DatabaseFeatures.can_return_columns_from_insert
django.db.backends.sqlite3.features.DatabaseFeatures.can_return_rows_from_bulk_insert
django.db.backends.sqlite3.features.DatabaseFeatures.django_test_skips
django.db.backends.sqlite3.features.DatabaseFeatures.has_json_object_function
django.db.backends.sqlite3.features.DatabaseFeatures.introspected_field_types
django.db.backends.sqlite3.features.DatabaseFeatures.supports_atomic_references_rename
django.db.backends.sqlite3.features.DatabaseFeatures.supports_json_field
django.db.backends.sqlite3.introspection.FieldInfo
django.db.backends.sqlite3.schema.DatabaseSchemaEditor.alter_db_table
django.db.backends.sqlite3.schema.DatabaseSchemaEditor.delete_model
django.db.backends.sqlite3.schema.DatabaseSchemaEditor.sql_create_fk
django.db.backends.utils.debug_transaction
Expand Down Expand Up @@ -1056,7 +1028,6 @@ django.db.models.QuerySet.__contains__
django.db.models.QuerySet.__deepcopy__
django.db.models.QuerySet.__reversed__
django.db.models.QuerySet.__xor__
django.db.models.QuerySet.datetimes
django.db.models.SlugField.formfield
django.db.models.SmallAutoField.rel_db_type
django.db.models.StdDev.__init__
Expand Down Expand Up @@ -1454,7 +1425,6 @@ django.db.models.query.QuerySet.__contains__
django.db.models.query.QuerySet.__deepcopy__
django.db.models.query.QuerySet.__reversed__
django.db.models.query.QuerySet.__xor__
django.db.models.query.QuerySet.datetimes
django.db.models.query.RawQuerySet.__aiter__
django.db.models.query.RawQuerySet.__init__
django.db.models.query.RelatedPopulator
Expand Down Expand Up @@ -1581,7 +1551,6 @@ django.forms.BaseModelForm.__init__
django.forms.BaseModelForm.save_m2m
django.forms.BaseModelFormSet.model
django.forms.BaseModelFormSet.save_m2m
django.forms.BoundField.__html__
django.forms.BoundWidget
django.forms.ChoiceField.__deepcopy__
django.forms.ChoiceWidget
Expand Down Expand Up @@ -1616,7 +1585,6 @@ django.forms.TextInput.__slotnames__
django.forms.Widget.__deepcopy__
django.forms.Widget.subwidgets
django.forms.Widget.use_fieldset
django.forms.boundfield.BoundField.__html__
django.forms.boundfield.BoundWidget.__html__
django.forms.fields.ChoiceField.__deepcopy__
django.forms.fields.Field.__deepcopy__
Expand Down Expand Up @@ -1651,7 +1619,6 @@ django.forms.models.inlineformset_factory
django.forms.models.modelform_factory
django.forms.models.modelformset_factory
django.forms.renderers.DjangoDivFormRenderer
django.forms.utils.DEFAULT_TEMPLATE_DEPRECATION_MSG
django.forms.widgets.ChoiceWidget.__deepcopy__
django.forms.widgets.ChoiceWidget.subwidgets
django.forms.widgets.ChoiceWidget.template_name
Expand Down Expand Up @@ -1727,8 +1694,6 @@ django.template.utils.EngineHandler.__init__
django.templatetags.i18n.BlockTranslateNode.__init__
django.templatetags.static.PrefixNode.__init__
django.templatetags.static.StaticNode.__init__
django.templatetags.tz.UnknownTimezoneException
django.templatetags.tz.timezone_constructor
django.test.SimpleTestCase.assertFormError
django.test.SimpleTestCase.assertFormSetError
django.test.SimpleTestCase.assertTemplateNotUsed
Expand Down
Loading