django-compose 0.1.0.dev2__tar.gz → 0.1.0.dev5__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.dev2 → django_compose-0.1.0.dev5}/CHANGELOG.md +32 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/CONTRIBUTING.md +2 -1
- django_compose-0.1.0.dev5/PKG-INFO +98 -0
- django_compose-0.1.0.dev5/README.md +76 -0
- django_compose-0.1.0.dev5/docs/README.md +99 -0
- django_compose-0.1.0.dev5/docs/ROADMAP.md +17 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/docs/SPEC.md +120 -71
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/docs/components.md +38 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/docs/configuration.md +60 -47
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/docs/dependencies.md +19 -1
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/docs/extensions.md +4 -1
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/docs/migrations.md +30 -6
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/docs/models.md +5 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/docs/packaging.md +14 -5
- django_compose-0.1.0.dev5/docs/proposals/0001-native-url-collisions.md +25 -0
- django_compose-0.1.0.dev5/docs/proposals/0002-supplied-distribution-metadata.md +24 -0
- django_compose-0.1.0.dev5/docs/quickstart.md +95 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/pyproject.toml +1 -1
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/scripts/check_distribution.py +46 -13
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/artifacts.py +6 -6
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/build.py +1 -1
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/components.py +39 -14
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/management/__init__.py +1 -1
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/migration_imports.py +5 -9
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/migrations.py +189 -24
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/model_composition.py +21 -12
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/serving.py +1 -1
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/snapshot.py +2 -2
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/sources.py +20 -12
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/typing.py +120 -10
- django_compose-0.1.0.dev5/src/django_compose/urls.py +79 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_artifacts.py +86 -1
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_bootstrap.py +45 -2
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_components.py +201 -2
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_history.py +43 -1
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_integrations.py +100 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_launcher.py +24 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_migration_imports.py +20 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_migrations_guards.py +393 -0
- django_compose-0.1.0.dev5/tests/test_migrations_postgres.py +198 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_provision_postgres.py +8 -3
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_snapshot.py +50 -1
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_sources.py +33 -3
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_typing.py +166 -0
- django_compose-0.1.0.dev5/tests/test_urls.py +285 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/uv.lock +1 -1
- django_compose-0.1.0.dev2/PKG-INFO +0 -111
- django_compose-0.1.0.dev2/README.md +0 -89
- django_compose-0.1.0.dev2/docs/README.md +0 -36
- django_compose-0.1.0.dev2/docs/ROADMAP.md +0 -28
- django_compose-0.1.0.dev2/docs/quickstart.md +0 -180
- django_compose-0.1.0.dev2/src/django_compose/urls.py +0 -58
- django_compose-0.1.0.dev2/tests/test_urls.py +0 -59
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/.gitignore +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/AGENTS.md +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/COPYING +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/LICENSE +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/Makefile +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/NOTICE +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/docs/proposals/README.md +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/docs/provisioning.md +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/.gitignore +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/README.md +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/catalog/__init__.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/catalog/apps.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/catalog/autoconfig.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/catalog/integrations.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/catalog/management/__init__.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/catalog/management/commands/__init__.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/catalog/management/commands/verify_context.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/catalog/models.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/catalog/pyproject.toml +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/catalog/schema.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/catalog/transport.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/catalog/urls.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/contexts.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/manage.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/reviews/__init__.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/reviews/apps.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/reviews/autoconfig.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/reviews/models.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/reviews/pyproject.toml +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/settings.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/urls.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/examples/shop/verify.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/__init__.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/__main__.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/apps.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/asgi.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/autoreload.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/checks.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/cli.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/conf.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/declarations.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/history.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/management/commands/__init__.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/management/commands/check_migrations.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/management/commands/compose.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/management/commands/makemigrations.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/management/commands/migrate.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/management/commands/provision.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/management/commands/reset_migration_history.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/management/commands/retire_history.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/models.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/provision.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/py.typed +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/src/django_compose/rendering.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/core_fixtures/__init__.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_asgi.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_autoreload.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_boundaries.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_command_context.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_conf.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_initial_history.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_migration_scaffold.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_migrations.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_models.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_provision.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/test_startup.py +0 -0
- {django_compose-0.1.0.dev2 → django_compose-0.1.0.dev5}/tests/typing_fixtures/__init__.py +0 -0
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0.dev5
|
|
4
|
+
|
|
5
|
+
- Respect Django's swapped-model storage semantics when guarding migrations, so
|
|
6
|
+
projects with a custom user model can create migrations and provision normally.
|
|
7
|
+
|
|
8
|
+
## 0.1.0.dev4 — not published
|
|
9
|
+
|
|
10
|
+
The immutable tag is retained; these changes are included in dev5.
|
|
11
|
+
|
|
12
|
+
- Avoid distribution ownership scans for module-path lookups and reuse each exact
|
|
13
|
+
native app configuration within one dependency selection.
|
|
14
|
+
|
|
15
|
+
## 0.1.0.dev3
|
|
16
|
+
|
|
17
|
+
- Reorganize documentation around the project workflow, public APIs and app hooks,
|
|
18
|
+
with a shorter introduction and quick start.
|
|
19
|
+
- Expose `index_components(distributions, *, group)` for prepared native package
|
|
20
|
+
metadata; installed discovery delegates to the same validation and index.
|
|
21
|
+
- Protect quoted and schema-qualified migration storage, including implicit
|
|
22
|
+
many-to-many tables, using native eligibility and per-database ownership checks.
|
|
23
|
+
Keep reusable transition planning database-free.
|
|
24
|
+
- Reject integration literals that overwrite Django's generated parent links
|
|
25
|
+
before artifact hooks or ready callbacks run.
|
|
26
|
+
- Project effective extension member reads and calls through native MRO and
|
|
27
|
+
mypy member access while preserving authored-body and override diagnostics.
|
|
28
|
+
- Create new generated files with ordinary umask-filtered permissions while
|
|
29
|
+
preserving existing or explicit modes during atomic replacement.
|
|
30
|
+
- Diagnose identical native URL matching chains without rejecting disjoint
|
|
31
|
+
custom converters merely because they share a regex.
|
|
32
|
+
- Reuse packaging's distribution-name normalization and document Unix platform
|
|
33
|
+
requirements and the remaining property-setter typing limitation.
|
|
34
|
+
|
|
3
35
|
## 0.1.0.dev2
|
|
4
36
|
|
|
5
37
|
- Use component vocabulary for installed distributions, keeping distribution and
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Contributing
|
|
2
2
|
|
|
3
|
-
Use Python 3.14
|
|
3
|
+
Use Python 3.14 on a [supported platform](docs/dependencies.md#supported-platforms).
|
|
4
|
+
Read [AGENTS.md](AGENTS.md), the
|
|
4
5
|
[documentation index](docs/README.md), and the [specification](docs/SPEC.md) for the
|
|
5
6
|
area you change. This is an independent Django library: reproduce behavior in a
|
|
6
7
|
plain Django project, without requiring a downstream framework or live deployment.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: django-compose
|
|
3
|
+
Version: 0.1.0.dev5
|
|
4
|
+
Summary: Compose reusable Django apps into a runnable project.
|
|
5
|
+
Project-URL: Source, https://github.com/ang-ee/django-compose
|
|
6
|
+
Project-URL: Documentation, https://github.com/ang-ee/django-compose/tree/main/docs
|
|
7
|
+
Project-URL: Issues, https://github.com/ang-ee/django-compose/issues
|
|
8
|
+
Author-email: "Angee, Inc." <hi@angee.ai>
|
|
9
|
+
License-Expression: LGPL-3.0-or-later
|
|
10
|
+
License-File: COPYING
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Requires-Python: >=3.14
|
|
14
|
+
Requires-Dist: django-yamlconf>=1.5
|
|
15
|
+
Requires-Dist: django<6.2,>=6.1.2
|
|
16
|
+
Requires-Dist: packaging>=26
|
|
17
|
+
Provides-Extra: typing
|
|
18
|
+
Requires-Dist: angee-django-stubs-ext==6.1.2; extra == 'typing'
|
|
19
|
+
Requires-Dist: angee-django-stubs[compatible-mypy]==6.1.2.post3; extra == 'typing'
|
|
20
|
+
Requires-Dist: angee-mypy==2.1.0; extra == 'typing'
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# django-compose
|
|
24
|
+
|
|
25
|
+
Compose reusable Django apps into a runnable project.
|
|
26
|
+
|
|
27
|
+
django-compose resolves the apps selected by your project's `INSTALLED_APPS`,
|
|
28
|
+
combines their model declarations and settings contributions, and generates
|
|
29
|
+
ordinary Django models and app configurations before startup.
|
|
30
|
+
|
|
31
|
+
Use it when several projects share reusable apps but need different combinations
|
|
32
|
+
of fields and behavior. You author the project settings and launcher; Django
|
|
33
|
+
continues to own the app registry, ORM, managers, querysets and migrations.
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
installed apps + project settings → compose → generated Django package
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## What it provides
|
|
40
|
+
|
|
41
|
+
- **App selection:** expand explicit roots through declared app dependencies and
|
|
42
|
+
optional installed-package metadata.
|
|
43
|
+
- **Model composition:** add fields and methods to another app's model, create
|
|
44
|
+
concrete models, or declare native multi-table inheritance.
|
|
45
|
+
- **Project configuration:** combine app settings and optionally collect URL,
|
|
46
|
+
ASGI and database-preparation contributions.
|
|
47
|
+
- **Build output:** generate model/configuration modules and declared artifacts;
|
|
48
|
+
verify that they match the selected inputs before serving.
|
|
49
|
+
|
|
50
|
+
Packages remain installed at runtime because generated classes import their
|
|
51
|
+
source declarations. `compose` writes files; Django's migration commands change
|
|
52
|
+
the database.
|
|
53
|
+
|
|
54
|
+
## One model, two apps
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
# catalog/models.py
|
|
58
|
+
from django.db import models
|
|
59
|
+
from django_compose.models import Composable
|
|
60
|
+
|
|
61
|
+
class Item(Composable, concrete=True):
|
|
62
|
+
title = models.CharField(max_length=100)
|
|
63
|
+
|
|
64
|
+
class Meta:
|
|
65
|
+
abstract = True
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
# reviews/models.py
|
|
70
|
+
from django.db import models
|
|
71
|
+
from django_compose.models import Composable
|
|
72
|
+
|
|
73
|
+
class Rating(Composable, extends="catalog.Item"):
|
|
74
|
+
rating = models.PositiveSmallIntegerField(default=0)
|
|
75
|
+
|
|
76
|
+
class Meta:
|
|
77
|
+
abstract = True
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
With both apps selected, the generated `catalog.Item` has `title` and `rating` in
|
|
81
|
+
one table. `Rating` adds no table of its own. After composition, migrations and
|
|
82
|
+
Django setup, use `apps.get_model("catalog", "Item")` to obtain the concrete model.
|
|
83
|
+
The [model guide](https://github.com/ang-ee/django-compose/blob/main/docs/models.md)
|
|
84
|
+
explains all four declaration keywords and lazy relations.
|
|
85
|
+
|
|
86
|
+
## Get started
|
|
87
|
+
|
|
88
|
+
This is a development preview. See [compatibility and platform requirements](https://github.com/ang-ee/django-compose/blob/main/docs/dependencies.md)
|
|
89
|
+
and [installation](https://github.com/ang-ee/django-compose/blob/main/docs/packaging.md).
|
|
90
|
+
|
|
91
|
+
1. [Run the quick start](https://github.com/ang-ee/django-compose/blob/main/docs/quickstart.md)
|
|
92
|
+
to compose the checked-in SQLite project and query the result.
|
|
93
|
+
2. [Configure your project](https://github.com/ang-ee/django-compose/blob/main/docs/configuration.md)
|
|
94
|
+
with `configure(globals())` and the command launcher.
|
|
95
|
+
3. [Browse the APIs](https://github.com/ang-ee/django-compose/blob/main/docs/README.md)
|
|
96
|
+
for commands, Python entry points and app extension hooks.
|
|
97
|
+
|
|
98
|
+
Licensed under [LGPL-3.0-or-later](https://github.com/ang-ee/django-compose/blob/main/LICENSE).
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# django-compose
|
|
2
|
+
|
|
3
|
+
Compose reusable Django apps into a runnable project.
|
|
4
|
+
|
|
5
|
+
django-compose resolves the apps selected by your project's `INSTALLED_APPS`,
|
|
6
|
+
combines their model declarations and settings contributions, and generates
|
|
7
|
+
ordinary Django models and app configurations before startup.
|
|
8
|
+
|
|
9
|
+
Use it when several projects share reusable apps but need different combinations
|
|
10
|
+
of fields and behavior. You author the project settings and launcher; Django
|
|
11
|
+
continues to own the app registry, ORM, managers, querysets and migrations.
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
installed apps + project settings → compose → generated Django package
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## What it provides
|
|
18
|
+
|
|
19
|
+
- **App selection:** expand explicit roots through declared app dependencies and
|
|
20
|
+
optional installed-package metadata.
|
|
21
|
+
- **Model composition:** add fields and methods to another app's model, create
|
|
22
|
+
concrete models, or declare native multi-table inheritance.
|
|
23
|
+
- **Project configuration:** combine app settings and optionally collect URL,
|
|
24
|
+
ASGI and database-preparation contributions.
|
|
25
|
+
- **Build output:** generate model/configuration modules and declared artifacts;
|
|
26
|
+
verify that they match the selected inputs before serving.
|
|
27
|
+
|
|
28
|
+
Packages remain installed at runtime because generated classes import their
|
|
29
|
+
source declarations. `compose` writes files; Django's migration commands change
|
|
30
|
+
the database.
|
|
31
|
+
|
|
32
|
+
## One model, two apps
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
# catalog/models.py
|
|
36
|
+
from django.db import models
|
|
37
|
+
from django_compose.models import Composable
|
|
38
|
+
|
|
39
|
+
class Item(Composable, concrete=True):
|
|
40
|
+
title = models.CharField(max_length=100)
|
|
41
|
+
|
|
42
|
+
class Meta:
|
|
43
|
+
abstract = True
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
# reviews/models.py
|
|
48
|
+
from django.db import models
|
|
49
|
+
from django_compose.models import Composable
|
|
50
|
+
|
|
51
|
+
class Rating(Composable, extends="catalog.Item"):
|
|
52
|
+
rating = models.PositiveSmallIntegerField(default=0)
|
|
53
|
+
|
|
54
|
+
class Meta:
|
|
55
|
+
abstract = True
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
With both apps selected, the generated `catalog.Item` has `title` and `rating` in
|
|
59
|
+
one table. `Rating` adds no table of its own. After composition, migrations and
|
|
60
|
+
Django setup, use `apps.get_model("catalog", "Item")` to obtain the concrete model.
|
|
61
|
+
The [model guide](https://github.com/ang-ee/django-compose/blob/main/docs/models.md)
|
|
62
|
+
explains all four declaration keywords and lazy relations.
|
|
63
|
+
|
|
64
|
+
## Get started
|
|
65
|
+
|
|
66
|
+
This is a development preview. See [compatibility and platform requirements](https://github.com/ang-ee/django-compose/blob/main/docs/dependencies.md)
|
|
67
|
+
and [installation](https://github.com/ang-ee/django-compose/blob/main/docs/packaging.md).
|
|
68
|
+
|
|
69
|
+
1. [Run the quick start](https://github.com/ang-ee/django-compose/blob/main/docs/quickstart.md)
|
|
70
|
+
to compose the checked-in SQLite project and query the result.
|
|
71
|
+
2. [Configure your project](https://github.com/ang-ee/django-compose/blob/main/docs/configuration.md)
|
|
72
|
+
with `configure(globals())` and the command launcher.
|
|
73
|
+
3. [Browse the APIs](https://github.com/ang-ee/django-compose/blob/main/docs/README.md)
|
|
74
|
+
for commands, Python entry points and app extension hooks.
|
|
75
|
+
|
|
76
|
+
Licensed under [LGPL-3.0-or-later](https://github.com/ang-ee/django-compose/blob/main/LICENSE).
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# django-compose: usage and APIs
|
|
2
|
+
|
|
3
|
+
django-compose builds the generated part of a Django project from the reusable
|
|
4
|
+
apps you select. Apps contribute abstract model declarations, settings and
|
|
5
|
+
optional hooks; the result uses Django's ordinary registry, ORM and migrations.
|
|
6
|
+
|
|
7
|
+
Start with the [quick start](quickstart.md), then [configure your own project](configuration.md).
|
|
8
|
+
These docs follow this checkout. Use a [local installation](packaging.md#install-locally)
|
|
9
|
+
for changes marked **Unreleased** in the [changelog](../CHANGELOG.md).
|
|
10
|
+
|
|
11
|
+
## The workflow
|
|
12
|
+
|
|
13
|
+
1. Install the app packages and declare root apps in `INSTALLED_APPS`.
|
|
14
|
+
2. Call `configure(globals())` at the end of the project's settings.
|
|
15
|
+
3. Run `compose` to generate models, app configurations and declared artifacts.
|
|
16
|
+
4. Author and apply Django migrations, then run the project with that output.
|
|
17
|
+
|
|
18
|
+
Installing a package does not enable it. Source packages remain runtime
|
|
19
|
+
dependencies. Generated files can be rebuilt; migration files are durable
|
|
20
|
+
project history.
|
|
21
|
+
|
|
22
|
+
## Commands
|
|
23
|
+
|
|
24
|
+
Use the [django-compose launcher](configuration.md#managepy) in `manage.py`.
|
|
25
|
+
|
|
26
|
+
| Command | Purpose | Guide |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| `compose` | Generate output; `--check` verifies it and native history without writes; `--if-stale` skips generation when output is current | [Build lifecycle](SPEC.md#setup-lifecycle) |
|
|
29
|
+
| `makemigrations`, `migrate` | Author and apply ordinary Django migration history | [Migrations](migrations.md) |
|
|
30
|
+
| `runserver` | Recompose before Django's development-server reloads | [Development](configuration.md#serve-the-project) |
|
|
31
|
+
| `provision` | Apply migrations and optional app hooks; `--check` verifies readiness | [Provisioning](provisioning.md) |
|
|
32
|
+
| `check_migrations` | Compare model/history state; `--imports` audits retained Python dependencies | [History checks](migrations.md#disable-delete-or-uninstall) |
|
|
33
|
+
| `retire_history`, `reset_migration_history` | Perform explicit, guarded history maintenance | [Advanced migrations](migrations.md#advanced-destructive-changes-and-history-cutoffs) |
|
|
34
|
+
|
|
35
|
+
`django-compose inspect-apps [--group GROUP] APP_ENTRY ...` is a separate,
|
|
36
|
+
settings-free command. It prints the resolved selection as JSON; see
|
|
37
|
+
[inspection](components.md#inspect-a-selection-from-a-running-application).
|
|
38
|
+
|
|
39
|
+
## Python entry points
|
|
40
|
+
|
|
41
|
+
Import these from the indicated `django_compose` module. Detailed contracts,
|
|
42
|
+
validation and lifecycle rules live in the [API reference](SPEC.md).
|
|
43
|
+
|
|
44
|
+
| Module and API | Use it to |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `conf.configure(namespace)` | Configure a composed project, normally with `globals()` at the end of settings |
|
|
47
|
+
| `management.execute(argv=None)` | Dispatch management commands with composition selected before settings load |
|
|
48
|
+
| `models.Composable` | Declare abstract source models and extensions using the keywords below |
|
|
49
|
+
| `components.enabled_apps(roots, *, group=None)` | Resolve app dependencies into an immutable `Closure`; reads no project settings |
|
|
50
|
+
| `components.inspect_apps(roots, *, group=None, timeout=30.0)` | Resolve a selection in a fresh interpreter and return JSON-compatible `AppSelection` data |
|
|
51
|
+
| `components.installed_components(group)` | Index installed native package metadata without importing apps |
|
|
52
|
+
| `components.index_components(distributions, *, group)` | Apply the same indexing rules to supplied native `Distribution` objects |
|
|
53
|
+
| `components.active_requirements(requirements)` | Return native `Requirement` values active on this platform with `extra=""` |
|
|
54
|
+
| `conf.apply_app_settings(namespace, closure)` | Apply app settings to a project using ordinary authored concrete models |
|
|
55
|
+
| `provision.require_provisioned(using="default", timeout=0)` | Require recorded database readiness for the verified build |
|
|
56
|
+
| `serving.artifact_path(relative)` | Locate and verify a generated artifact |
|
|
57
|
+
| `serving.receipt_lease()` / `verified_receipt()` | Hold a shared build-record lease / read the startup-verified record |
|
|
58
|
+
|
|
59
|
+
Package indexing reads metadata; app selection imports native app/config modules.
|
|
60
|
+
Neither installs dependencies. See [components](components.md) for complete usage.
|
|
61
|
+
The optional [typing plugin](dependencies.md#advanced-typing) supplies composed-model
|
|
62
|
+
analysis through `django_compose.typing`.
|
|
63
|
+
|
|
64
|
+
## Model declaration keywords
|
|
65
|
+
|
|
66
|
+
Each declaration remains a Django abstract model: set `Meta.abstract = True`.
|
|
67
|
+
Targets use `app_label.Model` strings.
|
|
68
|
+
|
|
69
|
+
| Keyword | Generated result |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `concrete=True` | A concrete model with its own identity and table |
|
|
72
|
+
| `extends="catalog.Item"` | Fields and behavior contributed to that model; no separate table |
|
|
73
|
+
| `inherits="catalog.Item"` | A concrete child using Django multi-table inheritance; concrete is implied |
|
|
74
|
+
| `demands="catalog.Item"` | A constraint requiring every concrete descendant to have that ancestor |
|
|
75
|
+
|
|
76
|
+
`concrete`, `extends` and `inherits` are mutually exclusive. Only `demands`
|
|
77
|
+
propagates through abstract bases. See [model declarations](models.md) for examples.
|
|
78
|
+
|
|
79
|
+
## App extension hooks
|
|
80
|
+
|
|
81
|
+
| Declaration | Contribution | Guide |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| `AppConfig.requires_apps` | Additional native app dependencies | [Selection](components.md#dependency-and-configuration-rules) |
|
|
84
|
+
| `autoconfig.py`: `SETTINGS`, `settings(namespace)` | Defaults and additive settings | [Configuration](configuration.md#app-settings-contributions) |
|
|
85
|
+
| `AppConfig.compose_urls` with optional prefix/namespace | Native URLconf contributions through `django_compose.urls` | [URLs](configuration.md#compose-app-urls) |
|
|
86
|
+
| `AppConfig.compose_asgi()` → `AsgiContribution` | HTTP mounts, protocols and lifespans through `django_compose.asgi.application` | [Serving](SPEC.md#serving-composition) |
|
|
87
|
+
| `AppConfig.compose_provision(context)` | Database preparation after migrations | [Provisioning](provisioning.md) |
|
|
88
|
+
| Classes in `COMPOSE_INTEGRATIONS` | Literal model metadata, generated artifacts or explicit migration-policy exemptions | [Integrations](extensions.md#supported-protocols) |
|
|
89
|
+
| `compose_migrations/` | Reusable native migration transitions | [Transitions](migrations.md#advanced-reusable-transitions) |
|
|
90
|
+
|
|
91
|
+
URL and ASGI composition require completed Django setup. Integrations implement
|
|
92
|
+
`ModelDeclarationHook`, `ArtifactHook` or `MigrationPolicy` from
|
|
93
|
+
`django_compose.declarations`; ordinary model behavior belongs in model bases.
|
|
94
|
+
|
|
95
|
+
## Reference and operations
|
|
96
|
+
|
|
97
|
+
[Detailed API contracts](SPEC.md) · [Deployment](packaging.md) ·
|
|
98
|
+
[Compatibility and typing](dependencies.md) · [Open work](ROADMAP.md) ·
|
|
99
|
+
[Contributing](../CONTRIBUTING.md)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Current scope and open work
|
|
2
|
+
|
|
3
|
+
The [API guide](README.md) describes what is available; the
|
|
4
|
+
[reference](SPEC.md) defines its contracts. Release changes belong in the
|
|
5
|
+
[changelog](../CHANGELOG.md).
|
|
6
|
+
|
|
7
|
+
Current boundaries and remaining verification:
|
|
8
|
+
|
|
9
|
+
- Component selection supports one Django app per participating distribution;
|
|
10
|
+
app-less and multi-app components are outside that contract. See [components](components.md).
|
|
11
|
+
- Python, Django, platform and typing support follow the [compatibility guide](dependencies.md),
|
|
12
|
+
including the known property-setter typing limitation.
|
|
13
|
+
- StatReloader edit, failure/recovery and file creation/deletion checks have run.
|
|
14
|
+
Watchman adapter tests cover the same declarations; acceptance against a native
|
|
15
|
+
Watchman daemon remains outstanding.
|
|
16
|
+
|
|
17
|
+
Changes to a public contract use the [proposal process](proposals/README.md).
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
# API reference
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[
|
|
1
|
+
# Detailed API reference
|
|
2
|
+
|
|
3
|
+
This is the current contract for django-compose. For a compact map of commands,
|
|
4
|
+
Python entry points and app hooks, start with the [API guide](README.md).
|
|
5
|
+
For runnable examples, use the [quick start](quickstart.md) and
|
|
6
|
+
[project configuration](configuration.md). [Compatibility](dependencies.md)
|
|
7
|
+
defines supported versions and platforms.
|
|
8
|
+
|
|
9
|
+
- [Terms](#terms)
|
|
10
|
+
- [Model declarations](#model-declarations)
|
|
11
|
+
- [Application selection](#application-selection)
|
|
12
|
+
- [Package metadata](#package-metadata)
|
|
13
|
+
- [Settings and snapshots](#settings-and-snapshots)
|
|
14
|
+
- [Setup lifecycle](#setup-lifecycle)
|
|
15
|
+
- [Integration protocols](#integration-protocols)
|
|
16
|
+
- [Generated output and freshness](#generated-output-and-freshness)
|
|
17
|
+
- [Artifact access](#artifact-access)
|
|
18
|
+
- [Native history and transitions](#native-history-and-transitions)
|
|
19
|
+
- [Database preparation and readiness](#database-preparation-and-readiness)
|
|
20
|
+
- [Serving composition](#serving-composition)
|
|
21
|
+
- [Typing and import boundaries](#typing-and-import-boundaries)
|
|
12
22
|
|
|
13
23
|
## Terms
|
|
14
24
|
|
|
@@ -17,8 +27,8 @@ to wire your own project. Planned APIs are described separately in
|
|
|
17
27
|
a selected source model; the composition-query API calls it a *donor*.
|
|
18
28
|
- A **generated model** is the concrete Django class emitted into the project's
|
|
19
29
|
generated package. Application code obtains it through Django's app registry.
|
|
20
|
-
- A **root app** is a project-authored `INSTALLED_APPS` entry. A **component** is
|
|
21
|
-
|
|
30
|
+
- A **root app** is a project-authored `INSTALLED_APPS` entry. A **component** is a
|
|
31
|
+
Python distribution participating in the optional selection group.
|
|
22
32
|
Each component currently provides one Django app. Distribution names, Python
|
|
23
33
|
import paths and native app identities remain distinct.
|
|
24
34
|
- A **snapshot** is the immutable set of composition inputs and their digest.
|
|
@@ -62,7 +72,9 @@ native method-resolution order. Shared abstract ancestry contributes once. The
|
|
|
62
72
|
first extension manager overrides a source manager; distinct extensions
|
|
63
73
|
claiming one manager name fail. Field-name, attname, same-table database-column,
|
|
64
74
|
field/manager and parent-field redeclaration collisions fail. Native generated
|
|
65
|
-
metadata also checks inherited and automatically created managers
|
|
75
|
+
metadata also checks inherited and automatically created managers and refuses
|
|
76
|
+
integration literals that replace structural fields, including implicit MTI
|
|
77
|
+
parent links and their attnames, before artifact hooks or ready callbacks.
|
|
66
78
|
Unknown targets,
|
|
67
79
|
parent or module dependency cycles, and unmet ancestor demands fail explicitly.
|
|
68
80
|
|
|
@@ -94,6 +106,7 @@ root app names, and `required: frozenset[str]` of dependency-only app names.
|
|
|
94
106
|
`components: Mapping[str, str]` maps selected canonical distribution names to
|
|
95
107
|
their native app names. `dependencies` maps selected native app names to ordered
|
|
96
108
|
direct dependency app names. These mappings are immutable.
|
|
109
|
+
Each exact app/config entry is resolved once per call; later calls resolve afresh.
|
|
97
110
|
|
|
98
111
|
Each participating distribution declares exactly one group entry point, keyed
|
|
99
112
|
by native `AppConfig.name`, whose value is a native app/config string. Active
|
|
@@ -139,24 +152,24 @@ stdout. A reserved response descriptor carries only JSON; malformed or empty
|
|
|
139
152
|
responses raise `ImproperlyConfigured`. Selection failures exit with status 1.
|
|
140
153
|
This is a standalone command, not a Django management command.
|
|
141
154
|
|
|
142
|
-
##
|
|
143
|
-
|
|
144
|
-
`
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
`
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
`
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
## Package metadata
|
|
156
|
+
|
|
157
|
+
`components.index_components(distributions, *, group) -> InstalledComponents`
|
|
158
|
+
validates an iterable of native `importlib.metadata.Distribution` objects without
|
|
159
|
+
importing app modules or loading entry points. Prepared source metadata may use
|
|
160
|
+
native `Distribution.at(path)` / `PathDistribution`; preparation is caller-owned.
|
|
161
|
+
Each participating distribution declares exactly one group entry point. Duplicate
|
|
162
|
+
canonical distribution names and competing declared app keys fail explicitly.
|
|
163
|
+
Its read-only `distributions`, `entry_points` and `providers` maps retain native
|
|
164
|
+
objects, with canonical distribution-name and declared app-key indexes. Libraries
|
|
165
|
+
without group entries remain in `distributions`; indexing neither activates apps
|
|
166
|
+
nor checks importability, actual AppConfig identity or installed dependencies.
|
|
167
|
+
|
|
168
|
+
`components.installed_components(group)` selects each canonical installed name's
|
|
169
|
+
native `metadata.distribution()` winner, then delegates to that same index owner.
|
|
170
|
+
`active_requirements(iterable_of_strings)` and the index method
|
|
171
|
+
`active_requirements(provider)` return native Requirement values active with
|
|
172
|
+
`extra=""`. Metadata inspection does not activate apps.
|
|
160
173
|
|
|
161
174
|
## Settings and snapshots
|
|
162
175
|
|
|
@@ -263,12 +276,13 @@ the namespace. Deployment secrets are excluded unless deliberately named.
|
|
|
263
276
|
Default exclusions can be replaced and prune the default Python walk. Explicit
|
|
264
277
|
extra globs include matching files even beneath excluded directories. Other
|
|
265
278
|
subdirectories, including any directory named `web`, are ordinary source inputs.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
279
|
+
`SourceResolver` locates modules through native path finders over selected app
|
|
280
|
+
directories and then `sys.path`, without executing parent packages. Path-only
|
|
281
|
+
lookups for fingerprints, serving and reload inputs do not inspect distribution
|
|
282
|
+
metadata. Migration import audits additionally determine providers through exact
|
|
283
|
+
RECORD or PEP 610 ownership, with one lazy index per audit. Native app/config
|
|
284
|
+
modules are imported to select configurations and must remain safe before Django
|
|
285
|
+
setup. Snapshot and serving do not import the model compiler or execute integrations.
|
|
272
286
|
|
|
273
287
|
Without `COMPOSE_TRANSITION_SOURCE`, each selected app contributes sorted
|
|
274
288
|
`compose_migrations/<label>/<name>.py` files in app order, including numeric
|
|
@@ -409,7 +423,9 @@ A retry retains ownership of files written by an interrupted build.
|
|
|
409
423
|
A failed build remains `IN_PROGRESS`; reverting source bytes does not revive it.
|
|
410
424
|
Stale cleanup removes only previously recorded generated paths. Normal build
|
|
411
425
|
and clean preserve migration directories and unowned files, and refuse foreign
|
|
412
|
-
or symlinked trees.
|
|
426
|
+
or symlinked trees. Atomic publication uses the
|
|
427
|
+
[file-permission policy](packaging.md#prepare-the-application-artifact) for new
|
|
428
|
+
and existing files. First composition also admits a migration-only scaffold:
|
|
413
429
|
label directories containing native `migrations/` subtrees, with optional zero-byte
|
|
414
430
|
root/label `__init__.py` files. It preserves every history byte and file mode,
|
|
415
431
|
including disabled history graphs. Unknown files, symlinks and special files fail;
|
|
@@ -417,14 +433,22 @@ no foreign marker knowledge is required. This permits a fresh clone containing
|
|
|
417
433
|
only durable reviewed migration history to compose before serving. Check mode neither creates output nor changes
|
|
418
434
|
existing bytes. Preserve native history as explained in [packaging](packaging.md).
|
|
419
435
|
|
|
436
|
+
## Artifact access
|
|
437
|
+
|
|
438
|
+
`serving.verified_receipt()` returns the process startup receipt;
|
|
439
|
+
`serving.artifact_path(relative)` validates receipt ownership, safe
|
|
440
|
+
path and current hash before returning a Path. During build-ready callbacks it
|
|
441
|
+
supports models-phase artifacts before final publication.
|
|
442
|
+
|
|
420
443
|
## Native history and transitions
|
|
421
444
|
|
|
422
445
|
For generated labels, history defaults to `<output_module>.<label>.migrations`.
|
|
423
446
|
`serving.migration_modules(authored, receipt, output_module)` derives retained
|
|
424
447
|
defaults from the record, then applies authored overrides, including `None`.
|
|
425
448
|
`HISTORY_LABELS` retains model labels, previous history, on-disk migration
|
|
426
|
-
packages and transition targets, minus `RETIRED_LABELS`. History-only configs
|
|
427
|
-
|
|
449
|
+
packages and transition targets, minus `RETIRED_LABELS`. History-only configs use
|
|
450
|
+
`django_compose.history.History_<label>`, generated dynamically from retained
|
|
451
|
+
receipt facts; they load no old source models or app lifecycle.
|
|
428
452
|
|
|
429
453
|
Django owns migration detection, graphs, state, execution, recording and routers.
|
|
430
454
|
`effective_states(loader, registry, purge=...)` preserves history-only models in
|
|
@@ -456,9 +480,19 @@ historical adoption; new metadata uses `compose_origin` and
|
|
|
456
480
|
`compose_source_sha256`.
|
|
457
481
|
|
|
458
482
|
`DropGuardAutodetector`, shared by native `makemigrations` and `migrate`, requires
|
|
459
|
-
relevant rows or columns to be empty on every
|
|
460
|
-
destructive changes.
|
|
461
|
-
|
|
483
|
+
relevant rows or columns to be empty on every database eligible for the native
|
|
484
|
+
operation before automatic destructive changes. Eligibility includes native
|
|
485
|
+
model options and routers. Shared-table protection is per alias and includes
|
|
486
|
+
implicit many-to-many storage deleted with its owning model or field. Quoted identifiers
|
|
487
|
+
are resolved through backend semantics; unsupported or uncertain storage identity
|
|
488
|
+
and unavailable eligible databases cannot prove safety. Explicit integration-owned
|
|
489
|
+
row exemptions use `MigrationPolicy`. See the [storage proof's supported cases
|
|
490
|
+
and limits](migrations.md#advanced-destructive-changes-and-history-cutoffs).
|
|
491
|
+
|
|
492
|
+
Reusable transition planning remains database-free. It conservatively retains
|
|
493
|
+
feature-dependent aliases when checking the feature could connect, and refuses
|
|
494
|
+
ambiguous shared storage that requires database visibility to resolve. Explicit
|
|
495
|
+
migration authoring, purge and history maintenance use database-aware checks.
|
|
462
496
|
|
|
463
497
|
Retirement requires consistent fully applied history across all configured
|
|
464
498
|
migration-relevant aliases and refuses retained incoming cross-app dependencies.
|
|
@@ -482,27 +516,37 @@ no migration operations. `--imports --removing DIST...` refuses enabled provider
|
|
|
482
516
|
retained imports, unresolved/unsupported entries and loader failures; it does not
|
|
483
517
|
uninstall anything. See [migration workflows](migrations.md).
|
|
484
518
|
|
|
485
|
-
##
|
|
519
|
+
## Database preparation and readiness
|
|
486
520
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
fork versions; ordinary serving needs neither mypy nor django-stubs.
|
|
521
|
+
`django_compose.provision` owns database preparation for a startup-verified
|
|
522
|
+
composition. The native `provision` command is registered by the existing
|
|
523
|
+
ComposeConfig and supports `--database`, `--wait-db` and read-only `--check`.
|
|
524
|
+
Compose continues to generate artifacts without database work.
|
|
492
525
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
526
|
+
Optional `AppConfig.compose_provision(context)` hooks receive an immutable
|
|
527
|
+
`ProvisionContext(database, stdout, stderr, verbosity=1)` after native migrations.
|
|
528
|
+
The context's `call()` uses native management dispatch with the selected IO;
|
|
529
|
+
each hook supplies its command's supported database option. Apps without hooks
|
|
530
|
+
require no substitute. Resource declaration/loading policy stays with the
|
|
531
|
+
selected resource-owning app.
|
|
532
|
+
|
|
533
|
+
`require_provisioned(using="default", timeout=0)` verifies the current receipt
|
|
534
|
+
under its lease and reads readiness and native migration state without repair.
|
|
535
|
+
The single private recorder, durable failure/retry boundary, PostgreSQL lock and
|
|
536
|
+
explicit `base_provision` table cutover are defined in [provisioning](provisioning.md).
|
|
499
537
|
|
|
500
|
-
## Serving composition
|
|
538
|
+
## Serving composition
|
|
501
539
|
|
|
502
540
|
After `django.setup()`, `django_compose.urls.urlpatterns` includes selected
|
|
503
541
|
configs' optional `compose_urls` modules using `compose_url_prefix` (default empty)
|
|
504
|
-
and `compose_url_namespace` (default absent).
|
|
505
|
-
|
|
542
|
+
and `compose_url_namespace` (default absent). The registered native system check
|
|
543
|
+
reports identical native matching chains as `django_compose.E001`, naming both
|
|
544
|
+
contributing apps. Chains must have the same include boundaries, native matcher
|
|
545
|
+
types, compiled regex text and flags, endpoint behavior, capture names and
|
|
546
|
+
converter instances. Reverse namespaces do not distinguish matches. Different
|
|
547
|
+
converters, differently expressed chains and custom matching implementations
|
|
548
|
+
retain Django's ordered resolution; the check neither executes converters nor
|
|
549
|
+
proves arbitrary regex equivalence or overlap.
|
|
506
550
|
|
|
507
551
|
`django_compose.asgi.application` composes optional `config.compose_asgi()` factories
|
|
508
552
|
returning `AsgiContribution(http_mounts=..., lifespans=..., protocols=...)`.
|
|
@@ -512,19 +556,24 @@ Lifespan factories enter in app order, unwind in reverse and report startup/shut
|
|
|
512
556
|
failure. HTTP and lifespan are reserved protocols; duplicate mounts or protocol
|
|
513
557
|
claims fail. These modules require completed setup and install no server policy.
|
|
514
558
|
|
|
515
|
-
|
|
516
|
-
objects without importing app modules. Its read-only `distributions`, `entry_points`
|
|
517
|
-
and `providers` maps use canonical distribution names/app keys as documented by the
|
|
518
|
-
native owner. `active_requirements(iterable_of_strings)` and the index method
|
|
519
|
-
`active_requirements(provider)` return native Requirement values active with
|
|
520
|
-
`extra=""`. Metadata inspection does not activate apps.
|
|
559
|
+
## Typing and import boundaries
|
|
521
560
|
|
|
522
|
-
`
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
561
|
+
The optional `django_compose.typing` plugin extends django-stubs inference for
|
|
562
|
+
composed fields, relations, managers, methods, properties, generics and ancestor
|
|
563
|
+
demands, while retaining native diagnostics. Effective member access follows the
|
|
564
|
+
generated class's native MRO, including an extension overriding an existing source
|
|
565
|
+
member; authored bodies and override checks retain their original signatures.
|
|
566
|
+
The [typing guide](dependencies.md#advanced-typing) documents the remaining
|
|
567
|
+
read-only-to-writable property limitation. It tracks source dependencies for
|
|
568
|
+
cold, warm and incremental analysis. Its extra pins the supported published
|
|
569
|
+
fork versions; ordinary serving needs neither mypy nor django-stubs.
|
|
570
|
+
|
|
571
|
+
App selection, snapshots and serving are usable before Django setup when the
|
|
572
|
+
selected app/config modules satisfy Django's pre-setup import requirements.
|
|
573
|
+
Serving never imports the compiler; model declarations depend on native Django
|
|
574
|
+
models without importing build; build is loaded lazily by the build lifecycle.
|
|
575
|
+
Package imports do not configure Django or load a consumer framework. Django,
|
|
576
|
+
packaging and django-yamlconf are base dependencies; typing is optional.
|
|
528
577
|
|
|
529
578
|
`typing.CompositionPlugin.project_model` projects native generated model classes
|
|
530
579
|
into django-stubs TypeInfo in memory, including missing runtime-module symbols.
|