Skip to main content

schedule-bit for Python

The schedule-bit API from Python. It keeps time as bitmasks, so claiming a resource never double-books it. This SDK covers every operation, sync and async. Retries, rate limits, idempotency and live updates are handled for you.

pip install schedule-bit            # or: uv add schedule-bit
pip install "schedule-bit[watch]"   # adds live watching over WebSocket

Python 3.10 or newer.

Quick start

from schedule_bit import Client, Refusal, Slots

with Client() as api:                       # key from SCHEDULE_BIT_API_KEY
    api.create_world(name="room-1", preset="temporal-hour")
    api.declare_occupier("room-1", name="omar")
    api.declare_occupier("room-1", name="sara")

    receipt = api.claim("room-1", who="omar", date="2026-11-12", slots=Slots.range(9, 11))
    print(receipt.slots)                    # [9, 10]

    outcome = api.try_claim("room-1", who="sara", date="2026-11-12", slots=[10])
    if isinstance(outcome, Refusal):
        print(outcome.by, outcome.detail)   # held, "slot 10 is held by omar"

Async is the same, with await:

from schedule_bit import AsyncClient

async with AsyncClient() as api:
    free = await api.offered("room-1", date="2026-11-12")
    print(free.slots)

Every operation in the API reference is a method here in snake_case, for example explainClaim is explain_claim. Body fields are keyword arguments, in Python or API spelling. Answers are typed models in schedule_bit.models.

What the client does for you

Retries 429 and 503 always, and network failures or other 5xx when the call is safe to repeat (a read, explain_claim, or a write with an idempotency key). Waits use jittered back-off that honours Retry-After and RateLimit-Reset. The default is 4 retries; set max_retries=0 to turn them off.
Idempotency Writes that accept an Idempotency-Key get one, the same across that call's retries, so a retried claim never claims twice. To pass your own, use options=RequestOptions(idempotency_key=…).
Rate limits api.rate_limit holds the latest RateLimit-* headers, on_rate_limit= is called with each one, and rate_limit_per_minute= paces requests on the client side.
Timeouts 30 s per attempt, which you can change per client (timeout=) or per call (RequestOptions(timeout=…)). A sync call can be cancelled with RequestOptions(cancel=threading.Event()); an async call is cancelled by cancelling its task.
Errors Refusal (409, the engine said no, .by names why), LocalTimeError (422, with .candidates), RateLimited, ApiError for any other problem, and NetworkError / TimeoutError with the last cause attached.
Secrets Keys never appear in errors, reprs or logs.

Masks and local time

from datetime import datetime
from zoneinfo import ZoneInfo
from schedule_bit import Slots, local_slot

Slots.from_hex("0x600").list()       # [9, 10]
(Slots.range(9, 12) - [10]).hex      # "0xa00"

at = datetime(2026, 10, 25, 1, 30, tzinfo=ZoneInfo("Europe/London"), fold=1)
api.claim("room-1", who="omar", **local_slot(at))   # the second 01:30 that night

At a clock change, Python's fold says which of a repeated time you mean, and local_slot sends it as occurrence. Without it, the API answers with a LocalTimeError that lists the candidates.

Watching a World

with api.watch("room-1") as frames:
    for frame in frames:
        print(frame.type)            # hello, claim.made, claim.released, …

If the connection drops, the watch reconnects with the same back-off. It catches up from the journal, so no commit is missed, and it yields each event once.

Development

uv sync
uv run python scripts/generate.py          # after the contract changes
uv run pytest                              # unit tests (a fake server, no sleeping)
SCHEDULE_BIT_LIVE=1 uv run pytest -m live  # the shared scenarios against the dev API
uv run ruff check && uv run mypy

src/schedule_bit/_generated/ is generated from sdks/spec/openapi.json, so don't edit it by hand. A unit test fails when it is stale. The behaviour every SDK shares is in sdks/POLICY.md.

MIT licensed.

Metadata

Release files for schedule-bit 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 schedule-bit 0.1.0
File Size Uploaded Provenance Actions
schedule_bit-0.1.0.tar.gz 32.4 kB With provenance Details for schedule_bit-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for schedule-bit 0.1.0
File Interpreter ABI Platform Actions
schedule_bit-0.1.0-py3-none-any.whl Python 3 none any Details for schedule_bit-0.1.0-py3-none-any.whl

Total release size: 70.3 kB

Release files / schedule_bit-0.1.0.tar.gz

Download URL schedule_bit-0.1.0.tar.gz
Size 32.4 kB
Tags Source
SHA-256 checksum
How to use checksums
abfe765111edeec762510516dad838281f53c7229ba8c4245b2bc88cc98c9ae5
BLAKE2b-256 checksum
How to use checksums
4ea42506b4cde3da2f999daceab01b0d578477e5154164928b3465da437536fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 16, 2026.

Transparency log

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

Download URL schedule_bit-0.1.0-py3-none-any.whl
Size 37.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31910201cb073aa3546e1a2e243c3e9ff1c6681c488fcabfd33635dc9696b0e8
BLAKE2b-256 checksum
How to use checksums
001e55a370fe6ad4d8f2c49ce0b235f8ee2288d0bdbae89180c97641895b0ad3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 16, 2026.

Transparency log

Security for schedule-bit 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 schedule_bit-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 Oct 16, 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