Category tree for the Stapel framework
Project description
stapel-categories
Category tree with typed features for the Stapel framework — composable Django apps that deploy as a monolith or as microservices without changing module code.
A hierarchical category tree (django-treenode) and a parallel feature
tree whose typed config is validated by
stapel-attributes. Categories
own the tree structure, feature inheritance, the ordered category↔feature M2M,
and the feature-editor lifecycle; the attribute engine (types, config/DTO/DAO
validation, polymorphic serializers, admin widgets) lives in stapel-attributes
and is imported, never re-implemented.
Install
pip install stapel-categories
INSTALLED_APPS = [
# ...
"treenode", # django-treenode (tree-cache signals)
"stapel_categories",
]
# urls.py — the host chooses the prefix
path("categories/", include("stapel_categories.urls"))
stapel-attributes is an imported library (no app to install); its config
editor ships static assets, so run collectstatic if you use the admin.
Settings
All configuration lives in the STAPEL_CATEGORIES namespace (dict setting,
flat setting, or env var — resolved lazily):
| Key | Default | Meaning |
|---|---|---|
CAROUSEL_CACHE_TIMEOUT |
300 |
Seconds the carousel response is cached. |
FEATURE_DISPLAY_CACHE_TIMEOUT |
60 |
Seconds an admin feature display label is memoized. |
DISPLAY_TRANSLATOR |
stapel_categories.translation.identity_translator |
Dotted path (key)->str for rendering translation keys (default: identity). |
comm surface
| Kind | Name | Contract |
|---|---|---|
| Function | categories.features |
{"category_id": int} -> {"category_id", "revision", "features":[{id,slug,name,mandatory,config}]} — resolved schema (own + inherited), cacheable by revision |
| Action (emit) | category.changed |
{"category_id": int, "revision": int} on any category/feature mutation — for downstream cache invalidation |
categories.features lets stapel-listings validate attribute values against a
category's schema without importing this module.
Extension points
See MODULE.md — the agent-facing map of every fork-free seam (settings, serializer seams, comm surface, feature-editor actions, admin-UI pointer to stapel-attributes).
Development
pip install -e . && pip install pytest pytest-django ruff
./setup-hooks.sh
pytest tests/
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stapel_categories-0.4.2.tar.gz.
File metadata
- Download URL: stapel_categories-0.4.2.tar.gz
- Upload date:
- Size: 89.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
680c0cc10a688b38d63f1bd5bb6e395fb2d3d83aeb4324b69cdbb989e570c6f4
|
|
| MD5 |
9b8b206fde5e9324279da0e1acc2f3cf
|
|
| BLAKE2b-256 |
43de6a8cf3d0ca9e61a7610dab412befab56804e16f57bce23965eb37c675cc8
|
Provenance
The following attestation bundles were made for stapel_categories-0.4.2.tar.gz:
Publisher:
publish.yml on usestapel/stapel-categories
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stapel_categories-0.4.2.tar.gz -
Subject digest:
680c0cc10a688b38d63f1bd5bb6e395fb2d3d83aeb4324b69cdbb989e570c6f4 - Sigstore transparency entry: 2177080275
- Sigstore integration time:
-
Permalink:
usestapel/stapel-categories@73d5da36126a45f964f5aa80947c00c8c9c8f988 -
Branch / Tag:
refs/tags/v0.4.2 - Owner: https://github.com/usestapel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@73d5da36126a45f964f5aa80947c00c8c9c8f988 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stapel_categories-0.4.2-py3-none-any.whl.
File metadata
- Download URL: stapel_categories-0.4.2-py3-none-any.whl
- Upload date:
- Size: 67.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5796f7f7a4c1334d4dbd614cd89a1ddf4f3681ca0e2e803d4e10ecf2697e803
|
|
| MD5 |
ca6000fad2b958c01d576209a2b19d55
|
|
| BLAKE2b-256 |
50b3dd07456937bbd67c4a85c143e14e25355484051f437125294883b0488df2
|
Provenance
The following attestation bundles were made for stapel_categories-0.4.2-py3-none-any.whl:
Publisher:
publish.yml on usestapel/stapel-categories
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stapel_categories-0.4.2-py3-none-any.whl -
Subject digest:
e5796f7f7a4c1334d4dbd614cd89a1ddf4f3681ca0e2e803d4e10ecf2697e803 - Sigstore transparency entry: 2177080549
- Sigstore integration time:
-
Permalink:
usestapel/stapel-categories@73d5da36126a45f964f5aa80947c00c8c9c8f988 -
Branch / Tag:
refs/tags/v0.4.2 - Owner: https://github.com/usestapel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@73d5da36126a45f964f5aa80947c00c8c9c8f988 -
Trigger Event:
push
-
Statement type: