Skip to main content

stapel-reservations

CI coverage pypi downloads python license llms.txt

Schedules, free slots and reservations over opaque bookables. A host registers what can be booked (bookable_type -> a keyed-batch resolver Function answering title, price, currency, availability and the provider's seller_id — the listings.purchasables contract, so a service listing is bookable with no change to listings). Each bookable has a schedule of weekly rules in a named time zone, dated exceptions, duration, capacity, lead time, horizon and a cancellation window; until its provider saves one it offers DEFAULT_SCHEDULE. Free slots are computed on read with zero comm calls. A booking is idempotent on a client key and re-counts the slot under a lock on the schedule row, so two customers racing for the last seat end as one reservation and one slot_full. Reservations follow a table FSM (auto- or manual confirmation, customer cancel inside the window, provider confirm/cancel/no-show, completion by beat); payment is a provider seam (none, mock) whose outcome arrives as the reservations.payment.completed fact (or the payment module's payment.completed).

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

Install

pip install stapel-reservations

At a glance

Fact Value
Version 0.1.0
Python >=3.11 (3.11, 3.12, 3.13, 3.14)
HTTP operations 9
Config axes 5
Usage surface 13
Extension points 9
Error codes 64
Documented flows 3
Fleet dependencies stapel-auth (optional) · stapel-core · stapel-currencies (optional) · stapel-listings (optional) · stapel-notifications (optional)

Documentation

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

What this is

Schedules, free slots and reservations for a Stapel booking site — over opaque bookables. The module ships knowing nothing about what is booked: a host registers each bookable type with a comm Function that resolves a keyed batch of keys to title, price and the provider who owns it. The contract is listings.purchasables, so a service listing is bookable with no change to listings, and a room, a table or a class from a custom app is booked through the same calendar.

Quick start

INSTALLED_APPS = [
    # ...
    "stapel_reservations",
]

STAPEL_RESERVATIONS = {
    "BOOKABLE_TYPES": {
        "listing": {"resolve": "listings.bookables"},  # stapel-booking preset default
    },
}

# urls.py
path("reservations/api/", include("stapel_reservations.urls"))   # -> /reservations/api/v1/...

# settings.py — reminders, completion, idempotency purge (Celery optional)
from stapel_reservations.beat import get_reservations_beat_schedule
CELERY_BEAT_SCHEDULE = {**get_reservations_beat_schedule()}

A custom bookable is one resolver and one registration:

from stapel_core.comm import function

@function("hotel.bookables")
def bookables(payload):
    rooms = Room.objects.filter(pk__in=payload["keys"])
    return {str(r.pk): {"title": r.name, "price": str(r.rate), "currency": "USD",
                        "available": r.active, "seller_id": str(r.manager_id),
                        "image": None, "url": f"/rooms/{r.pk}"}
            for r in rooms}

# AppConfig.ready()
from stapel_reservations.registry import register_bookable_type
register_bookable_type("room", {"resolve": "hotel.bookables"})

Concepts

  • Bookable — an opaque pair (bookable_type, bookable_key). The resolver answers "what and whose" (title, price per reservation, the provider's seller_id); price: null books for free. It is asked when a reservation is booked and when a provider saves a schedule — never on a read.
  • Schedule — "when": weekly rules in a named IANA time zone, dated exceptions (closed, or other hours), duration, step, capacity, lead time, horizon, cancellation window. Until the provider saves one, a bookable offers DEFAULT_SCHEDULE (weekdays 09:00–18:00 UTC, one-hour slots), so a fresh site is bookable on day one.
  • Slots — computed on read from the schedule minus holding reservations; never stored. Local wall-clock time; a start inside a DST gap is skipped, an ambiguous one takes its first occurrence.
  • Booking — one idempotent call (idempotency_key). The slot is re-counted under a lock on the bookable's schedule row: two customers racing for the last seat end as one reservation and one error.409.slot_full. Guests are asked to sign in unless BOOKING_REQUIRES_ACCOUNT is off.
  • Reservation — confirmed at once (or pending with AUTO_CONFIRM off), cancelled by the customer inside the window or by the provider any time, no_show after the start, completed by the beat an hour after the end, needs_review when a payment does not match. The customer's history and the provider's agenda are anchor-paginated.
  • Payment — a provider seam: none (pay on site) or mock (prototype posture only). The outcome arrives as reservations.payment.completed (what providers registered here emit; the mock marks it simulated) or as the payment module's payment.completed, the one path that marks a reservation paid. Reservations never emits payment.completed.
  • GDPR — erasure deletes the person's schedules and pseudonymizes them on reservations; amounts and times stay.

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.

Metadata

Release files for stapel-reservations 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stapel-reservations 0.1.0
File Size Uploaded Provenance Actions
stapel_reservations-0.1.0.tar.gz 94.5 kB With provenance Details for stapel_reservations-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stapel-reservations 0.1.0
File Interpreter ABI Platform Actions
stapel_reservations-0.1.0-py3-none-any.whl Python 3 none any Details for stapel_reservations-0.1.0-py3-none-any.whl

Total release size: 183.9 kB

Release files / stapel_reservations-0.1.0.tar.gz

Download URL stapel_reservations-0.1.0.tar.gz
Size 94.5 kB
Tags Source
SHA-256 checksum
How to use checksums
11f279f7295617be0c67ef926925e476b14d1545fb63e92c0fd239e2926bd173
BLAKE2b-256 checksum
How to use checksums
0a92c45f1749b41ea31135c039cfd0b09e0488433a7fffc69ed89fbe4f39fe79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / stapel_reservations-0.1.0-py3-none-any.whl

Download URL stapel_reservations-0.1.0-py3-none-any.whl
Size 89.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25005953a1c81e903358188217ee03d8a144972b6e7dcd9924cd992a5675345d
BLAKE2b-256 checksum
How to use checksums
89206d0873e86017a36d5eab1cd607f56ff28e21274603e9da5ffc0db572240d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for stapel-reservations 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for stapel_reservations-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page