[Django] #31180: Deprecate default_app_config

64 views
Skip to first unread message

Django

unread,
Jan 18, 2020, 1:30:51 PM1/18/20
to django-...@googlegroups.com
#31180: Deprecate default_app_config
------------------------------------------------+------------------------
Reporter: Aymeric Augustin | Owner: nobody
Type: New feature | Status: new
Component: Core (Serialization) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
Many pluggable applications are configured with a dotted path to the app
(e.g. `"django.contrib.admin"`) in `INSTALLED_APPS`.

The application then relies on `default_app_config` for locating its
`AppConfig` class (e.g. `"django.contrib.admin.apps.AdminConfig"`).

`default_app_config` was intended to allow author of pluggable
applications to take advantage of `AppConfig` features without require
their users to change `INSTALLED_APPS`, in order to increase adoption.

Unfortunately, that reduced the incentive for directly putting paths to
`AppConfig` in `INSTALLED_APPS`. Even though that was the official
recommendation, it didn't gain traction.

If I had better anticipated this result, I wouldn't have introduced
`default_app_config` in the app-loading refactor in Django 1.7.

We've spent about five years failing at getting people to adopt explicit
configuration. It's time to admit failure. Practicality beats purity.

With the benefit of hindsight, I'm proposing to load `AppConfig` classes
from a conventional location, namely the `apps` submodule inside an
application.

This is inconsistent with Django's design philosophy, as Django favors
configuration over convention, but not much worse than the
`default_app_config` convention.

There's a small risk of backwards-incompatibility. Django could import an
`apps.py` submodule designed for another purpose and that could have side
effects. I think that risk is low.

--
Ticket URL: <https://code.djangoproject.com/ticket/31180>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 20, 2020, 9:00:28 AM1/20/20
to django-...@googlegroups.com
#31180: Deprecate default_app_config.
----------------------------------+------------------------------------

Reporter: Aymeric Augustin | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by felixxm):

* component: Core (Serialization) => Core (Other)
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/31180#comment:1>

Django

unread,
Jan 21, 2020, 4:17:16 PM1/21/20
to django-...@googlegroups.com
#31180: Deprecate default_app_config.
----------------------------------+------------------------------------

Reporter: Aymeric Augustin | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by Aymeric Augustin):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/31180#comment:2>

Django

unread,
Jan 26, 2020, 10:51:02 AM1/26/20
to django-...@googlegroups.com
#31180: Deprecate default_app_config.
-------------------------------------+-------------------------------------
Reporter: Aymeric Augustin | Owner: Sanskar
| Jaiswal
Type: New feature | Status: assigned

Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sanskar Jaiswal):

* owner: nobody => Sanskar Jaiswal
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/31180#comment:3>

Django

unread,
Jan 27, 2020, 12:56:21 AM1/27/20
to django-...@googlegroups.com
#31180: Deprecate default_app_config.
-------------------------------------+-------------------------------------
Reporter: Aymeric Augustin | Owner: Aymeric
| Augustin

Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* owner: Sanskar Jaiswal => Aymeric Augustin


Comment:

Sanskar, this ticket has a patch already.

--
Ticket URL: <https://code.djangoproject.com/ticket/31180#comment:4>

Django

unread,
Jul 15, 2020, 6:18:28 AM7/15/20
to django-...@googlegroups.com
#31180: Deprecate default_app_config.
-------------------------------------+-------------------------------------
Reporter: Aymeric Augustin | Owner: Aymeric
| Augustin
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


Comment:

Needs a final squash, but looks good.

Pushed some edits so will just give Aymeric a chance to comment again.

--
Ticket URL: <https://code.djangoproject.com/ticket/31180#comment:5>

Django

unread,
Jul 17, 2020, 1:44:59 AM7/17/20
to django-...@googlegroups.com
#31180: Deprecate default_app_config.
-------------------------------------+-------------------------------------
Reporter: Aymeric Augustin | Owner: Aymeric
| Augustin
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 0 => 1
* stage: Ready for checkin => Accepted


