django-compose 0.1.0.dev7__tar.gz → 0.1.0.dev9__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.
Files changed (126) hide show
  1. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/AGENTS.md +1 -1
  2. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/CHANGELOG.md +15 -0
  3. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/CONTRIBUTING.md +4 -1
  4. django_compose-0.1.0.dev9/PKG-INFO +102 -0
  5. django_compose-0.1.0.dev9/README.md +80 -0
  6. django_compose-0.1.0.dev9/docs/README.md +34 -0
  7. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/ROADMAP.md +3 -1
  8. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/SPEC.md +34 -151
  9. django_compose-0.1.0.dev9/docs/api.md +142 -0
  10. django_compose-0.1.0.dev9/docs/configuration.md +331 -0
  11. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/dependencies.md +1 -1
  12. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/migrations.md +45 -157
  13. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/packaging.md +19 -9
  14. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/proposals/0001-native-url-collisions.md +6 -3
  15. django_compose-0.1.0.dev9/docs/proposals/0004-serving-boundary.md +38 -0
  16. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/proposals/README.md +1 -1
  17. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/provisioning.md +2 -2
  18. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/quickstart.md +8 -3
  19. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/README.md +9 -13
  20. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/catalog/apps.py +1 -9
  21. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/settings.py +0 -2
  22. django_compose-0.1.0.dev9/examples/shop/urls.py +5 -0
  23. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/verify.py +2 -22
  24. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/pyproject.toml +1 -1
  25. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/scripts/check_distribution.py +54 -72
  26. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/apps.py +2 -7
  27. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/build.py +0 -5
  28. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/management/__init__.py +12 -54
  29. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/management/commands/check_migrations.py +3 -4
  30. django_compose-0.1.0.dev9/src/django_compose/management/commands/makemigrations.py +18 -0
  31. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/management/commands/reset_migration_history.py +1 -2
  32. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/migration_imports.py +19 -18
  33. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/migrations.py +29 -581
  34. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/snapshot.py +14 -116
  35. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_bootstrap.py +2 -2
  36. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_boundaries.py +5 -16
  37. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_conf.py +16 -0
  38. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_history.py +2 -16
  39. django_compose-0.1.0.dev9/tests/test_initial_history.py +74 -0
  40. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_launcher.py +31 -43
  41. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_migration_imports.py +79 -0
  42. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_migration_scaffold.py +13 -0
  43. django_compose-0.1.0.dev9/tests/test_migrations.py +165 -0
  44. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_migrations_guards.py +10 -120
  45. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_snapshot.py +38 -164
  46. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/uv.lock +1 -1
  47. django_compose-0.1.0.dev7/PKG-INFO +0 -98
  48. django_compose-0.1.0.dev7/README.md +0 -76
  49. django_compose-0.1.0.dev7/docs/README.md +0 -102
  50. django_compose-0.1.0.dev7/docs/configuration.md +0 -390
  51. django_compose-0.1.0.dev7/docs/proposals/0003-existing-baseline-adoption.md +0 -32
  52. django_compose-0.1.0.dev7/examples/shop/catalog/management/commands/verify_context.py +0 -21
  53. django_compose-0.1.0.dev7/examples/shop/catalog/transport.py +0 -17
  54. django_compose-0.1.0.dev7/examples/shop/contexts.py +0 -19
  55. django_compose-0.1.0.dev7/examples/shop/reviews/__init__.py +0 -0
  56. django_compose-0.1.0.dev7/examples/shop/urls.py +0 -3
  57. django_compose-0.1.0.dev7/src/django_compose/__init__.py +0 -0
  58. django_compose-0.1.0.dev7/src/django_compose/asgi.py +0 -110
  59. django_compose-0.1.0.dev7/src/django_compose/checks.py +0 -11
  60. django_compose-0.1.0.dev7/src/django_compose/management/commands/adopt_transition.py +0 -41
  61. django_compose-0.1.0.dev7/src/django_compose/management/commands/makemigrations.py +0 -236
  62. django_compose-0.1.0.dev7/src/django_compose/urls.py +0 -79
  63. django_compose-0.1.0.dev7/tests/test_asgi.py +0 -201
  64. django_compose-0.1.0.dev7/tests/test_baseline_adoption.py +0 -530
  65. django_compose-0.1.0.dev7/tests/test_command_context.py +0 -179
  66. django_compose-0.1.0.dev7/tests/test_initial_history.py +0 -752
  67. django_compose-0.1.0.dev7/tests/test_migrations.py +0 -732
  68. django_compose-0.1.0.dev7/tests/test_urls.py +0 -285
  69. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/.gitignore +0 -0
  70. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/COPYING +0 -0
  71. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/LICENSE +0 -0
  72. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/Makefile +0 -0
  73. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/NOTICE +0 -0
  74. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/components.md +0 -0
  75. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/extensions.md +0 -0
  76. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/models.md +0 -0
  77. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/docs/proposals/0002-supplied-distribution-metadata.md +0 -0
  78. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/.gitignore +0 -0
  79. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/catalog/__init__.py +0 -0
  80. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/catalog/autoconfig.py +0 -0
  81. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/catalog/integrations.py +0 -0
  82. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/catalog/models.py +0 -0
  83. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/catalog/pyproject.toml +0 -0
  84. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/catalog/schema.py +0 -0
  85. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/catalog/urls.py +0 -0
  86. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/manage.py +0 -0
  87. {django_compose-0.1.0.dev7/examples/shop/catalog/management → django_compose-0.1.0.dev9/examples/shop/reviews}/__init__.py +0 -0
  88. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/reviews/apps.py +0 -0
  89. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/reviews/autoconfig.py +0 -0
  90. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/reviews/models.py +0 -0
  91. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/examples/shop/reviews/pyproject.toml +0 -0
  92. {django_compose-0.1.0.dev7/examples/shop/catalog/management/commands → django_compose-0.1.0.dev9/src/django_compose}/__init__.py +0 -0
  93. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/__main__.py +0 -0
  94. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/artifacts.py +0 -0
  95. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/autoreload.py +0 -0
  96. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/cli.py +0 -0
  97. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/components.py +0 -0
  98. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/conf.py +0 -0
  99. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/declarations.py +0 -0
  100. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/history.py +0 -0
  101. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/management/commands/__init__.py +0 -0
  102. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/management/commands/compose.py +0 -0
  103. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/management/commands/migrate.py +0 -0
  104. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/management/commands/provision.py +0 -0
  105. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/management/commands/retire_history.py +0 -0
  106. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/model_composition.py +0 -0
  107. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/models.py +0 -0
  108. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/provision.py +0 -0
  109. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/py.typed +0 -0
  110. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/rendering.py +0 -0
  111. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/serving.py +0 -0
  112. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/sources.py +0 -0
  113. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/src/django_compose/typing.py +0 -0
  114. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/core_fixtures/__init__.py +0 -0
  115. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_artifacts.py +0 -0
  116. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_autoreload.py +0 -0
  117. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_components.py +0 -0
  118. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_integrations.py +0 -0
  119. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_migrations_postgres.py +0 -0
  120. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_models.py +0 -0
  121. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_provision.py +0 -0
  122. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_provision_postgres.py +0 -0
  123. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_sources.py +0 -0
  124. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_startup.py +0 -0
  125. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/test_typing.py +0 -0
  126. {django_compose-0.1.0.dev7 → django_compose-0.1.0.dev9}/tests/typing_fixtures/__init__.py +0 -0
