Skip to main content

stapel-docs

CI coverage pypi downloads python license llms.txt

Google-Drive-style workspace documents: a folder tree, one-entity-per-type documents over an open type registry, content-addressed snapshot storage with an update journal and revision history, optimistic-lock editing (v1), trash with irreversible purge, a swappable object-storage seam, comm ingest (docs.create_document) and registry-driven export (PDF built in).

Part of the Stapel framework — composable Django apps that deploy as a monolith or as microservices without changing module code.

Install

pip install stapel-docs

At a glance

Fact Value
Version 0.2.0
Python >=3.11 (3.11, 3.12, 3.13)
HTTP operations 27
Config axes 1
Usage surface 54
Extension points 7
Error codes 73
Fleet dependencies stapel-auth (optional) · stapel-core · stapel-workspaces (optional)

Documentation

OpenAPI · capabilities.json · llms.txt (for agents)

What this is

Google-Drive-style workspace documents: a folder tree, documents that are each ONE entity with a type from an open registry (txt / md / csv / opaque file built in), a journal + revision versioning substrate, trash with irreversible purge, and registry-driven export (PDF built in).

The versioning substrate is decided for both collaboration disciplines: snapshot types save whole states under optimistic lock (If-Match carries the client's head_seq — v1's editing model), crdt types accumulate an append-only update journal between snapshots with chat-pattern replay/resync. Which discipline applies is a property of the type, not the request.

Object storage is content-addressed and goes through a swappable seam (STORAGE); the library is body-blind — the storage substrate never parses a document body, only a type's own text_extractor may.

Quick start

The base install rides Django's default_storage; add extras for the boto3 S3/MinIO backend and the PDF exporter:

pip install "stapel-docs[s3,pdf]"
INSTALLED_APPS = [
    # ...
    "stapel_docs",
]

# urls.py
path("docs/", include("stapel_docs.urls"))   # -> /docs/api/v1/...

Authorization asks the workspaces.check_capability comm Function (fail-closed, deny-by-default) — install stapel-workspaces or provide that Function for any HTTP request to be allowed.

An open type registry, not an enum

STAPEL_DOCS = {
    # Add or replace document types ({slug: dotted-path | None removes}):
    "DOC_TYPES": {"sheet": "myproject.docs.SHEET_SPEC"},
    # Add export formats over the built-in pdf:
    "EXPORTERS": {"docx": "myproject.docs.DocxExporter"},
    # Event-driven ingest without writing a subscriber:
    "INGEST": {"meeting.summarized": "myproject.docs.map_summary"},
    # Swap the object store:
    "STORAGE": "stapel_docs.storage.S3Backend",
}

A type whose spec vanishes from the registry degrades to file behavior — read-only, never unreadable: revisions still list, snapshots still download, trash/purge/export still work.

Ingest

Product glue dumps content in with one comm call — no HTTP, no import:

call("docs.create_document", {
    "workspace_id": ws_id, "type": "md", "title": "Weekly sync",
    "body": summary_text, "folder_path": "/Meetings/2026-08",
})

folder_path materializes folders idempotently; an unknown type refuses loudly so content never silently lands under a mistyped slug.

Sharing (v1: closed by default)

The sharing axis (SHARING: whitelist / link modes) ships its config surface with closed defaults — v1 implements exactly the immutable workspace baseline, and opening any sharing knob before the mechanism exists is a loud system-check error (stapel_docs.E010-E013), never a silent no-op.

Settings

All configuration lives in the STAPEL_DOCS namespace (dict setting, flat setting, or env var — resolved lazily). Full table in CONFIG.MD; seam semantics in MODULE.md. Highlights: STORAGE, DOC_TYPES, EXPORTERS, INGEST, REPLAY_WINDOW, AUTO_REVISION_INTERVAL_SECONDS, TRASH_RETENTION_DAYS, SHARING.

comm surface

Kind Name Contract
Function (provides) docs.create_document schemas/functions/docs.create_document.json
Action (emit) document.created, document.updated, document.deleted, document.storage_changed schemas/emits/*.json
Action (consume) user.deleted GDPR anonymize (authorship nulled, content survives)
Function (call) workspaces.check_capability provided by stapel-workspaces

Operations

python manage.py docs_purge_expired   # purge trash older than TRASH_RETENTION_DAYS

Development

pip install -e . && pip install pytest pytest-django ruff jsonschema djangorestframework
./setup-hooks.sh
pytest tests/

License

MIT — see LICENSE.


This page is assembled by stapel-readme from docs/readme.md plus the contract artifacts in docs/. Edit the prose in docs/readme.md; the badges, facts and links above and below it are generated — do not hand-edit README.md.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stapel_docs-0.2.0.tar.gz (848.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stapel_docs-0.2.0-py3-none-any.whl (831.9 kB view details)

Uploaded Python 3

File details

Details for the file stapel_docs-0.2.0.tar.gz.

File metadata

  • Download URL: stapel_docs-0.2.0.tar.gz
  • Upload date:
  • Size: 848.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for stapel_docs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ba8d1030352ff6a888b2e4f378756ffd49c1520d760f4cdd68219d817ae58186
MD5 a9ed8c85d25c63654fde4d882556b4e2
BLAKE2b-256 d70d6ff96d366d2854ce992235982b2736e10bd6780434654545d0ee7391ea69

See more details on using hashes here.

Provenance

The following attestation bundles were made for stapel_docs-0.2.0.tar.gz:

Publisher: publish.yml on usestapel/stapel-docs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stapel_docs-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: stapel_docs-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 831.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for stapel_docs-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 832cad9eb4787748d8e00cf8ac9a7f2d7d54699ba17ce3f1f6f889ab63932ab5
MD5 8f7aa0eda253deffb4249a7d82771791
BLAKE2b-256 77b0e3c52a3ed871de48389dc383463f7dae5a22aa06425bd923713eb21a3f36

See more details on using hashes here.

Provenance

The following attestation bundles were made for stapel_docs-0.2.0-py3-none-any.whl:

Publisher: publish.yml on usestapel/stapel-docs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page