django-strata 0.2.0__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.
@@ -0,0 +1,543 @@
1
+ Metadata-Version: 2.5
2
+ Name: django-strata
3
+ Version: 0.2.0
4
+ Summary: Layered page composition for Django: a declarative layer/slot registry and a page-strategy middleware.
5
+ Project-URL: Homepage, https://gitlab.com/co-plus-plus/django-strata
6
+ Project-URL: Repository, https://gitlab.com/co-plus-plus/django-strata.git
7
+ Project-URL: Changelog, https://gitlab.com/co-plus-plus/django-strata/-/blob/main/CHANGELOG.md
8
+ Author: Fraunhofer FOKUS
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Web Environment
13
+ Classifier: Framework :: Django
14
+ Classifier: Framework :: Django :: 5.2
15
+ Classifier: Framework :: Django :: 6.0
16
+ Classifier: Framework :: Django :: 6.1
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
22
+ Requires-Python: >=3.12
23
+ Requires-Dist: django>=5.2
24
+ Description-Content-Type: text/markdown
25
+
26
+ <div align="center">
27
+ <img src="docs/assets/logo.png" alt="django-strata logo" width="440">
28
+ <h1>django-strata</h1>
29
+ <p><strong>Layered rendering engine for Django</strong></p>
30
+ </div>
31
+
32
+ Layered page composition for Django: a declarative **layer/slot registry**,
33
+ a **page-strategy middleware**, and a **URL-primary theme template loader**.
34
+
35
+ Selection is **URL-primary**: the URL decides which theme's shell renders —
36
+ per URL areas can use different themes' shells. The middleware matches the
37
+ request's URL path against the layer registry, publishes the shell layer's
38
+ theme in a request-scoped contextvar, and the theme's page strategy shapes
39
+ every response whose request matched a themed area. The view never mentions
40
+ the rendering engine — shells, chrome slots and fragment swap policies are
41
+ the theme's implementation details.
42
+
43
+ - **Python** ≥ 3.12 · **Django** ≥ 5.2 (5.2, 6.0, 6.1 tested in CI)
44
+ - **Runtime deps**: Django — nothing else
45
+
46
+ ## Why django-strata?
47
+
48
+ **The problem it solves.** Django's template stack is site-global: one
49
+ `TEMPLATES` configuration, one set of template dirs, one implicit "current
50
+ look". Real projects are not. The same deployment needs a dense chrome for
51
+ the internal admin and a marketing shell for the portal; HTMX endpoints must
52
+ return fragments while normal navigation returns full pages; third-party URL
53
+ areas (django admin, allauth) can't be themed selectively at all. Without
54
+ help, that complexity leaks into every view: `request.htmx` branches,
55
+ template-name juggling, a site-wide "current theme" setting behind a context
56
+ processor — and full-page and fragment templates that drift apart one commit
57
+ at a time.
58
+
59
+ **How it helps.** strata moves page composition out of the views into a
60
+ declarative, URL-scoped registry:
61
+
62
+ - **The URL decides.** A layer registry maps URL areas to shell layers and
63
+ their themes — per URL areas render different themes' shells in one
64
+ deployment, with no per-view flags and no site-wide theme state.
65
+ - **Views stay engine-agnostic.** A theme-registered
66
+ `page_strategy(request, response)` shapes every response whose request
67
+ matched a themed area: full page or HTMX partial is decided in one place,
68
+ so the two shapes cannot diverge. The view never mentions the rendering
69
+ engine.
70
+ - **Forms theme-match the shell.** A `FORM_RENDERER` line and a per-theme
71
+ registration: every form in the deployment — third-party apps' forms
72
+ included — renders through the request's shell theme's registered
73
+ renderer. The form never mentions the engine.
74
+ - **Themes are convention, not configuration.** Shell chrome slots
75
+ autodiscover from the theme's `partials/` folder; `{% theme_static %}` and
76
+ the theme template loader resolve theme-owned assets and templates; a file
77
+ a theme doesn't ship falls through to Django's native loader-chain
78
+ semantics unchanged.
79
+ - **Misconfiguration fails at deploy time.** `manage.py check`
80
+ (`strata.W001`–`W005`, `E002`–`E007`) catches silent-empty layers, missing
81
+ loader wiring, inert form renderers and unresolvable shell templates
82
+ before they reach production.
83
+
84
+ **What that buys you**: layered page composition with zero runtime
85
+ dependencies beyond Django — no models, no migrations, no context processor,
86
+ no HTMX dependency, no global theme state. Your `TEMPLATES["DIRS"]` stays
87
+ yours; strata never reads, writes, or reorders it.
88
+
89
+ ## Quickstart
90
+
91
+ ```bash
92
+ pip install django-strata
93
+ ```
94
+
95
+ Wire the app, middleware, static finder and template loader
96
+ (`config/settings/base.py`):
97
+
98
+ ```python
99
+ INSTALLED_APPS = [
100
+ # ...
101
+ "strata",
102
+ ]
103
+
104
+ MIDDLEWARE = [
105
+ # ...
106
+ "django_htmx.middleware.HtmxMiddleware", # if your strategy reads request.htmx
107
+ "strata.middleware.ThemedPageMiddleware", # after any middleware it reads
108
+ ]
109
+
110
+ STATICFILES_FINDERS = [
111
+ # ...
112
+ "strata.finders.ThemeStaticFinder",
113
+ ]
114
+
115
+ TEMPLATES = [
116
+ {
117
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
118
+ "DIRS": [BASE_DIR / "templates"], # yours — strata never touches it
119
+ # "loaders" overrides APP_DIRS (the engine refuses both), so the
120
+ # app-dir scan rides inside the cached wrapper below.
121
+ "APP_DIRS": False,
122
+ "OPTIONS": {
123
+ # No strata context processor: the package ships none.
124
+ "loaders": [
125
+ "strata.loaders.ThemeTemplateLoader", # outside the wrapper
126
+ (
127
+ "django.template.loaders.cached.Loader",
128
+ [
129
+ "django.template.loaders.filesystem.Loader",
130
+ "django.template.loaders.app_directories.Loader",
131
+ ],
132
+ ),
133
+ ],
134
+ },
135
+ },
136
+ ]
137
+ ```
138
+
139
+ Register the asset roots **at settings load** — see the ordering contract
140
+ below:
141
+
142
+ ```python
143
+ from pathlib import Path
144
+
145
+ import strata.context
146
+
147
+ BASE_DIR = Path(__file__).resolve().parent.parent.parent
148
+ THEMES_DIR = BASE_DIR / "themes"
149
+
150
+ # Precedence-ordered (namespace, dir) pairs — the order given is the
151
+ # resolution order: {% theme_static %} walks the pairs, and the first
152
+ # registered static pair is the fallback namespace for unresolved
153
+ # assets. Namespaces are implicit: a namespace is whatever slug appears
154
+ # as a pair key here or as a root layer's theme= below. There is no
155
+ # site theme and no registration flags.
156
+ strata.context.register_template_dirs(
157
+ [(slug, THEMES_DIR / slug / "templates" / slug) for slug in ("mytheme", "base")]
158
+ )
159
+ strata.context.register_static_dirs(
160
+ [(slug, THEMES_DIR / slug / "static") for slug in ("mytheme", "base")]
161
+ )
162
+ # No TEMPLATE_ENGINE_DIRS: strata's registries are strata's own. The
163
+ # engine's TEMPLATES["DIRS"] above stays yours — strata never reads,
164
+ # writes, or reorders it, and nothing registered here needs to be fed
165
+ # into it.
166
+ ```
167
+
168
+ Templates load the package tags:
169
+
170
+ ```django
171
+ {% load strata_tags %}
172
+ <link rel="stylesheet" href="{% theme_static 'css/theme.css' %}">
173
+ {% slot "app-header" "partials/default-header.html" %}
174
+ ```
175
+
176
+ ## The registration protocol
177
+
178
+ Everything is a registration call made from **settings load** (asset roots,
179
+ loader wiring) or from a theme app's **`AppConfig.ready()`** (layers, page
180
+ strategy). No settings beyond what you see above, no filesystem scanning by
181
+ the package.
182
+
183
+ **Ordering contract — roots before `ready()`.** The template/static roots
184
+ must be registered at settings load, *before* `django.setup()` populates the
185
+ app registry: a theme's layers autodiscover their partials through the
186
+ registered template roots in `AppConfig.ready()`. Registering the roots
187
+ after app load leaves every layer silently empty — no shell chrome, no
188
+ partial, and no check catches it.
189
+
190
+ ### 1. Asset roots (settings load)
191
+
192
+ `register_template_dirs` and `register_static_dirs` take precedence-ordered
193
+ `(namespace, dir)` pairs — **the order given is the resolution order**:
194
+ `{% theme_static %}` walks the pairs in order, and the first registered
195
+ static pair is the fallback namespace for unresolved assets. Namespaces are
196
+ implicit: a namespace is whatever slug appears as a pair key or as a root
197
+ layer's `theme=`. There is no site theme and no registration flags.
198
+
199
+ These are **strata-internal registries** — the
200
+ theme template loader and the static finder read them. `TEMPLATES["DIRS"]`
201
+ stays user-owned: strata never reads, writes, or reorders it, and nothing
202
+ registered here needs to be fed into it (the old
203
+ `TEMPLATE_ENGINE_DIRS = list(template_roots())` reuse is gone).
204
+
205
+ ### 2. Template loader wiring (settings)
206
+
207
+ `ThemeTemplateLoader` must be wired into `TEMPLATES` `OPTIONS["loaders"]`,
208
+ **before** (outside) the `cached.Loader` wrapper that wraps your defaults:
209
+
210
+ ```python
211
+ "OPTIONS": {
212
+ # ...
213
+ "loaders": [
214
+ "strata.loaders.ThemeTemplateLoader", # outside the wrapper
215
+ (
216
+ "django.template.loaders.cached.Loader",
217
+ [
218
+ "django.template.loaders.filesystem.Loader",
219
+ "django.template.loaders.app_directories.Loader",
220
+ ],
221
+ ),
222
+ ],
223
+ }
224
+ ```
225
+
226
+ Two caveats:
227
+
228
+ - Setting `OPTIONS["loaders"]` **disables template caching** unless a
229
+ `cached.Loader` is included — hence the wrap above. (A bare
230
+ `"django.template.loaders.cached.Loader"` string is not valid: the wrapper
231
+ takes the loaders it wraps as a tuple.)
232
+ - The theme loader sits **outside** the wrapper: `cached.Loader` caches by
233
+ template name only, so a theme-resolved template inside it would be served
234
+ to every other theme. Outside, the loader is consulted first on every
235
+ render and the cache only holds theme-independent user-dir resolutions —
236
+ theme-resolved templates pay their lookup and compile per request.
237
+
238
+ The system checks (`strata.W001`–`W004`) verify the wiring.
239
+
240
+ ### 3. Layers (theme `AppConfig.ready()`)
241
+
242
+ ```python
243
+ from django.apps import AppConfig
244
+
245
+
246
+ class MyThemeConfig(AppConfig):
247
+ name = "themes.mytheme"
248
+
249
+ def ready(self):
250
+ from strata.middleware import register_page_strategy
251
+ from strata.registry import Layer
252
+ from strata.registry import autodiscover_slots
253
+ from strata.registry import register_layer
254
+
255
+ # Root layers are shells: <slug>/base.html (or <template>/base.html).
256
+ # The theme= namespace drives template, static, and page-strategy
257
+ # resolution when the layer is the request's shell. Chrome slots
258
+ # come from the shell's partials/ folder via the autodiscover
259
+ # helper — id = file stem = the DOM target it fills.
260
+ register_layer(
261
+ Layer(slug="mytheme-admin", default=True, theme="mytheme",
262
+ slots=autodiscover_slots("mytheme-admin"))
263
+ )
264
+ # A second root layer with a different match: the /alt/ URL area
265
+ # renders the other theme's shell — one deployment, two themes'
266
+ # shells, selected by the URL.
267
+ register_layer(
268
+ Layer(slug="other-admin", match=("alt",), theme="other",
269
+ slots=autodiscover_slots("other-admin"))
270
+ )
271
+ # Area layers declare a parent shell and the dotted URL-namespace
272
+ # prefixes they serve; an app owns its sidebar by declaring an
273
+ # app-sidebar slot (one app == one sidebar).
274
+ register_layer(
275
+ Layer(slug="users", match=("users",), parent="mytheme-admin",
276
+ slots=autodiscover_slots("users"))
277
+ )
278
+ register_page_strategy(page_strategy, namespace="mytheme")
279
+ register_page_strategy(other_page_strategy, namespace="other")
280
+ ```
281
+
282
+ - `Layer(slug, match=(), parent=None, slots=(), default=False, template=None,
283
+ theme=None)` — later registration wins per slug (a theme overrides base by
284
+ re-registering the same slug); `default=True` must be a root layer and
285
+ displaces the previous default; `template=` decouples the registry key
286
+ from the template namespace dir; `theme=` names the namespace whose
287
+ template dir, static dir, and page strategy apply when the layer is the
288
+ request's shell (root layers). A shell layer without a theme leaves its
289
+ requests unthemed.
290
+ - `autodiscover_slots(slug, roots=None, namespace=None)` scans
291
+ `<slug>/partials/*.html` in every registered template root in registration
292
+ order (first match wins, so an earlier root's partial overrides later
293
+ ones); helper partials under `partials/includes/` are skipped.
294
+
295
+ ### 4. Page strategy (theme `AppConfig.ready()`)
296
+
297
+ `register_page_strategy(strategy, namespace=...)` registers a
298
+ `page_strategy(request, response)` callable. Lookup is the request's shell
299
+ theme's strategy first, then the first-registered
300
+ one — the URL decides, per URL area. The strategy returns the response, sets
301
+ the real `template_name` (full page or partial) and fills
302
+ `response.context_data` with `base_template`, `fragment_template` and
303
+ `slots`. The HTMX engine templates and swap policies stay in your theme —
304
+ the package is engine-agnostic.
305
+
306
+ ### 5. Form renderers (theme `AppConfig.ready()`)
307
+
308
+ Forms theme-match the shell that renders them: register a renderer per
309
+ theme namespace and wire one `FORM_RENDERER` line — every form in the
310
+ deployment, third-party apps' forms included, renders through the request's
311
+ shell theme's registered renderer. The dispatch unit is the **request's
312
+ shell theme**: all forms rendered during a request whose URL resolves to
313
+ the `mytheme` shell resolve to `mytheme`'s renderer.
314
+
315
+ ```python
316
+ # config/settings/base.py — the shipped dispatcher reads the
317
+ # request-scoped theme contextvar on every form-render call; the view
318
+ # and the form never mention the engine.
319
+ FORM_RENDERER = "strata.forms.StrataFormRenderer"
320
+ ```
321
+
322
+ ```python
323
+ from django.apps import AppConfig
324
+
325
+
326
+ class MyThemeConfig(AppConfig):
327
+ name = "themes.mytheme"
328
+
329
+ def ready(self):
330
+ from strata.forms import ThemeFormRenderer, register_form_renderer
331
+
332
+ # The fast-engine theme renderer: a standalone DjangoTemplates
333
+ # backend over strata's registered template roots. Theme form
334
+ # partials shadow the stock names: mytheme/forms/div.html renders
335
+ # instead of django/forms/div.html (the partial tree mirrors the
336
+ # stock tree under <theme>/forms/).
337
+ register_form_renderer(
338
+ ThemeFormRenderer(namespace="mytheme"), namespace="mytheme"
339
+ )
340
+ ```
341
+
342
+ - **The fallback is configurable.** A themed request whose theme registered
343
+ no renderer — and every unthemed request (admin, emails, management
344
+ commands) — falls back per the dispatcher's mode:
345
+ `"strata.forms.StrataFormRenderer"` (the default) renders **stock Django**
346
+ forms; `"strata.forms.FirstRegisteredFormRenderer"` renders with the
347
+ **first-registered** renderer (the contextvar being unset included — the
348
+ same first-registered invariant as the page strategy). An empty registry
349
+ always falls back to stock Django — forms must render, so the dispatcher
350
+ never raises. Subclassing with a custom `fallback` is the extension
351
+ point: the two valid mode strings are `FALLBACK_DJANGO` and
352
+ `FALLBACK_FIRST_REGISTERED` — anything else raises
353
+ `ImproperlyConfigured` at class definition.
354
+ - **`register_form_renderer` accepts a class or an instance** — classes are
355
+ instantiated lazily on first resolution; the class is recommended (the
356
+ `FORM_RENDERER` dotted-path convention). Later registration wins per
357
+ namespace.
358
+ - **The per-form escape hatch** is Django's own seam: `Form(renderer=...)`
359
+ / `form.renderer = SomeRenderer()` (and `default_renderer`) beat the
360
+ global default, dispatcher or not.
361
+ - **No context processors, ever.** The shipped theme renderer builds the
362
+ standalone fast form-render engine (`NAME: "strata-forms"`, `OPTIONS: {}`,
363
+ `DIRS` from strata's registered template roots plus the stock
364
+ `django/forms/*` templates, `APP_DIRS: True`) — a dedicated engine per
365
+ renderer instance, no request-scoped lookups inside template resolution.
366
+ - **`strata.W005`** warns when a renderer is registered but `FORM_RENDERER`
367
+ is not wired to the dispatcher — the registration is inert.
368
+
369
+ ## Two independent template mechanisms
370
+
371
+ The user's `TEMPLATES["DIRS"]` (and `APP_DIRS`) and strata's registries are
372
+ independent mechanisms: strata never reads, writes, or reorders your `DIRS`,
373
+ and nothing registered with `register_template_dirs` needs to be fed into
374
+ it. The loader chain resolves the difference:
375
+
376
+ ```
377
+ strata-rendered template (shell, slot partial):
378
+ 1. <shell layer's theme dir> ← URL match (strata loader)
379
+ 2. user's DIRS[0..n] ← next loader in chain (user-owned)
380
+ 3. app templates (APP_DIRS) ← if the user keeps that loader
381
+
382
+ plain view template (render(request, "page.html")):
383
+ 1. user's DIRS[0..n] ← loader chain; strata is a no-op
384
+ ```
385
+
386
+ A template the shell theme's dir does not ship falls through to your
387
+ loaders unchanged — the fallback is Django's native loader-chain semantics.
388
+ Without a request (`collectstatic`, `manage.py check`) the theme loader is
389
+ a pure pass-through and your `DIRS` resolve everything.
390
+
391
+ ## Participation
392
+
393
+ Participation in the theme's page model is **URL-area membership**: every
394
+ `TemplateResponse` whose request matched a themed layer is shaped by the
395
+ theme's page strategy — no flag required. A view serves a *fragment*:
396
+
397
+ ```python
398
+ class UserDetailView(LoginRequiredMixin, DetailView):
399
+ template_name = "users/partials/detail.html" # the fragment
400
+ ```
401
+
402
+ - Normal requests render the **full page** (fragment wrapped in the
403
+ resolved shell); HTMX-style requests render the theme's **partial**
404
+ shape. The strategy decides — the view never branches on the engine.
405
+ - The fragment is one slot among the chrome (`main-container` by
406
+ convention); the shells render their chrome from the same slot list the
407
+ partial renders, so full and partial responses cannot diverge.
408
+ - `ThemedPageMiddleware` runs on `process_template_response`, so plain
409
+ `HttpResponse`s (redirects, widget endpoints) are structurally exempt.
410
+ - **Opt-out**: `themed_page = False` marks a response that must render bare
411
+ inside a themed area (print view, iframe target) — as a view class
412
+ attribute or set directly on a hand-rolled `TemplateResponse`. Absent on
413
+ both, the response is shaped — function-based views included.
414
+ - There is no opt-in: `themed_page = True` means nothing (the old
415
+ required-flag gate is gone).
416
+
417
+ **The implicit catch-all.** A URL that matches no layer falls through to
418
+ the default root layer (`default=True`) — there is no "no layer" case. If
419
+ the default root carries `theme=`, that theme's strategy shapes every
420
+ unmatched URL too: the default root *is* the site-wide theme, and `match`
421
+ declarations carve themed area overrides out of it. An explicit catch-all
422
+ `match` cannot reproduce this — `""` and `^` match nothing
423
+ (`strata.W003` warns) — so the implicit fall-through is load-bearing.
424
+
425
+ **Third-party full-HTML URL areas** (django admin, allauth, jazzmin):
426
+ their views can't carry `themed_page = False`, so carve their URL prefix
427
+ out with an **unthemed root layer** — matched, theme-less, no shell
428
+ template needed (an unthemed root's shell never renders, so
429
+ `manage.py check` doesn't require one):
430
+
431
+ ```python
432
+ # any AppConfig.ready() — the theme's or the project's
433
+ register_layer(Layer(slug="admin-bare", match=("admin",)))
434
+ ```
435
+
436
+ Requests under `/admin/` resolve to an unthemed shell: the contextvar
437
+ stays unset, `ThemedPageMiddleware` leaves every response untouched, and
438
+ the `ThemeTemplateLoader` passes through — the plain Django template
439
+ pipeline.
440
+
441
+ **Fully opt-in participation** — the inverse configuration: register the
442
+ default root *without* a theme and give every themed area its own root
443
+ layer with `match` + `theme`:
444
+
445
+ ```python
446
+ register_layer(Layer(slug="plain", default=True)) # unmatched → plain pipeline
447
+ register_layer(Layer(slug="portal", match=("portal",), theme="ocean"))
448
+ ```
449
+
450
+ Unmatched URLs then run the plain Django pipeline end to end; only URL
451
+ areas covered by a themed root are shaped. `strata.W002` still demands at
452
+ least one themed root when any layer is registered — an install that
453
+ shapes nothing is a misconfiguration, not a mode.
454
+
455
+ **Behavioral cliff for existing deployments.** With URL-primary selection,
456
+ the layer registry's `match` is load-bearing: a root layer whose match
457
+ covers a wide URL area shapes *every* `TemplateResponse` under it — there
458
+ is no per-view opt-in to hide behind; the remedy is an area-level
459
+ unthemed root layer (above). Root layers carry `theme=` — without
460
+ a themed root nothing is ever shaped (`strata.W002` warns), and the loader
461
+ must be wired (`strata.W001`). `themed_page = True` attributes are inert
462
+ (membership is the URL); `themed_page = False` keeps its meaning — it opts
463
+ a response out.
464
+
465
+ ## Process-static state
466
+
467
+ The registries are process-static data populated at settings/app load:
468
+ re-registering asset roots or layers after startup does not affect the
469
+ running process — a restart re-runs the settings module and the
470
+ `AppConfig.ready()` registrations, exactly like `{% theme_static %}`'s
471
+ cached resolution. **Tests are the escape hatch** — re-register the layer
472
+ and its strategy:
473
+
474
+ ```python
475
+ from strata.forms import clear_form_renderers
476
+ from strata.middleware import clear_strategies
477
+ from strata.registry import clear_registry
478
+
479
+ clear_registry() # empty the layer registry …
480
+ clear_strategies() # … and the page-strategy registry …
481
+ clear_form_renderers() # … and the form-renderer registry …
482
+ register_layers() # … then re-register through your theme's
483
+ # register_layers() helper (AppConfig.ready()),
484
+ # which pairs each layer with its page strategy
485
+ ```
486
+
487
+ (`strata.context.clear_context()` empties the asset-root registries; the
488
+ package's own test suite isolates through exactly these.)
489
+
490
+ ## System checks
491
+
492
+ `manage.py check` is a deploy-time net for what would otherwise fail late
493
+ or silently:
494
+
495
+ | id | fires when |
496
+ |---|---|
497
+ | `strata.E002` | a layer is registered but no theme registered a page strategy |
498
+ | `strata.E003` | a *themed* root layer's shell template does not resolve **or compile** in any configured engine (an unthemed root's shell never renders — skipped) |
499
+ | `strata.E004` | a layer declares a parent that is not registered |
500
+ | `strata.E005` | a layer's parent chain closes on itself |
501
+ | `strata.E006` | a layer is registered but no layer is the default root |
502
+ | `strata.E007` | an unexpected layer-chain failure (defensive fallback — please report) |
503
+ | `strata.W001` | `ThemeTemplateLoader` missing from `TEMPLATES` options (a loader nested inside the `cached.Loader` wrapper counts as missing) — URL themes silently don't render |
504
+ | `strata.W002` | layers registered but no root layer carries a `theme` — the contextvar is never set and nothing is ever shaped |
505
+ | `strata.W003` | a root layer declares a catch-all match (`""` / `^`) — matches are load-bearing now, keep registrations deliberate |
506
+ | `strata.W004` | `ThemeTemplateLoader` wired *after* the `cached.Loader` wrapper — the user's loaders resolve first, so same-name templates shadow the theme dir |
507
+ | `strata.W005` | form renderers registered but `FORM_RENDERER` not wired to a strata form-render dispatcher — every registration is inert |
508
+
509
+ `strata.E001` (the site-theme check) was retired during development with
510
+ the theme-settings store; the remaining ids are unchanged.
511
+
512
+ Checks E002–E007 and the loader/themed-root/match warnings (W001–W004) only
513
+ run when a layer is registered — a static-only deployment (asset roots, no
514
+ layers) legitimately runs no strata checks. `strata.W005` gates on
515
+ form-renderer registration itself — independent of the layer gate: any
516
+ registered renderer opts the deployment into the wiring check.
517
+
518
+ ## Development
519
+
520
+ ```bash
521
+ make install # uv sync (creates .venv)
522
+ make test # pytest
523
+ make lint # ruff check + format check
524
+ make typecheck # mypy
525
+ make release # semantic-release --noop (add NOOP= for real)
526
+ ```
527
+
528
+ A real tag push (`NOOP= make release`) needs `GITLAB_PAT` in the
529
+ environment — a GitLab personal access token with `api` and
530
+ `write_repository` scopes, read via the `remote.token =
531
+ { env = "GITLAB_PAT" }` setting.
532
+
533
+ CI runs ruff, mypy, the suite against Django 5.2, 6.0 and 6.1, and the
534
+ example smoke check (`python example/manage.py check`) on the locked
535
+ versions.
536
+
537
+ The `example/` project is a runnable demo of the whole concept — two
538
+ themes, one deployment, app-side theme settings and a Jinja2 engine
539
+ alongside Django templates. See [example/README.md](example/README.md).
540
+
541
+ ## License
542
+
543
+ Apache-2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,16 @@
1
+ strata/__init__.py,sha256=RObry_Qy04fnh8lt-EHEQlem8v2lztzLGLMLJbQuGxI,711
2
+ strata/apps.py,sha256=9GIOLUDZfKe1TIx-Ht3shP92wHmmKasCMGl_l7hCx10,522
3
+ strata/checks.py,sha256=uDzDAwJMIVRZz_4hmra47MHjwqJBnjVpq43aJwlr22M,21008
4
+ strata/context.py,sha256=m32RLwK76o5hk3hED76dyfvG_rsG4Yx-8bzaT98allw,5991
5
+ strata/finders.py,sha256=o2gaoAMhSdT5zC7AjG4l2FSbY6cDCmA_bNQcNXr03ls,1396
6
+ strata/forms.py,sha256=dS03pqfwSkfT7A-vbRsvqHNt1zpLSqVZRG7UdwI64yw,15727
7
+ strata/loaders.py,sha256=cyyk4TZhNnRWbnMygyuCYccWg3JRNM4Qr5Bl8xGgoIw,4914
8
+ strata/middleware.py,sha256=d0VrSW8W-nEFhXbuinsHqUBETLBmLF0JYSy_yz_h9Hw,5861
9
+ strata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ strata/registry.py,sha256=RXh8IIYPeqfNBaSJW7ZM9d96sQ3n2zOn-LvTs5Zmh90,12921
11
+ strata/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ strata/templatetags/strata_tags.py,sha256=M7VYcC9naxH_HGUA0Blgd1WuC5LV2TbaBVqU2huAQmQ,4492
13
+ django_strata-0.2.0.dist-info/METADATA,sha256=1uhSVYTzDq0zGSsqYgQaTPGXtX2vX2lvj_2vj0uSvSg,24560
14
+ django_strata-0.2.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
15
+ django_strata-0.2.0.dist-info/licenses/LICENSE,sha256=G-MIEdD35ZHJddG41-EvAZOm1BEFsRXTq3GwkUIJfxk,11346
16
+ django_strata-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any