@@ -6,7 +6,7 @@ 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 composition, deterministic emission, reusable migration binding
9
+ This package owns composition, deterministic emission, native history retention
10
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.
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0.dev9
4
+
5
+ - Remove the URL/ASGI serving and command-context seams; consumers own serving
6
+ (prerelease API cutoff; see [proposal 0004](docs/proposals/0004-serving-boundary.md)).
7
+ - Add keyword-only `utility_class` to `management.execute()`.
8
+
9
+ ## 0.1.0.dev8
10
+
11
+ - Replace reusable transition discovery, binding, baseline/adoption and sealing
12
+ with ordinary project-authored Django migrations. Preserve existing native
13
+ history and independent destructive-change/import-audit protections. This is
14
+ an explicit [prerelease API cutoff](docs/migrations.md#upgrade-from-the-removed-prerelease-protocol).
15
+ - Keep native Watchman daemon acceptance and a shared mandatory PostgreSQL
16
+ CI/release gate open for the stable 0.1.0 release.
17
+
3
18
  ## 0.1.0.dev7
4
19
 
5
20
  - Add explicit `adopt_transition` authoring for a declared transition satisfied by
@@ -45,7 +45,7 @@ archives to PyPI when explicitly dispatched or triggered by a version tag.
45
45
  Django owns app identity/population, model construction, fields, managers, ORM,
46
46
  migration state and execution. Extend those native contracts instead of adding
47
47
  parallel registries, parsers or lifecycle systems. django-compose owns only the
48
- composition, deterministic output, reusable migration-binding seams and verified
48
+ composition, deterministic output, native history-retention seams and verified
49
49
  database preparation through native app hooks.
50
50
 
51
51
  Keep commands and other entrypoints thin. Put a missing rule on its existing
@@ -71,3 +71,6 @@ independently as well as running the checks. Promote accepted contract changes
71
71
  into current documentation; proposals record decisions rather than maintaining
72
72
  a second API reference. Preserve license notices and attribution when changing
73
73
  or distributing code.
74
+
75
+ Native Watchman daemon acceptance and a shared mandatory PostgreSQL CI/release
76
+ gate remain open; this candidate does not establish release readiness.
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.5
2
+ Name: django-compose
3
+ Version: 0.1.0.dev9
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 generates a project's concrete Django models and app
28
+ configurations from the reusable apps you enable. An app can add fields and
29
+ methods to another app's model, contribute settings, and supply optional build
30
+ or startup hooks.
31
+
32
+ Use it when projects share apps but need different combinations of features.
33
+ Your project selects its root apps in `INSTALLED_APPS`; django-compose includes
34
+ their declared app dependencies. Installing a package alone does not enable it.
35
+
36
+ ```text
37
+ installed app packages + project settings → compose → Django models and app configs
38
+ ```
39
+
40
+ ## One model, two apps
41
+
42
+ ```python
43
+ # catalog/models.py
44
+ from django.db import models
45
+ from django_compose.models import Composable
46
+
47
+ class Item(Composable, concrete=True):
48
+ title = models.CharField(max_length=100)
49
+
50
+ class Meta:
51
+ abstract = True
52
+ ```
53
+
54
+ ```python
55
+ # reviews/models.py
56
+ from django.db import models
57
+ from django_compose.models import Composable
58
+
59
+ class Rating(Composable, extends="catalog.Item"):
60
+ rating = models.PositiveSmallIntegerField(default=0)
61
+
62
+ class Meta:
63
+ abstract = True
64
+ ```
65
+
66
+ With both apps enabled, the generated `catalog.Item` has `title` and `rating` in
67
+ one table. `Rating` adds no table of its own. After Django setup, retrieve the
68
+ concrete class with `apps.get_model("catalog", "Item")` and use its normal manager
69
+ and queryset. The source declarations remain abstract.
70
+
71
+ The [model guide](https://github.com/ang-ee/django-compose/blob/main/docs/models.md)
72
+ also covers `inherits` for Django multi-table inheritance and `demands` for
73
+ required ancestors.
74
+
75
+ ## How a project uses it
76
+
77
+ Author your Django settings and `manage.py`, call `configure(globals())` at the
78
+ end of settings, and use the django-compose command launcher. In that configured
79
+ project:
80
+
81
+ ```sh
82
+ python manage.py compose # Generate models, app configs and declared artifacts
83
+ python manage.py makemigrations # Author ordinary Django migration files
84
+ python manage.py migrate # Apply them to the database
85
+ python manage.py runserver # Run Django's development server
86
+ ```
87
+
88
+ Django owns the app registry, ORM, managers, querysets and migration history.
89
+ Generated classes import the source apps, so keep their packages installed.
90
+ Rebuild generated code as apps change; preserve and review migration files.
91
+
92
+ ## Get started
93
+
94
+ This is a development preview. See [compatibility and platform requirements](https://github.com/ang-ee/django-compose/blob/main/docs/dependencies.md)
95
+ and [installation](https://github.com/ang-ee/django-compose/blob/main/docs/packaging.md).
96
+
97
+ - [Quick start](https://github.com/ang-ee/django-compose/blob/main/docs/quickstart.md): run the SQLite example and query the composed model.
98
+ - [Project setup](https://github.com/ang-ee/django-compose/blob/main/docs/configuration.md): complete settings, launcher and model files.
99
+ - [Public API](https://github.com/ang-ee/django-compose/blob/main/docs/api.md): commands, Python entry points and app hooks.
100
+ - [Documentation](https://github.com/ang-ee/django-compose/blob/main/docs/README.md): guides for apps, settings, migrations and deployment.
101
+
102
+ Licensed under [LGPL-3.0-or-later](https://github.com/ang-ee/django-compose/blob/main/LICENSE).
@@ -0,0 +1,80 @@
1
+ # django-compose
2
+
3
+ Compose reusable Django apps into a runnable project.
4
+
5
+ django-compose generates a project's concrete Django models and app
6
+ configurations from the reusable apps you enable. An app can add fields and
7
+ methods to another app's model, contribute settings, and supply optional build
8
+ or startup hooks.
9
+
10
+ Use it when projects share apps but need different combinations of features.
11
+ Your project selects its root apps in `INSTALLED_APPS`; django-compose includes
12
+ their declared app dependencies. Installing a package alone does not enable it.
13
+
14
+ ```text
15
+ installed app packages + project settings → compose → Django models and app configs
16
+ ```
17
+
18
+ ## One model, two apps
19
+
20
+ ```python
21
+ # catalog/models.py
22
+ from django.db import models
23
+ from django_compose.models import Composable
24
+
25
+ class Item(Composable, concrete=True):
26
+ title = models.CharField(max_length=100)
27
+
28
+ class Meta:
29
+ abstract = True
30
+ ```
31
+
32
+ ```python
33
+ # reviews/models.py
34
+ from django.db import models
35
+ from django_compose.models import Composable
36
+
37
+ class Rating(Composable, extends="catalog.Item"):
38
+ rating = models.PositiveSmallIntegerField(default=0)
39
+
40
+ class Meta:
41
+ abstract = True
42
+ ```
43
+
44
+ With both apps enabled, the generated `catalog.Item` has `title` and `rating` in
45
+ one table. `Rating` adds no table of its own. After Django setup, retrieve the
46
+ concrete class with `apps.get_model("catalog", "Item")` and use its normal manager
47
+ and queryset. The source declarations remain abstract.
48
+
49
+ The [model guide](https://github.com/ang-ee/django-compose/blob/main/docs/models.md)
50
+ also covers `inherits` for Django multi-table inheritance and `demands` for
51
+ required ancestors.
52
+
53
+ ## How a project uses it
54
+
55
+ Author your Django settings and `manage.py`, call `configure(globals())` at the
56
+ end of settings, and use the django-compose command launcher. In that configured
57
+ project:
58
+
59
+ ```sh
60
+ python manage.py compose # Generate models, app configs and declared artifacts
61
+ python manage.py makemigrations # Author ordinary Django migration files
62
+ python manage.py migrate # Apply them to the database
63
+ python manage.py runserver # Run Django's development server
64
+ ```
65
+
66
+ Django owns the app registry, ORM, managers, querysets and migration history.
67
+ Generated classes import the source apps, so keep their packages installed.
68
+ Rebuild generated code as apps change; preserve and review migration files.
69
+
70
+ ## Get started
71
+
72
+ This is a development preview. See [compatibility and platform requirements](https://github.com/ang-ee/django-compose/blob/main/docs/dependencies.md)
73
+ and [installation](https://github.com/ang-ee/django-compose/blob/main/docs/packaging.md).
74
+
75
+ - [Quick start](https://github.com/ang-ee/django-compose/blob/main/docs/quickstart.md): run the SQLite example and query the composed model.
76
+ - [Project setup](https://github.com/ang-ee/django-compose/blob/main/docs/configuration.md): complete settings, launcher and model files.
77
+ - [Public API](https://github.com/ang-ee/django-compose/blob/main/docs/api.md): commands, Python entry points and app hooks.
78
+ - [Documentation](https://github.com/ang-ee/django-compose/blob/main/docs/README.md): guides for apps, settings, migrations and deployment.
79
+
80
+ Licensed under [LGPL-3.0-or-later](https://github.com/ang-ee/django-compose/blob/main/LICENSE).
@@ -0,0 +1,34 @@
1
+ # Documentation
2
+
3
+ django-compose builds concrete Django models and app configurations from the
4
+ reusable apps selected by a project. Apps contribute declarations and settings;
5
+ Django supplies the registry, ORM and migrations.
6
+
7
+ ## Start here
8
+
9
+ 1. [Quick start](quickstart.md) — run the shop example and query a composed model.
10
+ 2. [Project setup](configuration.md) — add composition to your own Django project.
11
+ 3. [Public API](api.md) — find commands, Python entry points and app hooks.
12
+
13
+ ## Guides
14
+
15
+ | I want to… | Read |
16
+ | --- | --- |
17
+ | Add fields or behavior from another app | [Model declarations](models.md) |
18
+ | Choose apps and follow their dependencies | [App selection and package metadata](components.md) |
19
+ | Contribute settings | [Project configuration](configuration.md#app-settings-contributions) |
20
+ | Generate additional files or model metadata | [Build integrations](extensions.md) |
21
+ | Change models, disable apps or maintain history | [Migrations](migrations.md) |
22
+ | Prepare a database and check readiness | [Provisioning](provisioning.md) |
23
+ | Install the package or deploy a composed project | [Installation and deployment](packaging.md) |
24
+ | Check platform support or configure mypy | [Compatibility and typing](dependencies.md) |
25
+
26
+ ## Reference and contribution
27
+
28
+ The [contract details](SPEC.md) define validation, ordering and lifecycle rules.
29
+ [Contributing](../CONTRIBUTING.md) covers development and checks;
30
+ the [roadmap](ROADMAP.md) lists open work.
31
+
32
+ These docs describe this checkout. The [changelog](../CHANGELOG.md) identifies
33
+ released changes; use a [local installation](packaging.md#install-locally) for
34
+ features marked **Unreleased**.
@@ -1,6 +1,6 @@
1
1
  # Current scope and open work
2
2
 
3
- The [API guide](README.md) describes what is available; the
3
+ The [public API](api.md) describes what is available; the
4
4
  [reference](SPEC.md) defines its contracts. Release changes belong in the
5
5
  [changelog](../CHANGELOG.md).
6
6
 
@@ -13,5 +13,7 @@ Current boundaries and remaining verification:
13
13
  - StatReloader edit, failure/recovery and file creation/deletion checks have run.
14
14
  Watchman adapter tests cover the same declarations; acceptance against a native
15
15
  Watchman daemon remains outstanding.
16
+ - CI and publication still need one shared mandatory PostgreSQL check gate and
17
+ exact checked-archive transfer. The migration candidate is not release-ready.
16
18
 
17
19
  Changes to a public contract use the [proposal process](proposals/README.md).
@@ -1,7 +1,7 @@
1
- # Detailed API reference
1
+ # Contract details
2
2
 
3
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).
4
+ Python entry points and app hooks, start with the [API overview](api.md).
5
5
  For runnable examples, use the [quick start](quickstart.md) and
6
6
  [project configuration](configuration.md). [Compatibility](dependencies.md)
7
7
  defines supported versions and platforms.
@@ -15,9 +15,8 @@ defines supported versions and platforms.
15
15
  - [Integration protocols](#integration-protocols)
16
16
  - [Generated output and freshness](#generated-output-and-freshness)
17
17
  - [Artifact access](#artifact-access)
18
- - [Native history and transitions](#native-history-and-transitions)
18
+ - [Native history](#native-history)
19
19
  - [Database preparation and readiness](#database-preparation-and-readiness)
20
- - [Serving composition](#serving-composition)
21
20
  - [Typing and import boundaries](#typing-and-import-boundaries)
22
21
 
23
22
  ## Terms
@@ -246,21 +245,19 @@ keep ordering and input ownership in one place. See the
246
245
  | `COMPOSE_OUTPUT_DIR` | Project-selected generated package directory; required for building |
247
246
  | `COMPOSE_OUTPUT_MODULE` | Import path for that directory; defaults to `"runtime"` |
248
247
  | `COMPOSE_WATCH_PATHS` | Files and `(directory, glob)` pairs additionally watched by native reloaders |
249
- | `COMPOSE_COMMAND_CONTEXT` | Ordered dotted post-setup/post-parse `(command, argv, options)` context-manager factories; empty by default |
250
248
  | `COMPOSE_INTEGRATIONS` | Ordered dotted integration class paths; empty by default |
251
249
  | `COMPOSE_FINGERPRINT_GLOBS` | Additional per-app source globs; empty by default |
252
250
  | `COMPOSE_FINGERPRINT_EXCLUDES` | Source exclusion patterns; defaults to `**/tests/**`, `**/migrations/**`, `**/__pycache__/**` |
253
251
  | `COMPOSE_FINGERPRINT_SETTINGS` | Additional setting names affecting the build; empty by default |
254
252
  | `COMPOSE_EXTERNAL_ARTIFACT_ROOTS` | Permitted integration output directories; empty by default |
255
- | `COMPOSE_TRANSITION_SOURCE` | Explicit transition declarations or dotted pre-setup-safe callable; omission selects default discovery |
256
253
  | `COMPOSE_CLOSURE` | Derived selected Closure, available to contribution callbacks |
257
254
  | `COMPOSE_SNAPSHOT` | Derived Snapshot used by lifecycle configurations |
258
255
 
259
256
  Mandatory inputs include resolved app/config identities, source Python and
260
257
  extra-glob bytes, selected config MRO implementation modules, integration modules,
261
- transition records/bytes, `DEFAULT_AUTO_FIELD`, `AUTH_USER_MODEL`, authored
262
- migration mappings, every `COMPOSE_*` value except derived `COMPOSE_ROOTS`,
263
- `COMPOSE_SNAPSHOT`, `COMPOSE_CLOSURE` and execution-only `COMPOSE_COMMAND_CONTEXT`, and compiler identity. Built-in/frozen config owners use a
258
+ `DEFAULT_AUTO_FIELD`, `AUTH_USER_MODEL`, authored migration mappings, every
259
+ `COMPOSE_*` value except derived `COMPOSE_ROOTS`, `COMPOSE_SNAPSHOT` and
260
+ `COMPOSE_CLOSURE`, and compiler identity. Built-in/frozen config owners use a
264
261
  deterministic interpreter implementation/version identity instead of file bytes.
265
262
  A redundant root list cannot alter the digest of an unchanged resolved selection.
266
263
 
@@ -284,28 +281,6 @@ RECORD or PEP 610 ownership, with one lazy index per audit. Native app/config
284
281
  modules are imported to select configurations and must remain safe before Django
285
282
  setup. Snapshot and serving do not import the model compiler or execute integrations.
286
283
 
287
- Without `COMPOSE_TRANSITION_SOURCE`, each selected app contributes sorted
288
- `compose_migrations/<label>/<name>.py` files in app order, including numeric
289
- migration names. The public owner is
290
- `snapshot.discover_transitions(entries: Iterable[Entry]) -> tuple[Mapping[str, str], ...]`.
291
- It accepts resolved identities such as `Closure.app_entries`, preserves their
292
- order, reports watched paths and returns immutable normalized records without
293
- importing apps or migration modules. Default snapshot discovery calls this same
294
- function. A settings adapter can use the already resolved `COMPOSE_CLOSURE` during
295
- an app's `settings(namespace)` callback, annotate copies using owner-declared
296
- facts, and return concrete `COMPOSE_TRANSITION_SOURCE` records before the snapshot.
297
- Preserve other records and any explicitly authored replacement source; selecting
298
- apps again or reading lazy Django settings during configuration is unnecessary.
299
- An explicit source replaces discovery. Records require
300
- `declaring_app`, `name`, `app_label` and `module` string keys, and optionally
301
- `initial_baseline: "satisfied"`; other keys or baseline values are invalid.
302
- Omission retains strict guard handling. The explicit transition-owner provider
303
- supplies this assertion; default discovery does not infer it from source modules.
304
- Modules relative to the declaring app are normalized once. Duplicate
305
- `<declaring_app>:<name>` origins fail. `Snapshot.transition_records` retains the frozen normalized records;
306
- `Snapshot.transitions` stores their origin/sha256 pairs. Build and native history
307
- use the same records.
308
-
309
284
  ## Setup lifecycle
310
285
 
311
286
  `DJANGO_COMPOSE_MODE` is `write`, `check`, or absent for serving; every other value
@@ -319,13 +294,11 @@ launcher is the native reloader parent: compose first, then start the serving ch
319
294
  on failure watch reported candidates and retry after changes. Settings loaders
320
295
  call `autoreload.report_inputs(files=(), globs=())` before reads. Files may be
321
296
  absent and globs initially empty. `COMPOSE_WATCH_PATHS` extends the same owner.
322
- `COMPOSE_COMMAND_CONTEXT` factories receive `(command, tuple(argv), options)`
323
- after successful native setup and parsing, around `execute`. `options` is a
324
- read-only shallow copy of native parsed options, including default or explicitly
325
- selected `database` where that command declares it. Native dispatch owns parser
326
- errors and connection cleanup. Settings-free/help/version paths skip contexts.
327
- A custom `run_from_argv` participates by calling `self.execute`; bypassing execute
328
- also bypasses these contexts.
297
+ `execute(argv=None, *, utility_class=ManagementUtility)` dispatches through the
298
+ given native `ManagementUtility` class, which owns command parsing, parser errors
299
+ and connection cleanup. A project wraps command execution by supplying a subclass;
300
+ the launcher adds no middleware of its own, and the reloader parent's compose
301
+ subprocess uses the default dispatcher.
329
302
  Direct Django launchers must set composition mode themselves before settings
330
303
  load; migration commands require it to be absent.
331
304
 
@@ -349,8 +322,8 @@ hooks, and finalizes in the final `ready()` callback:
349
322
  no mutation.
350
323
 
351
324
  All native `ready()` callbacks see concrete models and models-phase files.
352
- `BuildComposeConfig.ready()` additionally compares native migration history and
353
- pending transitions in check mode. Ordinary write composition does not load
325
+ `BuildComposeConfig.ready()` additionally compares native migration history in
326
+ check mode. Ordinary write composition does not load
354
327
  migration history, query a deployment database, author migrations or apply them.
355
328
  Native source import hooks still execute as part of Django population.
356
329
 
@@ -453,13 +426,13 @@ existing bytes. Preserve native history as explained in [packaging](packaging.md
453
426
  path and current hash before returning a Path. During build-ready callbacks it
454
427
  supports models-phase artifacts before final publication.
455
428
 
456
- ## Native history and transitions
429
+ ## Native history
457
430
 
458
431
  For generated labels, history defaults to `<output_module>.<label>.migrations`.
459
432
  `serving.migration_modules(authored, receipt, output_module)` derives retained
460
433
  defaults from the record, then applies authored overrides, including `None`.
461
434
  `HISTORY_LABELS` retains model labels, previous history, on-disk migration
462
- packages and transition targets, minus `RETIRED_LABELS`. History-only configs use
435
+ packages, minus `RETIRED_LABELS`. History-only configs use
463
436
  `django_compose.history.History_<label>`, generated dynamically from retained
464
437
  receipt facts; they load no old source models or app lifecycle.
465
438
 
@@ -470,87 +443,18 @@ record labels minus retired and snapshot-selected app labels. An enabled app
470
443
  that loses its last model remains active and yields a native model deletion.
471
444
  All package migration comparisons use this state calculation.
472
445
 
473
- For composed apps with migrations enabled, concrete models and no native disk history,
474
- `makemigrations` first authors the initial schema through Django's native command,
475
- then binds guarded reusable transitions and reconciles ordinary model changes.
476
- Selected-app authoring includes prerequisite apps initialized by native dependency
477
- expansion. Initial `--check` retains Django's exit status 1 for missing history;
478
- `--dry-run` previews without writing or binding. `--merge`, `--empty` and `--update`
479
- are refused before initial schema authoring. If native expansion requires changes
480
- to an app with existing history, the command refuses before writes and asks the
481
- caller to author that app's transitions first; existing history bytes remain intact.
482
- Initial authoring, binding and final reconciliation share an exception rollback
483
- boundary: restore affected pre-call migration bytes and permissions, remove exact
484
- newly authored files and invalidate migration imports, without recorder writes.
485
- A failed attempt can retry from the same disk history. This is exception safety,
486
- not crash-atomic publication of multiple files.
487
-
488
- `TransitionBinding` uses frozen snapshot records by default, or explicit
489
- `declarations=`. It binds native migration origins `<declaring_app>:<name>` to
490
- the project's actual graph leaves. Each source provides a native `Migration`
491
- and a pure `applies(ProjectState) -> bool` guard. Ordinary planning and
492
- `makemigrations` refuse a pending false guard unless its owner declares `initial_baseline: "satisfied"` and the label acquired
493
- its first native disk nodes in this successful command's initial-authoring phase,
494
- including native prerequisite expansion. The assertion means the final-schema
495
- initial baseline satisfies this transition on every database adopting it,
496
- including existing rows adopted through native `migrate --fake-initial`. It does
497
- not assert that the original operations executed. Existing initial-looking
498
- files, reset-created initials and global read-only checks supply no exemption.
499
- True guards always retain their operations, including bootstrap and backfill
500
- work. A false-guard baseline binding substitutes Django's native empty migration
501
- before downstream graph state calculation. Its materialization footer seals a
502
- native zero-operation Migration subclass and `compose_initial_baseline =
503
- "satisfied"`, omitting any source-class state or database lifecycle overrides. This
504
- durable origin must be retained like any other native history node after its
505
- source declaration is removed. Its source bytes and source SHA remain unchanged;
506
- adding the optional declaration does not rewrite or invalidate existing origins.
507
- Immutable source/body digests, dependencies, `run_before`, `replaces` and complete
508
- squash chains are preserved. Materialized history remains executable after its
509
- source declaration is removed. Changed immutable sources, duplicate origins,
510
- missing prerequisites and cycles fail. Dry-run/check never author history.
511
- Legacy `angee_origin` and `angee_source_sha256` metadata is read only for
512
- historical adoption; new metadata uses `compose_origin` and
513
- `compose_source_sha256`.
514
-
515
- Explicit existing-baseline adoption uses
516
- `TransitionBinding.adoption_plan(origin, baseline)` and
517
- `TransitionBinding.adopt(origin, baseline, *, dry_run=False)`, or the thin
518
- `adopt_transition DECLARING_APP:NAME --baseline APP_LABEL.MIGRATION_NAME
519
- [--dry-run]` management command. The selected normalized declaration and source
520
- SHA must match `COMPOSE_SNAPSHOT.transition_records` and `transitions`, and the
521
- owner must already assert `initial_baseline: "satisfied"`.
522
-
523
- The explicit action is the caller's attestation that the named retained initial
524
- is the baseline covered by that owner assertion. Native graph structure and
525
- false guards establish the action's scope; they prove neither historical data
526
- completion nor schema equivalence. The named anchor must be same-target-label,
527
- retained on disk and active in Django's graph, and an ancestor of the unique
528
- current target leaf. It must have `Migration.initial is True`, or `initial is
529
- None` and be a native same-app graph root. This root criterion is conservative
530
- scope for adoption, not a reimplementation of Django's soft-initial detection;
531
- `run_before` can affect native graph roots. A true guard either after the named
532
- anchor or at the resolved binding pre-state refuses adoption. Unrelated current
533
- model drift remains for ordinary `makemigrations`.
534
-
535
- Only the selected pending declaration is loaded. Native graph resolution freezes
536
- its dependency and `run_before` edges; missing or pending explicit prerequisites
537
- or successors, cycles and ambiguous relevant leaves refuse. Unrelated pending
538
- sources are not imported or implicitly adopted. The new sealed native empty
539
- origin depends on the current retained target leaf, preserving existing files.
540
- The footer retains the existing source/body seals and baseline-satisfaction
541
- marker, plus `compose_adopted_baseline` (the anchor Node) and
542
- `compose_adopted_baseline_sha256` (the exact native anchor file hash).
543
-
544
- `adoption_plan` returns a `TransitionPlan`, or `None` for an exact retained
545
- adoption. `adopt` returns the authored path tuple, the prospective path tuple
546
- for dry-run, or an empty tuple for an exact repeat. A repeat validates the sealed
547
- origin's native empty semantics, selected source, matching anchor and anchor SHA
548
- without rewriting or rebinding it, including after later native descendants.
549
- Existing ordinary or first-authoring origins are not silently converted to
550
- adoptions. Dry-run validates without writes; failed publication removes only
551
- its newly authored files through the same exclusive rollback owner as normal
552
- binding. Authoring never queries the database or writes the migration recorder;
553
- Django's subsequent `migrate` owns application and recording.
446
+ `makemigrations` delegates authoring to Django using the shared drop-guard
447
+ autodetector. Django owns `--check`, `--dry-run`, `--empty`, `--merge`, `--update`,
448
+ serialization and file destinations. There is no custom multi-phase authoring or
449
+ whole-command rollback journal; native command semantics apply. Authoring may
450
+ read routed databases for destructive-change safety, but does not write migration
451
+ recorder rows. Native `migrate` owns application and recording.
452
+
453
+ `migrations.check_native_history(apps, *, labels)` compares native graph state
454
+ with effective composed state without database access. `migrations.history_labels()`
455
+ reads retained labels from the build record. Compiler revision is 2; the receipt
456
+ schema is unchanged. For the prerelease cutoff and retained historical files,
457
+ see [upgrade guidance](migrations.md#upgrade-from-the-removed-prerelease-protocol).
554
458
 
555
459
  `DropGuardAutodetector`, shared by native `makemigrations` and `migrate`, requires
556
460
  relevant rows or columns to be empty on every database eligible for the native
@@ -562,16 +466,11 @@ and unavailable eligible databases cannot prove safety. Explicit integration-own
562
466
  row exemptions use `MigrationPolicy`. See the [storage proof's supported cases
563
467
  and limits](migrations.md#advanced-destructive-changes-and-history-cutoffs).
564
468
 
565
- Reusable transition planning remains database-free. It conservatively retains
566
- feature-dependent aliases when checking the feature could connect, and refuses
567
- ambiguous shared storage that requires database visibility to resolve. Explicit
568
- migration authoring, purge and history maintenance use database-aware checks.
569
-
570
469
  Retirement requires consistent fully applied history across all configured
571
470
  migration-relevant aliases and refuses retained incoming cross-app dependencies.
572
471
  The alias scope includes native data-operation routing hints; custom database
573
472
  behavior that cannot establish a narrower scope requires all configured aliases.
574
- Optional purge authors/applies a final deletion transition on that same alias
473
+ Optional purge authors/applies a final native deletion migration on that same alias
575
474
  scope; purge alone is not retirement. Successful retirement updates the record;
576
475
  the next compose removes the history-only config. Databases absent from command
577
476
  settings lie outside that proof. Guarded history reset additionally requires a
@@ -579,9 +478,9 @@ fully applied, model-clean graph and uses transactional recorder changes with
579
478
  filesystem rollback preserving original bytes and permissions. Normal build and
580
479
  clean never reset history.
581
480
 
582
- `check_migrations` checks native state and pending transitions.
481
+ `check_migrations` checks native state.
583
482
  `check_migrations --imports` statically audits selected migration sources,
584
- authored mappings, project/transition helpers and literal dynamic imports. It
483
+ authored mappings, project and historical helpers and literal dynamic imports. It
585
484
  classifies exact distribution providers, interpreter-owned modules, app/project
586
485
  sources and unresolved/unsupported imports. Native loader diagnostics may import
587
486
  ordinary migration modules, but the audit issues no database queries and applies
@@ -608,26 +507,10 @@ under its lease and reads readiness and native migration state without repair.
608
507
  The single private recorder, durable failure/retry boundary, PostgreSQL lock and
609
508
  explicit `base_provision` table cutover are defined in [provisioning](provisioning.md).
610
509
 
611
- ## Serving composition
612
-
613
- After `django.setup()`, `django_compose.urls.urlpatterns` includes selected
614
- configs' optional `compose_urls` modules using `compose_url_prefix` (default empty)
615
- and `compose_url_namespace` (default absent). The registered native system check
616
- reports identical native matching chains as `django_compose.E001`, naming both
617
- contributing apps. Chains must have the same include boundaries, native matcher
618
- types, compiled regex text and flags, endpoint behavior, capture names and
619
- converter instances. Reverse namespaces do not distinguish matches. Different
620
- converters, differently expressed chains and custom matching implementations
621
- retain Django's ordered resolution; the check neither executes converters nor
622
- proves arbitrary regex equivalence or overlap.
623
-
624
- `django_compose.asgi.application` composes optional `config.compose_asgi()` factories
625
- returning `AsgiContribution(http_mounts=..., lifespans=..., protocols=...)`.
626
- Absolute mount paths use longest-prefix matching on path boundaries; the original
627
- path is retained and root_path extended. Unmounted HTTP uses Django's ASGIHandler.
628
- Lifespan factories enter in app order, unwind in reverse and report startup/shutdown
629
- failure. HTTP and lifespan are reserved protocols; duplicate mounts or protocol
630
- claims fail. These modules require completed setup and install no server policy.
510
+ django-compose composes no URLconf, ASGI application or command middleware.
511
+ Projects route selected apps' URLconfs with Django's native `include()` and serve
512
+ them with Django's ASGI or WSGI handlers; see
513
+ [proposal 0004](proposals/0004-serving-boundary.md).
631
514
 
632
515
  ## Typing and import boundaries
633
516