django-compose 0.1.0.dev1__tar.gz → 0.1.0.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/AGENTS.md +2 -2
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/CHANGELOG.md +19 -1
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/CONTRIBUTING.md +9 -4
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/PKG-INFO +16 -6
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/README.md +14 -4
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/docs/README.md +4 -2
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/docs/ROADMAP.md +1 -1
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/docs/SPEC.md +83 -15
- django_compose-0.1.0.dev1/docs/addons.md → django_compose-0.1.0.dev2/docs/components.md +58 -8
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/docs/configuration.md +15 -7
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/docs/dependencies.md +4 -4
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/docs/migrations.md +18 -13
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/docs/models.md +6 -4
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/docs/packaging.md +10 -5
- django_compose-0.1.0.dev2/docs/provisioning.md +95 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/docs/quickstart.md +3 -3
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/settings.py +1 -1
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/verify.py +2 -2
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/pyproject.toml +3 -3
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/scripts/check_distribution.py +19 -10
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/artifacts.py +15 -6
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/build.py +12 -27
- django_compose-0.1.0.dev2/src/django_compose/cli.py +33 -0
- django_compose-0.1.0.dev1/src/django_compose/addons.py → django_compose-0.1.0.dev2/src/django_compose/components.py +115 -16
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/conf.py +39 -12
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/management/__init__.py +8 -1
- django_compose-0.1.0.dev2/src/django_compose/management/commands/provision.py +26 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/migrations.py +52 -33
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/model_composition.py +40 -17
- django_compose-0.1.0.dev2/src/django_compose/provision.py +349 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/snapshot.py +1 -1
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/typing.py +5 -6
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_artifacts.py +28 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_bootstrap.py +104 -1
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_boundaries.py +2 -2
- django_compose-0.1.0.dev1/tests/test_addons.py → django_compose-0.1.0.dev2/tests/test_components.py +205 -26
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_conf.py +103 -2
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_history.py +206 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_integrations.py +5 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_launcher.py +65 -1
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_migrations_guards.py +5 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_models.py +139 -0
- django_compose-0.1.0.dev2/tests/test_provision.py +745 -0
- django_compose-0.1.0.dev2/tests/test_provision_postgres.py +258 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_snapshot.py +3 -3
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_typing.py +57 -1
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/typing_fixtures/__init__.py +2 -2
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/uv.lock +68 -5
- django_compose-0.1.0.dev1/src/django_compose/cli.py +0 -12
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/.gitignore +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/COPYING +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/LICENSE +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/Makefile +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/NOTICE +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/docs/extensions.md +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/docs/proposals/README.md +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/.gitignore +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/README.md +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/catalog/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/catalog/apps.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/catalog/autoconfig.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/catalog/integrations.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/catalog/management/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/catalog/management/commands/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/catalog/management/commands/verify_context.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/catalog/models.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/catalog/pyproject.toml +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/catalog/schema.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/catalog/transport.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/catalog/urls.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/contexts.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/manage.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/reviews/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/reviews/apps.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/reviews/autoconfig.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/reviews/models.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/reviews/pyproject.toml +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/examples/shop/urls.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/__main__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/apps.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/asgi.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/autoreload.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/checks.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/declarations.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/history.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/management/commands/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/management/commands/check_migrations.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/management/commands/compose.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/management/commands/makemigrations.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/management/commands/migrate.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/management/commands/reset_migration_history.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/management/commands/retire_history.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/migration_imports.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/models.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/py.typed +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/rendering.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/serving.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/sources.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/src/django_compose/urls.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/core_fixtures/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_asgi.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_autoreload.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_command_context.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_initial_history.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_migration_imports.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_migration_scaffold.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_migrations.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_sources.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_startup.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev2}/tests/test_urls.py +0 -0
|
@@ -6,8 +6,8 @@ package; this package never imports a consumer framework, host, or product.
|
|
|
6
6
|
|
|
7
7
|
Find the owner first. Django owns application identity and population, model
|
|
8
8
|
construction, fields, managers, migration state, execution, routing, and history.
|
|
9
|
-
This package owns
|
|
10
|
-
|
|
9
|
+
This package owns composition, deterministic emission, reusable migration binding
|
|
10
|
+
and verified database preparation. Do not add parallel registries or parsers.
|
|
11
11
|
|
|
12
12
|
Keep entrypoints thin, names consistent, and policy on the owning object.
|
|
13
13
|
Preserve native extension points and fail explicitly on competing declarations.
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0.dev2
|
|
4
|
+
|
|
5
|
+
- Use component vocabulary for installed distributions, keeping distribution and
|
|
6
|
+
Django app identities distinct in selection and isolated inspection results.
|
|
7
|
+
- Bound isolated inspection and expose the strict native YAML error context.
|
|
8
|
+
- Own verified database provisioning, optional app hooks and durable readiness
|
|
9
|
+
upstream, with explicit legacy-record cutover and native PostgreSQL locking.
|
|
10
|
+
- Protect active shared tables during history purge and include native data-operation
|
|
11
|
+
routing hints in retirement and reset checks.
|
|
12
|
+
- Preserve migration file permissions during failed history reset through the
|
|
13
|
+
common atomic writer.
|
|
14
|
+
- Recover interrupted model publication through the same ownership sequence used
|
|
15
|
+
by artifact hooks.
|
|
16
|
+
- Reject inherited and implicit manager/field collisions while allowing identical
|
|
17
|
+
column names in separate multi-table inheritance tables.
|
|
18
|
+
- Share native relation typing for authored and generated fields, including proxy
|
|
19
|
+
relations, and call model discovery directly from its owner.
|
|
20
|
+
|
|
3
21
|
## 0.1.0.dev1
|
|
4
22
|
|
|
5
23
|
- Report the composition lock path and wait duration when another reader or
|
|
@@ -33,5 +51,5 @@
|
|
|
33
51
|
- Compose native URL declarations, ASGI mounts/protocols and ordered lifespans.
|
|
34
52
|
- Recompose before native development-server children start, report inputs before
|
|
35
53
|
reads and recover after failed composition and file creation/deletion.
|
|
36
|
-
- Inspect installed
|
|
54
|
+
- Inspect installed component metadata without importing app modules and project
|
|
37
55
|
generated model typing in memory without rewriting source or stub files.
|
|
@@ -28,9 +28,13 @@ uv run --no-sync pytest -q tests/test_migrations.py
|
|
|
28
28
|
|
|
29
29
|
`make dist-check` builds wheel and sdist, checks metadata and archive contents,
|
|
30
30
|
and exercises a fresh wheel installation outside the checkout. The installation
|
|
31
|
-
test first uses base dependencies, then installed
|
|
32
|
-
contributions; it covers composition, native migration history,
|
|
33
|
-
output refusal and retained-import reporting.
|
|
31
|
+
test first uses base dependencies, then installed component wheels with settings
|
|
32
|
+
contributions; it covers composition, native migration history, provisioning,
|
|
33
|
+
serving, ORM behavior, stale output refusal and retained-import reporting.
|
|
34
|
+
CI runs the same Makefile targets with a disposable PostgreSQL service. The dev
|
|
35
|
+
dependencies include its native driver and pool for the
|
|
36
|
+
[PostgreSQL proof](docs/provisioning.md#optional-postgresql-proof); local runs
|
|
37
|
+
skip that proof unless its dedicated test-environment file is supplied.
|
|
34
38
|
The Checks workflow uploads archives without publishing them. The separate
|
|
35
39
|
[release workflow](docs/packaging.md#publish-this-library) publishes checked
|
|
36
40
|
archives to PyPI when explicitly dispatched or triggered by a version tag.
|
|
@@ -40,7 +44,8 @@ archives to PyPI when explicitly dispatched or triggered by a version tag.
|
|
|
40
44
|
Django owns app identity/population, model construction, fields, managers, ORM,
|
|
41
45
|
migration state and execution. Extend those native contracts instead of adding
|
|
42
46
|
parallel registries, parsers or lifecycle systems. django-compose owns only the
|
|
43
|
-
composition, deterministic output
|
|
47
|
+
composition, deterministic output, reusable migration-binding seams and verified
|
|
48
|
+
database preparation through native app hooks.
|
|
44
49
|
|
|
45
50
|
Keep commands and other entrypoints thin. Put a missing rule on its existing
|
|
46
51
|
owner, migrate callers and remove superseded code and guidance. Public behavior,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: django-compose
|
|
3
|
-
Version: 0.1.0.
|
|
3
|
+
Version: 0.1.0.dev2
|
|
4
4
|
Summary: Compose reusable Django apps into a runnable project.
|
|
5
5
|
Project-URL: Source, https://github.com/ang-ee/django-compose
|
|
6
6
|
Project-URL: Documentation, https://github.com/ang-ee/django-compose/tree/main/docs
|
|
@@ -16,7 +16,7 @@ Requires-Dist: django<6.2,>=6.1.2
|
|
|
16
16
|
Requires-Dist: packaging>=26
|
|
17
17
|
Provides-Extra: typing
|
|
18
18
|
Requires-Dist: angee-django-stubs-ext==6.1.2; extra == 'typing'
|
|
19
|
-
Requires-Dist: angee-django-stubs[compatible-mypy]==6.1.2.
|
|
19
|
+
Requires-Dist: angee-django-stubs[compatible-mypy]==6.1.2.post3; extra == 'typing'
|
|
20
20
|
Requires-Dist: angee-mypy==2.1.0; extra == 'typing'
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
|
|
@@ -24,6 +24,10 @@ Description-Content-Type: text/markdown
|
|
|
24
24
|
|
|
25
25
|
Compose reusable Django apps into a runnable project.
|
|
26
26
|
|
|
27
|
+
Installed Python distributions participate as **components**, each providing one
|
|
28
|
+
Django app. Native package metadata supplies dependencies; `INSTALLED_APPS`
|
|
29
|
+
selects the project's roots. Components can provide models, settings or resources.
|
|
30
|
+
|
|
27
31
|
One app can define a model and another can add fields and behavior to it. The
|
|
28
32
|
result is an ordinary concrete Django model, with Django's ORM and migrations.
|
|
29
33
|
|
|
@@ -44,14 +48,14 @@ This is useful when several projects share a model but need different optional
|
|
|
44
48
|
capabilities. For a single project with a fixed model structure, ordinary Django
|
|
45
49
|
models and abstract bases may already be sufficient.
|
|
46
50
|
|
|
47
|
-
**Status:** development preview `0.1.0.
|
|
51
|
+
**Status:** development preview `0.1.0.dev2`; Python 3.14 and Django 6.1 are supported.
|
|
48
52
|
The base dependencies are Django, packaging and django-yamlconf.
|
|
49
53
|
|
|
50
54
|
```sh
|
|
51
|
-
python -m pip install django-compose==0.1.0.
|
|
55
|
+
python -m pip install django-compose==0.1.0.dev2
|
|
52
56
|
```
|
|
53
57
|
|
|
54
|
-
For advanced composed-model analysis, install `django-compose[typing]==0.1.0.
|
|
58
|
+
For advanced composed-model analysis, install `django-compose[typing]==0.1.0.dev2`;
|
|
55
59
|
see [typing dependencies](https://github.com/ang-ee/django-compose/blob/main/docs/dependencies.md#advanced-typing). The example below
|
|
56
60
|
uses this checkout and does not require another framework.
|
|
57
61
|
|
|
@@ -87,6 +91,12 @@ The two apps now contribute to the same model and table. `compose` generated the
|
|
|
87
91
|
classes; `makemigrations` and `migrate` created and applied ordinary Django
|
|
88
92
|
history. Source apps remain installed when the generated project runs.
|
|
89
93
|
|
|
94
|
+
Projects with database preparation hooks can use
|
|
95
|
+
[`provision`](https://github.com/ang-ee/django-compose/blob/main/docs/provisioning.md)
|
|
96
|
+
after composing and authoring migrations. It applies migrations, runs optional
|
|
97
|
+
app hooks and records readiness for the verified composition. `compose` itself
|
|
98
|
+
performs no database preparation.
|
|
99
|
+
|
|
90
100
|
## Where to go next
|
|
91
101
|
|
|
92
102
|
- [Quick start](https://github.com/ang-ee/django-compose/blob/main/docs/quickstart.md): walk through the source, generated files,
|
|
@@ -95,7 +105,7 @@ history. Source apps remain installed when the generated project runs.
|
|
|
95
105
|
native multi-table inheritance.
|
|
96
106
|
- [Project configuration](https://github.com/ang-ee/django-compose/blob/main/docs/configuration.md): use django-compose in your own
|
|
97
107
|
project with the current settings and `manage.py` integration.
|
|
98
|
-
- [Documentation](https://github.com/ang-ee/django-compose/blob/main/docs/README.md): optional
|
|
108
|
+
- [Documentation](https://github.com/ang-ee/django-compose/blob/main/docs/README.md): optional component selection, integrations,
|
|
99
109
|
migrations, packaging, API reference and current limitations.
|
|
100
110
|
|
|
101
111
|
The source is licensed under [LGPL-3.0-or-later](https://github.com/ang-ee/django-compose/blob/main/LICENSE).
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Compose reusable Django apps into a runnable project.
|
|
4
4
|
|
|
5
|
+
Installed Python distributions participate as **components**, each providing one
|
|
6
|
+
Django app. Native package metadata supplies dependencies; `INSTALLED_APPS`
|
|
7
|
+
selects the project's roots. Components can provide models, settings or resources.
|
|
8
|
+
|
|
5
9
|
One app can define a model and another can add fields and behavior to it. The
|
|
6
10
|
result is an ordinary concrete Django model, with Django's ORM and migrations.
|
|
7
11
|
|
|
@@ -22,14 +26,14 @@ This is useful when several projects share a model but need different optional
|
|
|
22
26
|
capabilities. For a single project with a fixed model structure, ordinary Django
|
|
23
27
|
models and abstract bases may already be sufficient.
|
|
24
28
|
|
|
25
|
-
**Status:** development preview `0.1.0.
|
|
29
|
+
**Status:** development preview `0.1.0.dev2`; Python 3.14 and Django 6.1 are supported.
|
|
26
30
|
The base dependencies are Django, packaging and django-yamlconf.
|
|
27
31
|
|
|
28
32
|
```sh
|
|
29
|
-
python -m pip install django-compose==0.1.0.
|
|
33
|
+
python -m pip install django-compose==0.1.0.dev2
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
For advanced composed-model analysis, install `django-compose[typing]==0.1.0.
|
|
36
|
+
For advanced composed-model analysis, install `django-compose[typing]==0.1.0.dev2`;
|
|
33
37
|
see [typing dependencies](https://github.com/ang-ee/django-compose/blob/main/docs/dependencies.md#advanced-typing). The example below
|
|
34
38
|
uses this checkout and does not require another framework.
|
|
35
39
|
|
|
@@ -65,6 +69,12 @@ The two apps now contribute to the same model and table. `compose` generated the
|
|
|
65
69
|
classes; `makemigrations` and `migrate` created and applied ordinary Django
|
|
66
70
|
history. Source apps remain installed when the generated project runs.
|
|
67
71
|
|
|
72
|
+
Projects with database preparation hooks can use
|
|
73
|
+
[`provision`](https://github.com/ang-ee/django-compose/blob/main/docs/provisioning.md)
|
|
74
|
+
after composing and authoring migrations. It applies migrations, runs optional
|
|
75
|
+
app hooks and records readiness for the verified composition. `compose` itself
|
|
76
|
+
performs no database preparation.
|
|
77
|
+
|
|
68
78
|
## Where to go next
|
|
69
79
|
|
|
70
80
|
- [Quick start](https://github.com/ang-ee/django-compose/blob/main/docs/quickstart.md): walk through the source, generated files,
|
|
@@ -73,7 +83,7 @@ history. Source apps remain installed when the generated project runs.
|
|
|
73
83
|
native multi-table inheritance.
|
|
74
84
|
- [Project configuration](https://github.com/ang-ee/django-compose/blob/main/docs/configuration.md): use django-compose in your own
|
|
75
85
|
project with the current settings and `manage.py` integration.
|
|
76
|
-
- [Documentation](https://github.com/ang-ee/django-compose/blob/main/docs/README.md): optional
|
|
86
|
+
- [Documentation](https://github.com/ang-ee/django-compose/blob/main/docs/README.md): optional component selection, integrations,
|
|
77
87
|
migrations, packaging, API reference and current limitations.
|
|
78
88
|
|
|
79
89
|
The source is licensed under [LGPL-3.0-or-later](https://github.com/ang-ee/django-compose/blob/main/LICENSE).
|
|
@@ -14,10 +14,12 @@ Django continues to own model construction, queries and migrations.
|
|
|
14
14
|
|
|
15
15
|
## Build and run a project
|
|
16
16
|
|
|
17
|
-
- [Installed
|
|
17
|
+
- [Installed component selection](components.md): activate installed reusable apps from
|
|
18
18
|
distribution metadata and native app dependencies.
|
|
19
19
|
- [Migrations](migrations.md): author and retain native history, audit imports,
|
|
20
20
|
and manage removed apps.
|
|
21
|
+
- [Provisioning](provisioning.md): prepare a selected database and require durable
|
|
22
|
+
readiness for the verified composition.
|
|
21
23
|
- [Packaging](packaging.md): include generated output and migration history in
|
|
22
24
|
a deployable project while retaining its source-app dependencies.
|
|
23
25
|
|
|
@@ -30,5 +32,5 @@ Django continues to own model construction, queries and migrations.
|
|
|
30
32
|
- [Roadmap](ROADMAP.md): current boundaries, planned work and consumer adoption.
|
|
31
33
|
- [Contributing](../CONTRIBUTING.md): checks and repository workflow.
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
These guides describe the `0.1.0.dev2` development preview. Start from the checkout instructions in
|
|
34
36
|
[the quick start](quickstart.md); the optional extras are not required there.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Current scope and planned work
|
|
2
2
|
|
|
3
|
-
The current development preview is `0.1.0.
|
|
3
|
+
The current development preview is `0.1.0.dev2`. The
|
|
4
4
|
[specification](SPEC.md) describes implemented behavior; the [quick start](quickstart.md)
|
|
5
5
|
and [configuration guide](configuration.md) use that API today.
|
|
6
6
|
|
|
@@ -17,8 +17,10 @@ to wire your own project. Planned APIs are described separately in
|
|
|
17
17
|
a selected source model; the composition-query API calls it a *donor*.
|
|
18
18
|
- A **generated model** is the concrete Django class emitted into the project's
|
|
19
19
|
generated package. Application code obtains it through Django's app registry.
|
|
20
|
-
- A **root app** is a project-authored `INSTALLED_APPS` entry.
|
|
21
|
-
installed distribution participating in the optional
|
|
20
|
+
- A **root app** is a project-authored `INSTALLED_APPS` entry. A **component** is an
|
|
21
|
+
installed Python distribution participating in the optional selection group.
|
|
22
|
+
Each component currently provides one Django app. Distribution names, Python
|
|
23
|
+
import paths and native app identities remain distinct.
|
|
22
24
|
- A **snapshot** is the immutable set of composition inputs and their digest.
|
|
23
25
|
A **build record**, represented by `serving.Receipt`, records generated-file
|
|
24
26
|
hashes and retained migration labels in the generated package.
|
|
@@ -58,8 +60,10 @@ Generated bases are extension classes in selected app/declaration order, the
|
|
|
58
60
|
source model, then its concrete parent. Django clones fields and resolves the
|
|
59
61
|
native method-resolution order. Shared abstract ancestry contributes once. The
|
|
60
62
|
first extension manager overrides a source manager; distinct extensions
|
|
61
|
-
claiming one manager name fail. Field-name, attname, database-column,
|
|
62
|
-
field/manager and parent-field redeclaration collisions fail.
|
|
63
|
+
claiming one manager name fail. Field-name, attname, same-table database-column,
|
|
64
|
+
field/manager and parent-field redeclaration collisions fail. Native generated
|
|
65
|
+
metadata also checks inherited and automatically created managers before callbacks.
|
|
66
|
+
Unknown targets,
|
|
63
67
|
parent or module dependency cycles, and unmet ancestor demands fail explicitly.
|
|
64
68
|
|
|
65
69
|
The source's `Meta` is preserved. Extension classes may author native
|
|
@@ -81,14 +85,15 @@ app/config strings and previously normalized `Entry` values, preserves explicit
|
|
|
81
85
|
config classes, and rejects config instances or duplicate native identities and
|
|
82
86
|
labels. It does not expand dependencies.
|
|
83
87
|
|
|
84
|
-
The base `django_compose.
|
|
88
|
+
The base `django_compose.components.enabled_apps(roots, *, group=None) -> Closure`
|
|
85
89
|
uses a nonempty group for distribution activation. Without a group it skips
|
|
86
90
|
distribution metadata while retaining native `requires_apps` edges. An explicitly
|
|
87
91
|
empty or invalid group fails. Its frozen result has
|
|
88
92
|
`entries: tuple[str, ...]` in dependency order, `roots: tuple[str, ...]` of authored
|
|
89
|
-
root app names, and `required
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
root app names, and `required: frozenset[str]` of dependency-only app names.
|
|
94
|
+
`components: Mapping[str, str]` maps selected canonical distribution names to
|
|
95
|
+
their native app names. `dependencies` maps selected native app names to ordered
|
|
96
|
+
direct dependency app names. These mappings are immutable.
|
|
92
97
|
|
|
93
98
|
Each participating distribution declares exactly one group entry point, keyed
|
|
94
99
|
by native `AppConfig.name`, whose value is a native app/config string. Active
|
|
@@ -96,12 +101,62 @@ installed `Requires-Dist` requirements evaluated with `extra=""` select provider
|
|
|
96
101
|
in the same group. Selected configs' `requires_apps` entries are also followed.
|
|
97
102
|
Explicit root configs override dependency defaults. A plain root outside the
|
|
98
103
|
group has no metadata-based activation expansion. Installation alone never
|
|
99
|
-
activates
|
|
104
|
+
activates a component or an optional extra. A component can contain only resources:
|
|
105
|
+
an importable app package is sufficient, with no custom AppConfig, models or hooks.
|
|
106
|
+
App-less and multi-app components are outside the current selection contract.
|
|
100
107
|
|
|
101
108
|
Competing providers/configs, invalid entry-point identities, duplicate labels,
|
|
102
109
|
missing active installed requirements and cycles fail. The selector reads
|
|
103
110
|
installed metadata; it does not install packages or compose settings. See
|
|
104
|
-
[installed
|
|
111
|
+
[installed components](components.md) for complete package examples.
|
|
112
|
+
|
|
113
|
+
`django_compose.components.inspect_apps(roots, *, group=None, timeout=30.0) -> AppSelection`
|
|
114
|
+
delegates the same selection to a fresh current-interpreter subprocess. It uses
|
|
115
|
+
the caller's import paths, clears `DJANGO_SETTINGS_MODULE` and
|
|
116
|
+
`DJANGO_COMPOSE_MODE` in the child, and disables bytecode writes. The caller's
|
|
117
|
+
registry, settings and imported app modules are unchanged. The inspector invokes
|
|
118
|
+
no Django setup, model loading, app settings contributions, composition or
|
|
119
|
+
database work. Selected native app/config modules must be safe before setup;
|
|
120
|
+
their import behavior remains Django-owned.
|
|
121
|
+
|
|
122
|
+
`AppSelection` is a `TypedDict` containing detached JSON-compatible facts:
|
|
123
|
+
`app_entries` is a dependency-ordered list of dictionaries with the existing
|
|
124
|
+
`Entry` fields (`name`, `label`, `config`, `path`, `entry`); `roots` is a list of
|
|
125
|
+
native root app names in authored order; `required` is a sorted list of dependency
|
|
126
|
+
app names; `components` maps canonical distribution names to their selected native
|
|
127
|
+
app names; `dependencies` maps every selected native app name to its direct
|
|
128
|
+
dependency names. No native app instance crosses the process boundary. Selection
|
|
129
|
+
failures raise `ImproperlyConfigured` with the child diagnostic. A positive finite
|
|
130
|
+
`timeout` bounds the child process; launch failures and timeouts raise the same
|
|
131
|
+
exception without changing the caller's application state.
|
|
132
|
+
|
|
133
|
+
The standalone `django-compose inspect-apps [--group GROUP] [--timeout SECONDS] [APP_ENTRY ...]`
|
|
134
|
+
and `python -m django_compose inspect-apps ...` commands print this object as JSON
|
|
135
|
+
without importing native management dispatch or project settings. Zero roots
|
|
136
|
+
produce an empty selection. Import diagnostics go to stderr, separately from
|
|
137
|
+
JSON stdout, including native writes to file descriptor 1 and inherited subprocess
|
|
138
|
+
stdout. A reserved response descriptor carries only JSON; malformed or empty
|
|
139
|
+
responses raise `ImproperlyConfigured`. Selection failures exit with status 1.
|
|
140
|
+
This is a standalone command, not a Django management command.
|
|
141
|
+
|
|
142
|
+
## Database preparation and readiness
|
|
143
|
+
|
|
144
|
+
`django_compose.provision` owns database preparation for a startup-verified
|
|
145
|
+
composition. The native `provision` command is registered by the existing
|
|
146
|
+
ComposeConfig and supports `--database`, `--wait-db` and read-only `--check`.
|
|
147
|
+
Compose continues to generate artifacts without database work.
|
|
148
|
+
|
|
149
|
+
Optional `AppConfig.compose_provision(context)` hooks receive an immutable
|
|
150
|
+
`ProvisionContext(database, stdout, stderr, verbosity=1)` after native migrations.
|
|
151
|
+
The context's `call()` uses native management dispatch with the selected IO;
|
|
152
|
+
each hook supplies its command's supported database option. Apps without hooks
|
|
153
|
+
require no substitute. Resource declaration/loading policy stays with the
|
|
154
|
+
selected resource-owning app.
|
|
155
|
+
|
|
156
|
+
`require_provisioned(using="default", timeout=0)` verifies the current receipt
|
|
157
|
+
under its lease and reads readiness and native migration state without repair.
|
|
158
|
+
The single private recorder, durable failure/retry boundary, PostgreSQL lock and
|
|
159
|
+
explicit `base_provision` table cutover are defined in [provisioning](provisioning.md).
|
|
105
160
|
|
|
106
161
|
## Settings and snapshots
|
|
107
162
|
|
|
@@ -151,8 +206,16 @@ loader adapter for preserving this provenance. Loaders call it instead of
|
|
|
151
206
|
upstream `django_yamlconf.expand_attribute_refs`, then use native `inject_attr`
|
|
152
207
|
and retain `_YAMLCONF_ATTRIBUTES` in the namespace passed to `configure` once.
|
|
153
208
|
It delegates native expansion while updating only `evalue` fields; `value` and
|
|
154
|
-
`history` templates remain intact. Native logged errors retain upstream behavior
|
|
155
|
-
|
|
209
|
+
`history` templates remain intact. Native logged errors retain upstream behavior;
|
|
210
|
+
strict loaders use `conf.fail_on_yamlconf_errors()` around loading, expansion
|
|
211
|
+
and injection. This context manager raises `ImproperlyConfigured` with the native
|
|
212
|
+
message for `django_yamlconf` ERROR records. It temporarily enables that logger
|
|
213
|
+
and lowers its threshold enough to admit ERROR, retaining previous lower-level
|
|
214
|
+
record admission. It restores the original explicit level and disabled flag and
|
|
215
|
+
removes its handler on exit, including nested scopes and failures. If process-wide
|
|
216
|
+
`logging.disable` suppresses ERROR, it refuses entry with `ImproperlyConfigured`
|
|
217
|
+
instead of changing unrelated loggers. Compiler contributions use the same context.
|
|
218
|
+
Ordinary upstream expansion
|
|
156
219
|
mutates list/dict templates: once erased from both value and history, their
|
|
157
220
|
reference origins cannot be recovered from already-expanded metadata. See the
|
|
158
221
|
[native loader handoff](configuration.md#native-yamlconf-loader-handoff).
|
|
@@ -165,7 +228,7 @@ keep ordering and input ownership in one place. See the
|
|
|
165
228
|
|
|
166
229
|
| Setting | Meaning / default |
|
|
167
230
|
| --- | --- |
|
|
168
|
-
| `
|
|
231
|
+
| `COMPOSE_COMPONENT_GROUP` | Optional installed entry-point group; absent means native dependencies only |
|
|
169
232
|
| `COMPOSE_ENV_PREFIXES` | Declared prefixes permitted for static contribution environment overlays; empty by default |
|
|
170
233
|
| `COMPOSE_OUTPUT_DIR` | Project-selected generated package directory; required for building |
|
|
171
234
|
| `COMPOSE_OUTPUT_MODULE` | Import path for that directory; defaults to `"runtime"` |
|
|
@@ -340,7 +403,9 @@ contain no generation markers; the retained receipt and shared lock own startup
|
|
|
340
403
|
consistency. The literal reader accepts the historical receipt field only.
|
|
341
404
|
|
|
342
405
|
Every record mutation uses the common output lock. Writers invalidate first,
|
|
406
|
+
validate existing ownership, record intended paths in the incomplete receipt,
|
|
343
407
|
write guarded files atomically through `GeneratedTree`, then finalize last.
|
|
408
|
+
A retry retains ownership of files written by an interrupted build.
|
|
344
409
|
A failed build remains `IN_PROGRESS`; reverting source bytes does not revive it.
|
|
345
410
|
Stale cleanup removes only previously recorded generated paths. Normal build
|
|
346
411
|
and clean preserve migration directories and unowned files, and refuse foreign
|
|
@@ -397,12 +462,15 @@ integration-owned row exemptions use `MigrationPolicy`.
|
|
|
397
462
|
|
|
398
463
|
Retirement requires consistent fully applied history across all configured
|
|
399
464
|
migration-relevant aliases and refuses retained incoming cross-app dependencies.
|
|
465
|
+
The alias scope includes native data-operation routing hints; custom database
|
|
466
|
+
behavior that cannot establish a narrower scope requires all configured aliases.
|
|
400
467
|
Optional purge authors/applies a final deletion transition on that same alias
|
|
401
468
|
scope; purge alone is not retirement. Successful retirement updates the record;
|
|
402
469
|
the next compose removes the history-only config. Databases absent from command
|
|
403
470
|
settings lie outside that proof. Guarded history reset additionally requires a
|
|
404
471
|
fully applied, model-clean graph and uses transactional recorder changes with
|
|
405
|
-
filesystem rollback
|
|
472
|
+
filesystem rollback preserving original bytes and permissions. Normal build and
|
|
473
|
+
clean never reset history.
|
|
406
474
|
|
|
407
475
|
`check_migrations` checks native state and pending transitions.
|
|
408
476
|
`check_migrations --imports` statically audits selected migration sources,
|
|
@@ -444,7 +512,7 @@ Lifespan factories enter in app order, unwind in reverse and report startup/shut
|
|
|
444
512
|
failure. HTTP and lifespan are reserved protocols; duplicate mounts or protocol
|
|
445
513
|
claims fail. These modules require completed setup and install no server policy.
|
|
446
514
|
|
|
447
|
-
`
|
|
515
|
+
`components.installed_components(group)` indexes installed native Distribution and EntryPoint
|
|
448
516
|
objects without importing app modules. Its read-only `distributions`, `entry_points`
|
|
449
517
|
and `providers` maps use canonical distribution names/app keys as documented by the
|
|
450
518
|
native owner. `active_requirements(iterable_of_strings)` and the index method
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
# Select apps from installed
|
|
1
|
+
# Select apps from installed component packages
|
|
2
2
|
|
|
3
|
-
An **installed distribution** is a Python
|
|
4
|
-
package manager.
|
|
3
|
+
An **installed distribution** is a Python project installed by pip or another
|
|
4
|
+
package manager. A **component** is a participating distribution that provides
|
|
5
|
+
one Django app. An **enabled app** is a native Django app selected for this
|
|
5
6
|
project. A **generated model** is the concrete class composed from selected
|
|
6
7
|
model declarations. These are separate choices: installing an app package does
|
|
7
8
|
not enable it, and an enabled app need not declare any generated models.
|
|
@@ -13,7 +14,14 @@ It then applies selected apps' settings contributions; it never installs package
|
|
|
13
14
|
|
|
14
15
|
The examples below are two local distributions you create, not names assumed to
|
|
15
16
|
exist on a package index. Install them in the same environment as the project.
|
|
16
|
-
|
|
17
|
+
Component selection is included in the base installation.
|
|
18
|
+
|
|
19
|
+
Distribution names, import paths and app names need not match. For example,
|
|
20
|
+
`shop-catalog` below provides the app `shop_catalog`. Package metadata owns the
|
|
21
|
+
distribution's version and requirements; Django owns its AppConfig identity.
|
|
22
|
+
A component may contain only resources: its importable app package needs no
|
|
23
|
+
models, custom AppConfig or provisioning hook. The selected resource consumer
|
|
24
|
+
owns loading those declarations. App-less and multi-app components are deferred.
|
|
17
25
|
|
|
18
26
|
## Declare each distribution
|
|
19
27
|
|
|
@@ -118,7 +126,7 @@ and group before the existing final `configure(globals())` call:
|
|
|
118
126
|
|
|
119
127
|
```python
|
|
120
128
|
INSTALLED_APPS = ["catalog.apps.CatalogConfig", "shop_reviews.apps.ReviewsConfig"]
|
|
121
|
-
|
|
129
|
+
COMPOSE_COMPONENT_GROUP = "example.shop.apps"
|
|
122
130
|
```
|
|
123
131
|
|
|
124
132
|
`shop_catalog` is selected through the reviews distribution's dependency. The
|
|
@@ -128,13 +136,55 @@ precedence over dependency defaults. Selected apps can contribute
|
|
|
128
136
|
|
|
129
137
|
The low-level `enabled_apps(roots, *, group=None)` helper returns an immutable
|
|
130
138
|
`Closure` with ordered native `entries`, native root names, dependency-only
|
|
131
|
-
`required` names and
|
|
139
|
+
`required` app names and a read-only `components` mapping from canonical
|
|
140
|
+
distribution names to selected app names. It reads no settings.
|
|
132
141
|
With no group it skips distribution discovery and follows only `requires_apps`;
|
|
133
142
|
an explicitly empty or invalid group fails. `configure` uses this same helper.
|
|
134
143
|
|
|
144
|
+
## Inspect a selection from a running application
|
|
145
|
+
|
|
146
|
+
Use `inspect_apps` when an already populated application needs to inspect apps
|
|
147
|
+
that it has not enabled. It resolves the same native selection in a fresh
|
|
148
|
+
interpreter and returns detached JSON data:
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
from django_compose.components import inspect_apps
|
|
152
|
+
|
|
153
|
+
selection = inspect_apps(["shop_reviews.apps.ReviewsConfig"], group="example.shop.apps")
|
|
154
|
+
for app in selection["app_entries"]:
|
|
155
|
+
print(app["name"], app["label"], app["config"], app["path"], app["entry"])
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`app_entries` retains dependency order. `roots` contains native root names in
|
|
159
|
+
authored order, `required` contains sorted dependency-only app names, `components`
|
|
160
|
+
maps distribution names to app names, and `dependencies` maps every selected
|
|
161
|
+
native app name to its direct dependency names. The function always launches the
|
|
162
|
+
current interpreter with the caller's import paths. It clears Django settings
|
|
163
|
+
and composition-mode environment selectors in that child and disables bytecode
|
|
164
|
+
writes. The calling application's settings, registry and imported apps stay
|
|
165
|
+
unchanged. It runs no Django setup, models, settings contributions, composition
|
|
166
|
+
or database work. Selected app/config imports still follow Django's ordinary
|
|
167
|
+
pre-setup restrictions.
|
|
168
|
+
|
|
169
|
+
The keyword `timeout=30.0` bounds inspection in seconds and must be positive and
|
|
170
|
+
finite. Timeout and process-launch failures raise `ImproperlyConfigured`, just
|
|
171
|
+
like selection errors. The CLI exposes the same bound with `--timeout`.
|
|
172
|
+
|
|
173
|
+
The standalone launcher exposes the same operation without loading project
|
|
174
|
+
settings or native management commands:
|
|
175
|
+
|
|
176
|
+
```sh
|
|
177
|
+
python -m django_compose inspect-apps --group example.shop.apps shop_reviews.apps.ReviewsConfig
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
It prints the `AppSelection` object as JSON on stdout; native import diagnostics
|
|
181
|
+
use stderr. Selection errors raise `ImproperlyConfigured` through the Python API
|
|
182
|
+
and exit with status 1 through the CLI. Omitting all roots returns an empty
|
|
183
|
+
selection. This standalone command is not available through `manage.py`.
|
|
184
|
+
|
|
135
185
|
## Dependency and configuration rules
|
|
136
186
|
|
|
137
|
-
For a selected
|
|
187
|
+
For a selected component, active installed `Requires-Dist` requirements are evaluated
|
|
138
188
|
with `extra=""`. If a required distribution has an entry point in the chosen
|
|
139
189
|
group, its app is selected too. Normal library dependencies do not become Django
|
|
140
190
|
apps. Environment markers are honored; requirements conditional on an optional
|
|
@@ -159,7 +209,7 @@ class ReportsConfig(AppConfig):
|
|
|
159
209
|
|
|
160
210
|
These requirements are followed for selected configs even when the app has no
|
|
161
211
|
entry point in the group. Such a **plain root** otherwise has no package-metadata
|
|
162
|
-
activation expansion. An unrelated installed
|
|
212
|
+
activation expansion. An unrelated installed component is never selected solely
|
|
163
213
|
because it shares the group.
|
|
164
214
|
|
|
165
215
|
Explicit root config classes take precedence over dependency defaults. You can
|
|
@@ -92,7 +92,7 @@ configure(globals())
|
|
|
92
92
|
|
|
93
93
|
`configure` returns `None` and mutates this namespace. `INSTALLED_APPS` contains
|
|
94
94
|
native app strings or explicit AppConfig paths. Optional
|
|
95
|
-
[
|
|
95
|
+
[component selection](components.md) uses `COMPOSE_COMPONENT_GROUP`; without it, native
|
|
96
96
|
`requires_apps` dependencies still apply. Installation alone enables no apps.
|
|
97
97
|
|
|
98
98
|
The function owns derived `COMPOSE_ROOTS`, `COMPOSE_SNAPSHOT` and `COMPOSE_CLOSURE`; projects and
|
|
@@ -321,7 +321,7 @@ A Django project using ordinary authored concrete models can apply selected
|
|
|
321
321
|
apps' settings contributions through `apply_app_settings`:
|
|
322
322
|
|
|
323
323
|
```python
|
|
324
|
-
from django_compose.
|
|
324
|
+
from django_compose.components import enabled_apps
|
|
325
325
|
from django_compose.conf import apply_app_settings
|
|
326
326
|
|
|
327
327
|
INSTALLED_APPS = ["catalog.apps.CatalogConfig"]
|
|
@@ -344,13 +344,14 @@ A deployment loader that prepares native django-yamlconf attribute records befor
|
|
|
344
344
|
`django_yamlconf.expand_attribute_refs(attributes)`, then inject the same records:
|
|
345
345
|
|
|
346
346
|
```python
|
|
347
|
-
from django_compose.conf import configure, expand_attribute_refs
|
|
347
|
+
from django_compose.conf import configure, expand_attribute_refs, fail_on_yamlconf_errors
|
|
348
348
|
import django_yamlconf
|
|
349
349
|
|
|
350
350
|
# The loader has populated native `attributes` with set_attr_value(), including
|
|
351
351
|
# native environment sources, and `settings_module` contains deployment settings.
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
with fail_on_yamlconf_errors():
|
|
353
|
+
expand_attribute_refs(attributes)
|
|
354
|
+
django_yamlconf.inject_attr(attributes, settings_module)
|
|
354
355
|
namespace.update(vars(settings_module))
|
|
355
356
|
configure(namespace)
|
|
356
357
|
```
|
|
@@ -358,8 +359,15 @@ configure(namespace)
|
|
|
358
359
|
The adapter delegates expansion to django-yamlconf and updates only each record's
|
|
359
360
|
`evalue`; original `value` and `history` containers retain reference templates.
|
|
360
361
|
It preserves opaque native values, including logging streams. Native logged errors
|
|
361
|
-
retain upstream behavior
|
|
362
|
-
|
|
362
|
+
retain upstream behavior outside `fail_on_yamlconf_errors()`. Wrap native loading,
|
|
363
|
+
expansion and injection in that context to turn logged errors into
|
|
364
|
+
`ImproperlyConfigured` with the native message. Warnings keep their normal
|
|
365
|
+
behavior. The scope enables `django_yamlconf` ERROR records even if that logger
|
|
366
|
+
was disabled or inherited a higher logging threshold, then restores its original
|
|
367
|
+
level and disabled flag and removes the temporary handler on exit. Nested scopes
|
|
368
|
+
restore the enclosing scope. If process-wide `logging.disable` suppresses ERROR,
|
|
369
|
+
the context refuses entry with `ImproperlyConfigured` rather than change logging
|
|
370
|
+
for unrelated loggers. App contributions use this same strict context.
|
|
363
371
|
|
|
364
372
|
Pass the resulting `_YAMLCONF_ATTRIBUTES` unchanged in the settings namespace.
|
|
365
373
|
`configure()` owns structural-setting identification and rejects direct, historical
|
|
@@ -29,12 +29,12 @@ retain fields, validators and helper imports after an app is disabled; use the
|
|
|
29
29
|
[migration import audit](migrations.md#disable-delete-or-uninstall) before a
|
|
30
30
|
proposed provider removal.
|
|
31
31
|
|
|
32
|
-
## Installed
|
|
32
|
+
## Installed component selection
|
|
33
33
|
|
|
34
|
-
`django_compose.
|
|
34
|
+
`django_compose.components.enabled_apps(roots, group=None)` is included in the base
|
|
35
35
|
installation. A group enables installed-distribution activation; without it,
|
|
36
36
|
only native `requires_apps` edges apply. Installing a distribution or extra never
|
|
37
|
-
by itself enables an app. See [
|
|
37
|
+
by itself enables an app. See [component selection](components.md) for package metadata
|
|
38
38
|
and native `AppConfig` examples.
|
|
39
39
|
|
|
40
40
|
## Advanced typing
|
|
@@ -43,7 +43,7 @@ The `typing` extra is unnecessary for building or running a project. Install it
|
|
|
43
43
|
in the project's environment when you want composed-model analysis:
|
|
44
44
|
|
|
45
45
|
```sh
|
|
46
|
-
python -m pip install 'django-compose[typing]==0.1.0.
|
|
46
|
+
python -m pip install 'django-compose[typing]==0.1.0.dev2'
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
The extra installs published Angee forks of mypy and django-stubs, keeping their
|
|
@@ -104,7 +104,7 @@ removal after updating the app selection and composing:
|
|
|
104
104
|
|
|
105
105
|
```sh
|
|
106
106
|
python manage.py check_migrations --imports
|
|
107
|
-
python manage.py check_migrations --imports --removing old-
|
|
107
|
+
python manage.py check_migrations --imports --removing old-component historical-fields
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
The second command refuses a named distribution that provides an enabled app or
|
|
@@ -172,23 +172,28 @@ data cutovers as reviewed migrations.
|
|
|
172
172
|
`retire_history <label>` is an explicit cutoff for a history-only app. It requires
|
|
173
173
|
consistent, fully applied history across the configured databases selected by
|
|
174
174
|
Django routers, and no retained migrations in another app depending on the
|
|
175
|
-
retired nodes.
|
|
176
|
-
|
|
175
|
+
retired nodes. The database scope includes historical and transient model routes,
|
|
176
|
+
`RunSQL`/`RunPython` hints and nested database operations. Custom operations whose
|
|
177
|
+
routes cannot be inferred require every configured alias. Rebase or squash
|
|
178
|
+
incoming dependencies first. Databases absent from the command's settings are
|
|
179
|
+
outside that proof.
|
|
177
180
|
|
|
178
181
|
Its optional `--purge` authors and applies a final native deletion migration
|
|
179
|
-
across the same database scope before retirement.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
across the same database scope before retirement. It refuses deletion of tables
|
|
183
|
+
still owned by active models before authoring or applying changes. A failed
|
|
184
|
+
application retains that migration for retry and does not mark retirement
|
|
185
|
+
complete. Successful retirement updates the build record under the normal writer
|
|
186
|
+
lock; the next compose removes the history-only configuration. Removing the
|
|
187
|
+
retired migration package from version control is a separate coordinated cutoff
|
|
188
|
+
decision.
|
|
184
189
|
|
|
185
190
|
`reset_migration_history` replaces an explicitly selected, fully applied,
|
|
186
191
|
model-clean history with fresh initial migrations. It refuses unsafe cross-app
|
|
187
|
-
or multi-database scope, uses transactional recorder updates, and restores
|
|
188
|
-
if authoring or recording fails. Remove completed transition
|
|
189
|
-
a declaration that would rebind is refused. Read the command's
|
|
190
|
-
review its scope before use. Neither operation is part of ordinary
|
|
191
|
-
build cleanup or deployment.
|
|
192
|
+
or multi-database scope, uses transactional recorder updates, and restores file
|
|
193
|
+
bytes and modes if authoring or recording fails. Remove completed transition
|
|
194
|
+
declarations first; a declaration that would rebind is refused. Read the command's
|
|
195
|
+
`--help` and review its scope before use. Neither operation is part of ordinary
|
|
196
|
+
development, build cleanup or deployment.
|
|
192
197
|
|
|
193
198
|
A fresh clone may retain only the generated package's durable migration history.
|
|
194
199
|
The [first-compose scaffold contract](SPEC.md#generated-output-and-freshness)
|