Skip to main content

stapel-delivery

CI coverage pypi downloads python license llms.txt

Delivery methods (courier, pickup point, digital), zones matched by country / region / postcode prefix, rates (flat, free above a subtotal, per kilogram when cart lines carry attrs.weight_grams), pickup points with hours and coordinates, a per-user address book with one default, and shipments with a table FSM (pending, packed, shipped, delivered, returned, cancelled), a timeline, tracking number and link. It is the stapel-orders shipping adjuster (delivery.quote, kind shipping, order 200; honours a promotion's meta.free_shipping marker) and a checkout hook (delivery.reserve keeps the validated choice and the address snapshot under the checkout attempt key; commit creates the order's shipment; release on cancel cancels it). Carriers are a strategy registry: manual by default, an auto-advancing mock for prototypes, a documented Carrier ABC for real ones.

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

Install

pip install stapel-delivery

At a glance

Fact Value
Version 0.1.0
Python >=3.11 (3.11, 3.12, 3.13, 3.14)
HTTP operations 15
Config axes 2
Usage surface 9
Extension points 12
Error codes 55
Documented flows 4
Fleet dependencies stapel-auth (optional) · stapel-core · stapel-geo (optional) · stapel-notifications (optional) · stapel-orders (optional) · stapel-promotions (optional)

Documentation

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

What this is

Delivery for a Stapel shop: delivery methods (courier, pickup point, digital), zones and rates, pickup points, a per-user address book, and shipments with tracking. It plugs into stapel-orders without either module importing the other: delivery is the orders shipping adjuster (delivery.quote) and a checkout hook (delivery.reserve / commit / release), and every placed order with a physical delivery gets a shipment the buyer can track.

Without orders installed the catalog, the address book, the options Function and the shipment API still work on their own.

Quick start

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

# urls.py
path("delivery/api/", include("stapel_delivery.urls"))   # -> /delivery/api/v1/...

# carrier polling + intent purge (Celery optional: manage.py delivery_housekeeping)
from stapel_delivery.beat import get_delivery_beat_schedule
CELERY_BEAT_SCHEDULE = {**get_delivery_beat_schedule()}

Wire it into the orders checkout. A scaffolded project already calls the merge helper in settings.py: add this brick's preset to that list (the helper merges two levels deep, so other presets and your own keys stay):

_stapel_merge_preset_defaults(globals(), [
    # ... the presets already listed (stapel_shop.preset, other companions),
    "stapel_delivery.preset",
])

A hand-wired project merges per key instead — never assign STAPEL_ORDERS = {...}: pasted after another fragment it would drop that fragment and the host's PURCHASABLE_TYPES:

from stapel_delivery.preset import SETTINGS_DEFAULTS as _DELIVERY

STAPEL_ORDERS = globals().get("STAPEL_ORDERS") or {}
STAPEL_ORDERS = {
    **STAPEL_ORDERS,
    "ADJUSTERS": {**_DELIVERY["STAPEL_ORDERS"]["ADJUSTERS"], **STAPEL_ORDERS.get("ADJUSTERS", {})},
    "CHECKOUT_HOOKS": {**_DELIVERY["STAPEL_ORDERS"]["CHECKOUT_HOOKS"], **STAPEL_ORDERS.get("CHECKOUT_HOOKS", {})},
}

Methods, zones, rates and pickup points are configured in the Django admin. At checkout the client sends its choice in the orders context:

{"delivery": {"method": "courier", "address": {"name": "Ada", "phone": "+1 555 0100",
  "line1": "1 Main St", "city": "Springfield", "postal_code": "62701", "country": "US"}}}

(address_id instead of address for a saved address; pickup_point for a pickup method; nothing more for a digital one.)

Delivery owns the delivery address. context.delivery (address / address_id / pickup_point) is the address the shipment is sent to. Orders still requires and stores its own shipping_address, which is never compared with delivery's. The client sends the ship-to chosen in the delivery widget as shipping_address, so the buyer types it once, and OrderResponse.address_from_delivery is true when the order was placed with context.delivery. The shipping adjustment's code is the method code (e.g. courier), which orders records as the order's shipping method.

Concepts

  • Zone — where a rate applies: lists of countries, regions and postcode prefixes (empty list = any). The most specific matching zone wins (longest postcode prefix, then region, then country); a rate with no zone applies everywhere. No GIS.
  • Rate — per method, zone and currency: a flat amount, free above a cart subtotal, and an optional price per kilogram used when every shippable line carries attrs.weight_grams (the purchasable resolver's extra field); otherwise the flat amount. Never converted between currencies.
  • Free shipping from a promotion — an earlier adjuster's adjustment with meta.free_shipping: true (optionally meta.free_shipping_methods) makes shipping 0.00.
  • Address book — per user, one default, at most MAX_ADDRESSES. Checkout and shipments keep a copy of the address; editing or deleting a saved address never changes a placed order. Guests type the address inline.
  • Shipment — one per order: pending → packed → shipped → delivered, returned, cancelled, with a timeline, a tracking number and link. An order cancelled before the parcel left cancels its shipment.
  • Carriers — manual (staff type the tracking number) by default; mock advances shipments by itself for demos (prototype posture only); a real carrier is a small Carrier subclass registered by slug.
  • GDPR — erasure deletes the address book and blanks the recipient on shipments; money, status and city/country 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-delivery 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-delivery 0.1.0
File Size Uploaded Provenance Actions
stapel_delivery-0.1.0.tar.gz 101.4 kB With provenance Details for stapel_delivery-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 194.3 kB

Release files / stapel_delivery-0.1.0.tar.gz

Download URL stapel_delivery-0.1.0.tar.gz
Size 101.4 kB
Tags Source
SHA-256 checksum
How to use checksums
77b3cec8cf56c85e238e35b11a120d4da0e9e7ff44283c21c37700c436565904
BLAKE2b-256 checksum
How to use checksums
24938c3c1afc8c935bc73affd68f108864b68615c79702ee380e0d0726638b22
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_delivery-0.1.0-py3-none-any.whl

Download URL stapel_delivery-0.1.0-py3-none-any.whl
Size 93.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ff18f677f7720a005de1aef2a91dea31c04501190e13359d7722754abc15ad6
BLAKE2b-256 checksum
How to use checksums
8d672efc7afcf690c809c62f22f7a54eb9fbec596e00f81c189f95af56b2b218
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-delivery 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_delivery-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