django-compose 0.1.0.dev1__tar.gz → 0.1.0.dev3__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.dev3}/AGENTS.md +2 -2
- django_compose-0.1.0.dev3/CHANGELOG.md +75 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/CONTRIBUTING.md +11 -5
- django_compose-0.1.0.dev3/PKG-INFO +98 -0
- django_compose-0.1.0.dev3/README.md +76 -0
- django_compose-0.1.0.dev3/docs/README.md +99 -0
- django_compose-0.1.0.dev3/docs/ROADMAP.md +17 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/docs/SPEC.md +173 -58
- django_compose-0.1.0.dev1/docs/addons.md → django_compose-0.1.0.dev3/docs/components.md +96 -8
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/docs/configuration.md +75 -54
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/docs/dependencies.md +22 -4
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/docs/extensions.md +4 -1
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/docs/migrations.md +47 -18
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/docs/models.md +11 -4
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/docs/packaging.md +20 -6
- django_compose-0.1.0.dev3/docs/proposals/0001-native-url-collisions.md +25 -0
- django_compose-0.1.0.dev3/docs/proposals/0002-supplied-distribution-metadata.md +24 -0
- django_compose-0.1.0.dev3/docs/provisioning.md +95 -0
- django_compose-0.1.0.dev3/docs/quickstart.md +95 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/settings.py +1 -1
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/verify.py +2 -2
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/pyproject.toml +3 -3
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/scripts/check_distribution.py +31 -13
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/artifacts.py +21 -12
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/build.py +12 -27
- django_compose-0.1.0.dev3/src/django_compose/cli.py +33 -0
- django_compose-0.1.0.dev1/src/django_compose/addons.py → django_compose-0.1.0.dev3/src/django_compose/components.py +141 -25
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/conf.py +39 -12
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/management/__init__.py +8 -1
- django_compose-0.1.0.dev3/src/django_compose/management/commands/provision.py +26 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/migration_imports.py +5 -9
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/migrations.py +237 -56
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/model_composition.py +50 -18
- django_compose-0.1.0.dev3/src/django_compose/provision.py +349 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/snapshot.py +1 -1
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/typing.py +125 -16
- django_compose-0.1.0.dev3/src/django_compose/urls.py +79 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_artifacts.py +114 -1
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_bootstrap.py +149 -3
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_boundaries.py +2 -2
- django_compose-0.1.0.dev1/tests/test_addons.py → django_compose-0.1.0.dev3/tests/test_components.py +334 -27
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_conf.py +103 -2
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_history.py +248 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_integrations.py +105 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_launcher.py +65 -1
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_migrations_guards.py +338 -0
- django_compose-0.1.0.dev3/tests/test_migrations_postgres.py +198 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_models.py +139 -0
- django_compose-0.1.0.dev3/tests/test_provision.py +745 -0
- django_compose-0.1.0.dev3/tests/test_provision_postgres.py +263 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_snapshot.py +3 -3
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_typing.py +223 -1
- django_compose-0.1.0.dev3/tests/test_urls.py +285 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/typing_fixtures/__init__.py +2 -2
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/uv.lock +68 -5
- django_compose-0.1.0.dev1/CHANGELOG.md +0 -37
- django_compose-0.1.0.dev1/PKG-INFO +0 -101
- django_compose-0.1.0.dev1/README.md +0 -79
- django_compose-0.1.0.dev1/docs/README.md +0 -34
- django_compose-0.1.0.dev1/docs/ROADMAP.md +0 -28
- django_compose-0.1.0.dev1/docs/quickstart.md +0 -180
- django_compose-0.1.0.dev1/src/django_compose/cli.py +0 -12
- django_compose-0.1.0.dev1/src/django_compose/urls.py +0 -58
- django_compose-0.1.0.dev1/tests/test_urls.py +0 -59
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/.gitignore +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/COPYING +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/LICENSE +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/Makefile +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/NOTICE +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/docs/proposals/README.md +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/.gitignore +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/README.md +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/catalog/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/catalog/apps.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/catalog/autoconfig.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/catalog/integrations.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/catalog/management/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/catalog/management/commands/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/catalog/management/commands/verify_context.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/catalog/models.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/catalog/pyproject.toml +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/catalog/schema.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/catalog/transport.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/catalog/urls.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/contexts.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/manage.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/reviews/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/reviews/apps.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/reviews/autoconfig.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/reviews/models.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/reviews/pyproject.toml +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/examples/shop/urls.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/__main__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/apps.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/asgi.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/autoreload.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/checks.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/declarations.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/history.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/management/commands/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/management/commands/check_migrations.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/management/commands/compose.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/management/commands/makemigrations.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/management/commands/migrate.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/management/commands/reset_migration_history.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/management/commands/retire_history.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/models.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/py.typed +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/rendering.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/serving.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/src/django_compose/sources.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/core_fixtures/__init__.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_asgi.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_autoreload.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_command_context.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_initial_history.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_migration_imports.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_migration_scaffold.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_migrations.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_sources.py +0 -0
- {django_compose-0.1.0.dev1 → django_compose-0.1.0.dev3}/tests/test_startup.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.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0.dev3
|
|
4
|
+
|
|
5
|
+
- Reorganize documentation around the project workflow, public APIs and app hooks,
|
|
6
|
+
with a shorter introduction and quick start.
|
|
7
|
+
- Expose `index_components(distributions, *, group)` for prepared native package
|
|
8
|
+
metadata; installed discovery delegates to the same validation and index.
|
|
9
|
+
- Protect quoted and schema-qualified migration storage, including implicit
|
|
10
|
+
many-to-many tables, using native eligibility and per-database ownership checks.
|
|
11
|
+
Keep reusable transition planning database-free.
|
|
12
|
+
- Reject integration literals that overwrite Django's generated parent links
|
|
13
|
+
before artifact hooks or ready callbacks run.
|
|
14
|
+
- Project effective extension member reads and calls through native MRO and
|
|
15
|
+
mypy member access while preserving authored-body and override diagnostics.
|
|
16
|
+
- Create new generated files with ordinary umask-filtered permissions while
|
|
17
|
+
preserving existing or explicit modes during atomic replacement.
|
|
18
|
+
- Diagnose identical native URL matching chains without rejecting disjoint
|
|
19
|
+
custom converters merely because they share a regex.
|
|
20
|
+
- Reuse packaging's distribution-name normalization and document Unix platform
|
|
21
|
+
requirements and the remaining property-setter typing limitation.
|
|
22
|
+
|
|
23
|
+
## 0.1.0.dev2
|
|
24
|
+
|
|
25
|
+
- Use component vocabulary for installed distributions, keeping distribution and
|
|
26
|
+
Django app identities distinct in selection and isolated inspection results.
|
|
27
|
+
- Bound isolated inspection and expose the strict native YAML error context.
|
|
28
|
+
- Own verified database provisioning, optional app hooks and durable readiness
|
|
29
|
+
upstream, with explicit legacy-record cutover and native PostgreSQL locking.
|
|
30
|
+
- Protect active shared tables during history purge and include native data-operation
|
|
31
|
+
routing hints in retirement and reset checks.
|
|
32
|
+
- Preserve migration file permissions during failed history reset through the
|
|
33
|
+
common atomic writer.
|
|
34
|
+
- Recover interrupted model publication through the same ownership sequence used
|
|
35
|
+
by artifact hooks.
|
|
36
|
+
- Reject inherited and implicit manager/field collisions while allowing identical
|
|
37
|
+
column names in separate multi-table inheritance tables.
|
|
38
|
+
- Share native relation typing for authored and generated fields, including proxy
|
|
39
|
+
relations, and call model discovery directly from its owner.
|
|
40
|
+
|
|
41
|
+
## 0.1.0.dev1
|
|
42
|
+
|
|
43
|
+
- Report the composition lock path and wait duration when another reader or
|
|
44
|
+
writer blocks a build, without assuming that a development server holds it.
|
|
45
|
+
- Publish checked wheel and source archives through the GitHub release workflow.
|
|
46
|
+
- Keep the `typing` extra installable from PyPI with the published
|
|
47
|
+
`angee-django-stubs`, `angee-django-stubs-ext`, and `angee-mypy` forks.
|
|
48
|
+
- Give `settings.COMPOSE_SNAPSHOT` and `settings.COMPOSE_CLOSURE` their exact
|
|
49
|
+
native types while preserving Django's ordinary settings diagnostics.
|
|
50
|
+
- Expose `apply_app_settings(namespace, closure)` for applying selected apps'
|
|
51
|
+
settings contributions to a project with ordinary authored concrete models.
|
|
52
|
+
|
|
53
|
+
## 0.1.0.dev0 — unreleased
|
|
54
|
+
|
|
55
|
+
- Compose reusable Django source apps and extension classes into ordinary
|
|
56
|
+
concrete models with `concrete`, `extends`, `inherits` and `demands` declarations.
|
|
57
|
+
- Configure project settings through `configure(globals())`, with native
|
|
58
|
+
app dependencies, django-yamlconf contributions and immutable inputs.
|
|
59
|
+
- Verify generated output under a shared startup lock through native ready
|
|
60
|
+
callbacks, and reject stale or altered output before model population.
|
|
61
|
+
- Optionally select installed apps through entry-point and dependency metadata.
|
|
62
|
+
- Keep native migration history when an app is disabled; bind reusable authored
|
|
63
|
+
transitions and guard automatic destructive changes across routed databases.
|
|
64
|
+
- Audit retained migration imports and installed providers before a proposed
|
|
65
|
+
distribution removal, with explicit unsupported/unresolved results.
|
|
66
|
+
- Offer advanced composed-model typing through pinned django-stubs/mypy forks;
|
|
67
|
+
base dependencies are Django, packaging and django-yamlconf.
|
|
68
|
+
- Include a plain Django example, user guides and fresh installed-wheel checks.
|
|
69
|
+
- Render declared artifacts in models and ready phases, then finalize publication;
|
|
70
|
+
expose verified artifact paths and receipt leases to startup and serving readers.
|
|
71
|
+
- Compose native URL declarations, ASGI mounts/protocols and ordered lifespans.
|
|
72
|
+
- Recompose before native development-server children start, report inputs before
|
|
73
|
+
reads and recover after failed composition and file creation/deletion.
|
|
74
|
+
- Inspect installed component metadata without importing app modules and project
|
|
75
|
+
generated model typing in memory without rewriting source or stub files.
|
|
@@ -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.
|
|
@@ -28,9 +29,13 @@ uv run --no-sync pytest -q tests/test_migrations.py
|
|
|
28
29
|
|
|
29
30
|
`make dist-check` builds wheel and sdist, checks metadata and archive contents,
|
|
30
31
|
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.
|
|
32
|
+
test first uses base dependencies, then installed component wheels with settings
|
|
33
|
+
contributions; it covers composition, native migration history, provisioning,
|
|
34
|
+
serving, ORM behavior, stale output refusal and retained-import reporting.
|
|
35
|
+
CI runs the same Makefile targets with a disposable PostgreSQL service. The dev
|
|
36
|
+
dependencies include its native driver and pool for the
|
|
37
|
+
[PostgreSQL proof](docs/provisioning.md#optional-postgresql-proof); local runs
|
|
38
|
+
skip that proof unless its dedicated test-environment file is supplied.
|
|
34
39
|
The Checks workflow uploads archives without publishing them. The separate
|
|
35
40
|
[release workflow](docs/packaging.md#publish-this-library) publishes checked
|
|
36
41
|
archives to PyPI when explicitly dispatched or triggered by a version tag.
|
|
@@ -40,7 +45,8 @@ archives to PyPI when explicitly dispatched or triggered by a version tag.
|
|
|
40
45
|
Django owns app identity/population, model construction, fields, managers, ORM,
|
|
41
46
|
migration state and execution. Extend those native contracts instead of adding
|
|
42
47
|
parallel registries, parsers or lifecycle systems. django-compose owns only the
|
|
43
|
-
composition, deterministic output
|
|
48
|
+
composition, deterministic output, reusable migration-binding seams and verified
|
|
49
|
+
database preparation through native app hooks.
|
|
44
50
|
|
|
45
51
|
Keep commands and other entrypoints thin. Put a missing rule on its existing
|
|
46
52
|
owner, migrate callers and remove superseded code and guidance. Public behavior,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: django-compose
|
|
3
|
+
Version: 0.1.0.dev3
|
|
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).
|