django-compose 0.1.0.dev1__py3-none-any.whl
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/__init__.py +0 -0
- django_compose/__main__.py +5 -0
- django_compose/addons.py +205 -0
- django_compose/apps.py +103 -0
- django_compose/artifacts.py +224 -0
- django_compose/asgi.py +110 -0
- django_compose/autoreload.py +110 -0
- django_compose/build.py +282 -0
- django_compose/checks.py +11 -0
- django_compose/cli.py +12 -0
- django_compose/conf.py +322 -0
- django_compose/declarations.py +168 -0
- django_compose/history.py +36 -0
- django_compose/management/__init__.py +221 -0
- django_compose/management/commands/__init__.py +1 -0
- django_compose/management/commands/check_migrations.py +57 -0
- django_compose/management/commands/compose.py +42 -0
- django_compose/management/commands/makemigrations.py +136 -0
- django_compose/management/commands/migrate.py +18 -0
- django_compose/management/commands/reset_migration_history.py +34 -0
- django_compose/management/commands/retire_history.py +24 -0
- django_compose/migration_imports.py +474 -0
- django_compose/migrations.py +843 -0
- django_compose/model_composition.py +292 -0
- django_compose/models.py +65 -0
- django_compose/py.typed +0 -0
- django_compose/rendering.py +92 -0
- django_compose/serving.py +405 -0
- django_compose/snapshot.py +419 -0
- django_compose/sources.py +147 -0
- django_compose/typing.py +633 -0
- django_compose/urls.py +58 -0
- django_compose-0.1.0.dev1.dist-info/METADATA +101 -0
- django_compose-0.1.0.dev1.dist-info/RECORD +39 -0
- django_compose-0.1.0.dev1.dist-info/WHEEL +4 -0
- django_compose-0.1.0.dev1.dist-info/entry_points.txt +2 -0
- django_compose-0.1.0.dev1.dist-info/licenses/COPYING +674 -0
- django_compose-0.1.0.dev1.dist-info/licenses/LICENSE +165 -0
- django_compose-0.1.0.dev1.dist-info/licenses/NOTICE +10 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: django-compose
|
|
3
|
+
Version: 0.1.0.dev1
|
|
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.post1; 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
|
+
One app can define a model and another can add fields and behavior to it. The
|
|
28
|
+
result is an ordinary concrete Django model, with Django's ORM and migrations.
|
|
29
|
+
|
|
30
|
+
For example, `catalog` defines an item and `reviews` adds a rating:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
catalog.Item (title) + reviews.Rating (rating, is_recommended)
|
|
34
|
+
→ concrete catalog.Item → one catalog_item table
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The reusable declarations are abstract models. An explicit `compose` command
|
|
38
|
+
writes the concrete classes into a Python package before the project runs.
|
|
39
|
+
Select the apps you need; the generated models reflect that selection. You
|
|
40
|
+
write ordinary project settings and a command launcher; django-compose supplies
|
|
41
|
+
the generated models and app configuration.
|
|
42
|
+
|
|
43
|
+
This is useful when several projects share a model but need different optional
|
|
44
|
+
capabilities. For a single project with a fixed model structure, ordinary Django
|
|
45
|
+
models and abstract bases may already be sufficient.
|
|
46
|
+
|
|
47
|
+
**Status:** development preview `0.1.0.dev1`; Python 3.14 and Django 6.1 are supported.
|
|
48
|
+
The base dependencies are Django, packaging and django-yamlconf.
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
python -m pip install django-compose==0.1.0.dev1
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
For advanced composed-model analysis, install `django-compose[typing]==0.1.0.dev1`;
|
|
55
|
+
see [typing dependencies](https://github.com/ang-ee/django-compose/blob/main/docs/dependencies.md#advanced-typing). The example below
|
|
56
|
+
uses this checkout and does not require another framework.
|
|
57
|
+
|
|
58
|
+
## Try the example
|
|
59
|
+
|
|
60
|
+
Install [uv](https://docs.astral.sh/uv/) and run these commands from the checkout
|
|
61
|
+
root. The example uses a local SQLite database.
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
uv sync --frozen --no-dev
|
|
65
|
+
uv pip install --no-deps ./examples/shop/catalog ./examples/shop/reviews
|
|
66
|
+
cd examples/shop
|
|
67
|
+
uv run --project ../.. --no-sync python manage.py compose
|
|
68
|
+
uv run --project ../.. --no-sync python manage.py makemigrations catalog auth contenttypes
|
|
69
|
+
uv run --project ../.. --no-sync python manage.py migrate
|
|
70
|
+
uv run --project ../.. --no-sync python manage.py compose --check
|
|
71
|
+
uv run --project ../.. --no-sync python verify.py
|
|
72
|
+
uv run --project ../.. --no-sync python manage.py shell
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
In the Django shell:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from django.apps import apps
|
|
79
|
+
|
|
80
|
+
Item = apps.get_model("catalog", "Item")
|
|
81
|
+
item = Item.objects.create(title="A book", rating=5)
|
|
82
|
+
assert item.is_recommended()
|
|
83
|
+
assert Item.objects.get(pk=item.pk).rating == 5
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The two apps now contribute to the same model and table. `compose` generated the
|
|
87
|
+
classes; `makemigrations` and `migrate` created and applied ordinary Django
|
|
88
|
+
history. Source apps remain installed when the generated project runs.
|
|
89
|
+
|
|
90
|
+
## Where to go next
|
|
91
|
+
|
|
92
|
+
- [Quick start](https://github.com/ang-ee/django-compose/blob/main/docs/quickstart.md): walk through the source, generated files,
|
|
93
|
+
commands and ORM result.
|
|
94
|
+
- [Model declarations](https://github.com/ang-ee/django-compose/blob/main/docs/models.md): add fields to one model or declare
|
|
95
|
+
native multi-table inheritance.
|
|
96
|
+
- [Project configuration](https://github.com/ang-ee/django-compose/blob/main/docs/configuration.md): use django-compose in your own
|
|
97
|
+
project with the current settings and `manage.py` integration.
|
|
98
|
+
- [Documentation](https://github.com/ang-ee/django-compose/blob/main/docs/README.md): optional addon selection, integrations,
|
|
99
|
+
migrations, packaging, API reference and current limitations.
|
|
100
|
+
|
|
101
|
+
The source is licensed under [LGPL-3.0-or-later](https://github.com/ang-ee/django-compose/blob/main/LICENSE).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
django_compose/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
django_compose/__main__.py,sha256=3UMaUz10MyIX8O46BUiU269LnvxdKfjImI2j2Jnl3us,135
|
|
3
|
+
django_compose/addons.py,sha256=Z7nubrAR0zwfiF9CopjlaS3xceHjxK_aikH3jh5y1qU,9472
|
|
4
|
+
django_compose/apps.py,sha256=thorhTqeNu2fw6Kx4oguoPqsyYwvkiKnvQbAGeLKB6c,4157
|
|
5
|
+
django_compose/artifacts.py,sha256=wtfNrRmmxYk_rAZZl7PyfmPMwSIKhIIO-Xek_z0pPGw,9452
|
|
6
|
+
django_compose/asgi.py,sha256=EllgrrF3fMEQXNd3YR5JvijKaKFHqPI2Lv2PtmQ4ZKA,5151
|
|
7
|
+
django_compose/autoreload.py,sha256=Obguzio30T42nIjSX9HVmrU-CqtTrm7moU0Wd271Egg,4128
|
|
8
|
+
django_compose/build.py,sha256=2tddXLBjdH0jWU4bk3RkQS2AQ779fsINrhB0o-8t0oY,12519
|
|
9
|
+
django_compose/checks.py,sha256=68mO4E6_UPYhya9wjO-SsQ2YFnDSl0q_fI8r-DnSTZ0,366
|
|
10
|
+
django_compose/cli.py,sha256=PeFfopjMvOotpwk1tzqsbIniahP8SVwIAapT6QBwXbw,311
|
|
11
|
+
django_compose/conf.py,sha256=lPYs7625qt8b8pw-h3FyJZLUvQS3N9MFSv1tQ7Nrf3A,14558
|
|
12
|
+
django_compose/declarations.py,sha256=JJ09haPmgua4h2P9T8-fMos3CWHdQMpWkw15gXlL1nM,6900
|
|
13
|
+
django_compose/history.py,sha256=-D9jT-2EvKH6HDo3EfDeTD6lxUirgQOxeDh4cJKLoAU,1291
|
|
14
|
+
django_compose/migration_imports.py,sha256=AuK2HdfesyuN55_-eQ_lROnxLqh6z_BZ36vRJP-KFoE,22066
|
|
15
|
+
django_compose/migrations.py,sha256=8zC16RN_PBbcu1U_7rU4EYIx4v6Og1Omw4tyxage_Ow,39353
|
|
16
|
+
django_compose/model_composition.py,sha256=g07bVAsQUAPE27lvXmCKmDpXh3Bpo3kYM7-tf1OqDkA,15003
|
|
17
|
+
django_compose/models.py,sha256=hM0ed-sotXh2vdI0zNESYnX_qS_39_IHwAk4jZnpYXU,2512
|
|
18
|
+
django_compose/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
django_compose/rendering.py,sha256=1OFZU7lLMO2rD4S9K1-g8wvdn8RKBnUuQTFPHnDWsHY,3647
|
|
20
|
+
django_compose/serving.py,sha256=kOEKik7Oe0CLDmGviHjtP3z3ZUn8xnjdG0z53WMM0KY,15499
|
|
21
|
+
django_compose/snapshot.py,sha256=zHCcttz7j8ReFHMMUn7iKgpbvZuWIQfnqJ9YHkzg6CA,17728
|
|
22
|
+
django_compose/sources.py,sha256=zusV-sFM9KnW6zyb05Dvag1APU_ABZlqL47W1xwvssI,6094
|
|
23
|
+
django_compose/typing.py,sha256=aUhIPOvYQIFb-LLPUQnmOsg8sE6AiJA-NbBvfbNaC5k,30467
|
|
24
|
+
django_compose/urls.py,sha256=pIWRJ2stsL7Cf29S0ET9yBs161hGWdUy7LeYIXB1f_o,1987
|
|
25
|
+
django_compose/management/__init__.py,sha256=g-KOLVJtMofsizi8FvTly9sGtLc9cM_EKTXnPQR_h-M,8659
|
|
26
|
+
django_compose/management/commands/__init__.py,sha256=_mgOwmIp5-GhgJd6tY4Wc89G0EJDiHF9tYo8F63ytm8,40
|
|
27
|
+
django_compose/management/commands/check_migrations.py,sha256=CIGGQCq-01Cm0_ZR7Exl4EtM_-qnFfhzfMsLxhl8P5A,2918
|
|
28
|
+
django_compose/management/commands/compose.py,sha256=UuNjIgNwYOYE_1aKIcEvh3C1fMjP9tdN_-SDDwVQjIc,1860
|
|
29
|
+
django_compose/management/commands/makemigrations.py,sha256=CliPK4u1SRK-_Ww0zuG8M_FWCl_ku4Aje7czW1Y8hjg,6087
|
|
30
|
+
django_compose/management/commands/migrate.py,sha256=_MkiQRjQRwIr9dEUnKk4WEjLgz5FTH_Tmn6ZkKHgOMA,589
|
|
31
|
+
django_compose/management/commands/reset_migration_history.py,sha256=PD3baeH1jQHIXXLaEYyxZXfhVYfJLzTXnv-XF1ySULQ,1489
|
|
32
|
+
django_compose/management/commands/retire_history.py,sha256=3RV1-w5Niij0svr0gB_gAjBgskxCYtdg5pPfsGN287s,886
|
|
33
|
+
django_compose-0.1.0.dev1.dist-info/METADATA,sha256=x0AmaHtBkPZx10vuu3tE_TGdwL5UReF2b0t0Zf7KKOo,4323
|
|
34
|
+
django_compose-0.1.0.dev1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
35
|
+
django_compose-0.1.0.dev1.dist-info/entry_points.txt,sha256=-Iw1c8YAegCC53YCKgPXjIZn4aPS3MmEKbcMrCpUMFU,59
|
|
36
|
+
django_compose-0.1.0.dev1.dist-info/licenses/COPYING,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
|
37
|
+
django_compose-0.1.0.dev1.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
38
|
+
django_compose-0.1.0.dev1.dist-info/licenses/NOTICE,sha256=C4fEGI9_-a1GCPfAH9bC0ZvmZFS71b9Z4v6rjrT5dxA,450
|
|
39
|
+
django_compose-0.1.0.dev1.dist-info/RECORD,,
|