Comment:

This isn't quite ready.

There's a test failure from the new check, for a test added in
dd1ca50b096bf0351819aabc862e91a9797ddaca (after the PR here was first
created):

{{{
======================================================================
ERROR: test_translation_loading (i18n.tests.TranslationLoadingTests)
"loading_app" does not have translations for all languages provided by
----------------------------------------------------------------------
Traceback (most recent call last):
...
File "django/django/apps/registry.py", line 354, in set_installed_apps
self.populate(installed)
File "django/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "django/django/apps/config.py", line 235, in create
app_name, app_config_class.__module__, app_config_class.__name__,
django.core.exceptions.ImproperlyConfigured: Cannot import 'loading_app'.
Check that 'i18n.loading_app.apps.LoadingAppConfig.name' is correct.
}}}

I suspect that's just an artifact of the test case.

Plus, there are a couple of new review comments to double-check.

--
Ticket URL: <https://code.djangoproject.com/ticket/31180#comment:6>

Django

unread,
Jul 19, 2020, 3:52:43 AM7/19/20
to django-...@googlegroups.com
#31180: Deprecate default_app_config.
-------------------------------------+-------------------------------------
Reporter: Aymeric Augustin | Owner: Aymeric
| Augustin
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Aymeric Augustin):

* needs_better_patch: 1 => 0


Comment:

I believe all feedback was addressed and the PR just needs squashing and
merging.

--
Ticket URL: <https://code.djangoproject.com/ticket/31180#comment:7>

Django

unread,
Jul 21, 2020, 2:33:47 AM7/21/20
to django-...@googlegroups.com
#31180: Deprecate default_app_config.
-------------------------------------+-------------------------------------
Reporter: Aymeric Augustin | Owner: Aymeric
| Augustin
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/31180#comment:8>

Django

unread,
Jul 21, 2020, 4:35:32 AM7/21/20
to django-...@googlegroups.com
#31180: Deprecate default_app_config.
-------------------------------------+-------------------------------------
Reporter: Aymeric Augustin | Owner: Aymeric
| Augustin
Type: New feature | Status: closed

Component: Core (Other) | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"3f2821af6bc48fa8e7970c1ce27bc54c3172545e" 3f2821af]:
{{{
#!CommitTicketReference repository=""
revision="3f2821af6bc48fa8e7970c1ce27bc54c3172545e"
Fixed #31180 -- Configured applications automatically.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31180#comment:9>

Django

unread,
Aug 11, 2020, 4:31:54 AM8/11/20
to django-...@googlegroups.com
#31180: Deprecate default_app_config.
-------------------------------------+-------------------------------------
Reporter: Aymeric Augustin | Owner: Aymeric
| Augustin
Type: New feature | Status: closed
Component: Core (Other) | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by GitHub <noreply@…>):

In [changeset:"287e36bd227a694ba008c28fda1904fbe92df123" 287e36b]:
{{{
#!CommitTicketReference repository=""
revision="287e36bd227a694ba008c28fda1904fbe92df123"
Refs #31180 -- Fixed unreachable assertions in apps tests.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31180#comment:10>

Django

unread,
Sep 20, 2021, 3:23:13 PM9/20/21
to django-...@googlegroups.com
#31180: Deprecate default_app_config.
-------------------------------------+-------------------------------------
Reporter: Aymeric Augustin | Owner: Aymeric
| Augustin
Type: New feature | Status: closed
Component: Core (Other) | Version: dev

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"75d6c4ae6df93c4c4d8621aced3a180afa18a6cb" 75d6c4ae]:
{{{
#!CommitTicketReference repository=""
revision="75d6c4ae6df93c4c4d8621aced3a180afa18a6cb"
Refs #31180 -- Removed default_app_config application configuration
variable per deprecation timeline.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/31180#comment:11>

Reply all
Reply to author
Forward
0 new messages