Metadata-Version: 2.4
Name: stapel-posts
Version: 0.1.0
Summary: Short posts with optional status tracking for the Stapel framework
License: MIT
Project-URL: Homepage, https://github.com/usestapel/stapel-posts
Project-URL: Repository, https://github.com/usestapel/stapel-posts
Project-URL: Documentation, https://github.com/usestapel/stapel-posts#readme
Project-URL: Changelog, https://github.com/usestapel/stapel-posts/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/usestapel/stapel-posts/issues
Keywords: django,stapel,posts,news,helpdesk,tickets
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: stapel-core<1.0,>=0.99.3
Provides-Extra: all
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-django; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: stapel-tools<1,>=0.84.0; extra == "test"
Requires-Dist: jsonschema>=4; extra == "test"
Dynamic: license-file

<!-- Generated by stapel-readme from docs/readme.md + docs/*.json. Do not edit this file; edit docs/readme.md and re-run `make readme`. -->

# stapel-posts

[![CI](https://img.shields.io/github/actions/workflow/status/usestapel/stapel-posts/ci.yml?branch=main&logo=github&label=CI)](https://github.com/usestapel/stapel-posts/actions/workflows/ci.yml?query=branch%3Amain)
[![coverage](https://img.shields.io/codecov/c/github/usestapel/stapel-posts?branch=main&logo=codecov&label=coverage)](https://app.codecov.io/gh/usestapel/stapel-posts)
[![pypi](https://img.shields.io/pypi/v/stapel-posts?logo=pypi&logoColor=white&label=pypi)](https://pypi.org/project/stapel-posts/)
[![downloads](https://static.pepy.tech/badge/stapel-posts/month)](https://pepy.tech/project/stapel-posts)
[![python](https://img.shields.io/pypi/pyversions/stapel-posts?logo=python&logoColor=white)](https://pypi.org/project/stapel-posts/)
[![license](https://img.shields.io/github/license/usestapel/stapel-posts)](https://github.com/usestapel/stapel-posts/blob/main/LICENSE)
[![llms.txt](https://img.shields.io/badge/llms.txt-blue)](https://github.com/usestapel/stapel-posts/blob/main/docs/llms.txt)

> Short posts in a scope (a workspace, a tenant): an optional title, plain text, optional pictures with a chosen cover. What a post is comes from its KIND (an open registry): who may write it (a capability the host's scope provider answers, or any member), whether it needs a title, who reads it (the whole scope, or the author and processors only), and an optional LIFECYCLE — states, allowed transitions, who may move a post, a due time — with an append-only history and an overdue flag. Announcements, resident requests and helpdesk tickets are kinds, not modules. Discussion is a chat room about the post opened through stapel-chat's chat.open_subject_room by name; posts.subject_cards renders its header. Moderation takes a post down through moderation.completed; GDPR erasure deletes the person's posts and blanks their id on others' history.

Part of the [Stapel framework](https://github.com/usestapel) — composable Django apps that deploy as a monolith or as microservices without changing module code.

## Install

```bash
pip install stapel-posts
```

## At a glance

| Fact | Value |
|---|---|
| Version | `0.1.0` |
| Python | `>=3.11` (3.11, 3.12, 3.13, 3.14) |
| HTTP operations | 8 |
| Config axes | 1 |
| Usage surface | 4 |
| Extension points | 6 |
| Error codes | 58 |
| Documented flows | 2 |
| Fleet dependencies | [`stapel-cdn`](https://github.com/usestapel/stapel-cdn) (optional) · [`stapel-chat`](https://github.com/usestapel/stapel-chat) (optional) · [`stapel-core`](https://github.com/usestapel/stapel-core) · [`stapel-moderation`](https://github.com/usestapel/stapel-moderation) (optional) · [`stapel-notifications`](https://github.com/usestapel/stapel-notifications) (optional) · [`stapel-profiles`](https://github.com/usestapel/stapel-profiles) (optional) |

## Documentation

**Errors:** [English](https://github.com/usestapel/stapel-posts/blob/main/docs/errors.en.md) · [Español](https://github.com/usestapel/stapel-posts/blob/main/docs/errors.es.md) · [Русский](https://github.com/usestapel/stapel-posts/blob/main/docs/errors.ru.md) · [OpenAPI](https://github.com/usestapel/stapel-posts/blob/main/docs/schema.json) · [capabilities.json](https://github.com/usestapel/stapel-posts/blob/main/docs/capabilities.json) · [llms.txt (for agents)](https://github.com/usestapel/stapel-posts/blob/main/docs/llms.txt)

## What this is

Short posts for a Stapel space: an announcement from the board, a request
from a resident, a helpdesk ticket, a note. A post has an optional title,
plain text and optional pictures with a chosen cover. What a post IS comes
from its **kind** — who may write it, whether it needs a title, who reads it
and whether it has a **lifecycle** (statuses a processor moves it through,
with a history and a due time). Discussion is a chat room about the post,
opened through stapel-chat by name; this module never imports a sibling.

## Quick start

```python
INSTALLED_APPS = [
    # ...
    "stapel_chat",    # optional: discussions (chat >= 0.13.0)
    "stapel_posts",
]

# urls.py
path("posts/api/", include("stapel_posts.urls"))   # -> /posts/api/v1/...

STAPEL_POSTS = {
    "SCOPE_PROVIDER": "myapp.posts_scope.WorkspaceScope",
    "KINDS": {
        "news": {"write_capability": "posts.news.write", "title": "required"},
        "appeal": {"lifecycle": "appeal", "title": "required", "author_edits": "initial"},
    },
    "LIFECYCLES": {
        "appeal": {
            "initial": "new",
            "states": {"new": {"label": "appeal.new"},
                       "in_progress": {"label": "appeal.in_progress"},
                       "resolved": {"label": "appeal.resolved", "terminal": True},
                       "rejected": {"label": "appeal.rejected", "terminal": True}},
            "transitions": {"new": ["in_progress", "rejected"],
                            "in_progress": ["resolved", "rejected"]},
            "transition_capability": "posts.appeal.process",
            "due_hours": 72,
        },
    },
}
# In the chat: STAPEL_CHAT["SUBJECT_TYPES"] = {"post": {"card_function": "posts.subject_cards"}}
```

## Concepts

- **Post** — `scope_key`, `kind`, optional `title` (≤ 200), `body`
  (≤ `MAX_BODY_LENGTH`), ordered `images` (opaque CDN refs, may be empty),
  optional `cover` (one of the images). Soft-deleted by its author or a
  holder of the kind's `moderate_capability`.
- **Kind** — `KINDS` merges over the built-in `post` (any member writes,
  title optional, no lifecycle). `read: author` keeps a kind's posts to their
  author and its processors.
- **Lifecycle** — data, not code: `initial`, `states`, `transitions`,
  `transition_capability`, `due_hours`. Every move writes a
  `PostStateChange` row (never edited) and emits `posts.post.state_changed`;
  `overdue` is derived (`due_at` past and not terminal), not a state.
- **Scope** — the host's `SCOPE_PROVIDER` answers which scope a request is
  in, whether the caller reads it and which capabilities they hold.
- **Discussion** — `POST posts/<id>/discussion/` asks
  `chat.open_subject_room` for THE room about the post; nothing is stored on
  the post.

## License

MIT — see [LICENSE](https://github.com/usestapel/stapel-posts/blob/main/LICENSE).

---

<sub>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`.</sub>
