Metadata-Version: 2.4
Name: stapel-courses
Version: 0.1.0
Summary: Courses, lessons, enrollment, progress, quizzes and certificates for the Stapel framework
License: MIT
Project-URL: Homepage, https://github.com/usestapel/stapel-courses
Project-URL: Repository, https://github.com/usestapel/stapel-courses
Project-URL: Documentation, https://github.com/usestapel/stapel-courses#readme
Project-URL: Changelog, https://github.com/usestapel/stapel-courses/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/usestapel/stapel-courses/issues
Keywords: django,stapel,courses,lms,e-learning,quizzes,certificates
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-courses

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

> Courses for a Stapel education product: Course -> Module -> Lesson (ordered, typed content blocks: text, video and attachments by opaque media id, embeds), enrollment with a lifecycle (pending, active, completed, expired, cancelled), a source (free, purchase, entitlement, staff grant) and an optional expiry, and an access gate per course chosen from a strategy registry (free, enrolled, purchased through stapel-orders, entitlement through stapel-billing). The outline names a lock reason for every lesson (sign in, enroll, buy, plan, drip date, previous lesson). Lesson progress is an idempotent upsert with a per-enrollment progress cache; drip by days since enrollment or by fixed date and a sequential-unlock switch pace a course. Quizzes on a lesson or module (single and multiple choice, true/false, short text) are graded on the server with attempt limits, a pass mark and a stored shuffle seed; answers never leave before submission. Completing every required lesson and quiz completes the course and issues a certificate with a public verification endpoint. A course is sold as orders purchasable type 'course' (resolver Function courses.purchasables); the order facts activate and cancel the enrollment. Courses never imports orders or billing.

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-courses
```

## At a glance

| Fact | Value |
|---|---|
| Version | `0.1.0` |
| Python | `>=3.11` (3.11, 3.12, 3.13, 3.14) |
| HTTP operations | 41 |
| Config axes | 8 |
| Usage surface | 12 |
| Extension points | 10 |
| Error codes | 72 |
| Documented flows | 5 |
| Fleet dependencies | [`stapel-auth`](https://github.com/usestapel/stapel-auth) (optional) · [`stapel-billing`](https://github.com/usestapel/stapel-billing) (optional) · [`stapel-cdn`](https://github.com/usestapel/stapel-cdn) (optional) · [`stapel-core`](https://github.com/usestapel/stapel-core) · [`stapel-notifications`](https://github.com/usestapel/stapel-notifications) (optional) · [`stapel-orders`](https://github.com/usestapel/stapel-orders) (optional) · [`stapel-profiles`](https://github.com/usestapel/stapel-profiles) (optional) |

## Documentation

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

## What this is

Courses for a Stapel education product: courses made of modules and
lessons, enrollment with a lifecycle and an access gate per course, lesson
progress, quizzes graded on the server, and certificates with a public
verification page. The module never imports a sibling: a course is **sold**
through stapel-orders as purchasable type `course` (its resolver is the
`courses.purchasables` Function and the order facts open and close the
enrollment), and a **plan** includes a course through stapel-billing's
`billing.check_entitlement` Function, asked by name.

## Quick start

```python
INSTALLED_APPS = [
    # ...
    "stapel_courses",
]

STAPEL_COURSES = {
    "DEFAULT_ACCESS": "enrolled",      # free | enrolled | purchased | entitlement
}

# urls.py
path("courses/api/", include("stapel_courses.urls"))   # -> /courses/api/v1/...

# settings.py — enrollment expiry (Celery optional; or manage.py courses_housekeeping)
from stapel_courses.beat import get_courses_beat_schedule
CELERY_BEAT_SCHEDULE = {**get_courses_beat_schedule()}
```

Sell courses next to stapel-orders (no import either way):

```python
from stapel_courses.preset import SETTINGS_DEFAULTS as COURSES

STAPEL_ORDERS = {
    "PURCHASABLE_TYPES": {**COURSES["STAPEL_ORDERS"]["PURCHASABLE_TYPES"]},  # "course"
}
STAPEL_COURSES = {"PURCHASE_ACTIVATION": "paid"}   # paid | confirmed | placed
```

A demo course: `python manage.py courses_seed_demo`.

## Concepts

- **Course → Module → Lesson** — ordered; a lesson is a list of typed
  content blocks (`text`, `video` and `attachment` by opaque media id,
  `embed` by https URL; a host registers more in `BLOCK_TYPES`). A lesson
  may be a free preview, optional, or need a reviewer's "passed".
- **Access** — each course names a strategy: `free` (everyone reads),
  `enrolled` (enroll for free, then read), `purchased` (buy it through
  orders), `entitlement` (a billing plan includes it). The outline names a
  lock reason for every lesson; staff and the author always see everything.
- **Enrollment** — `pending → active → completed`, `expired` (by the beat
  after `access_days`), `cancelled`; source `free`, `purchase`,
  `entitlement` or `staff`. One row per course and learner.
- **Pacing** — drip by days since enrollment or by fixed dates, and a
  sequential switch (a lesson opens after the earlier required lessons and
  quizzes are done).
- **Progress** — an idempotent upsert per lesson (forward-only status, last
  video position) and a progress cache on the enrollment.
- **Quizzes** — single/multiple choice, true/false, short text (exact or
  normalised match); attempt limits, pass mark, a stored shuffle seed;
  graded on the server; right answers are never sent before submission and
  afterwards only as the quiz's reveal mode allows.
- **Completion and certificates** — every required lesson completed and
  every required quiz passed completes the course; a certificate with a
  unique number is issued once; `GET certificates/{number}/` verifies it and
  shows only the fields `PUBLIC_VERIFY_FIELDS` names.
- **GDPR** — export of enrollments, progress, attempts and certificates;
  erasure deletes the learning data and anonymises and revokes certificates.

## License

MIT — see [LICENSE](https://github.com/usestapel/stapel-courses/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>
