Reusable Django time block & recurrence engine.
Project description
timeblocks
A reusable Django library for creating and managing time blocks using safe, deterministic recurrence rules.
Designed for scheduling systems where correctness, idempotency, and data safety matter more than flexibility.
Feedback & Community
If you are using timeblocks (or evaluating it), I’d love to hear from you.
- ⭐ Star the repo if it saves you time
- 🐛 Open an issue for bugs or edge cases
- 💡 Start a discussion for design questions or suggestions
Even small feedback helps shape the roadmap.
➡️ GitHub Issues & Discussions are always welcome.
Quick Start Example
Create a recurring availability every Monday, Wednesday, and Friday from 10:00–11:00 UTC for the next 5 occurrences:
from datetime import date, time
from timeblocks.services.series_service import SeriesService
from timeblocks.constants import RecurrenceType, EndType
series = SeriesService.create_series(
owner=user,
data={
"start_date": date(2025, 1, 1),
"start_time": time(10, 0),
"end_time": time(11, 0),
"timezone": "UTC",
"recurrence_type": RecurrenceType.WEEKDAYS.value,
"by_weekdays": ["MON", "WED", "FRI"],
"end_type": EndType.AFTER_OCCURRENCES.value,
"occurrence_count": 5,
},
)
Examples
Real-world usage examples are available in the examples/ directory:
- daily and weekly availability
- safe regeneration flows
- cancellation semantics
- monthly and yearly recurrence patterns
The README intentionally shows only the happy path.
Stability & API Guarantees (v1.0+)
Starting from version 1.0.0, timeblocks provides explicit stability guarantees.
Stable Public API
The following interfaces will not change in backward-incompatible ways without a MAJOR version bump:
SlotandSlotSeriesmodelsRecurrenceTypeandEndTypeenumsSeriesServicepublic methods
Internal APIs
Internal helpers, generators, and validation utilities are not part of the public API and may change between minor releases.
Versioning
timeblocks follows semantic versioning:
- MAJOR — breaking changes
- MINOR — new capabilities
- PATCH — bug fixes and correctness improvements
Mental Model (Read This First)
timeblocks separates intent from reality.
-
SlotSeries represents intent
“This resource should be available every Mon/Wed/Fri from 10–11”
-
Slot represents reality
A concrete time interval that exists, may be booked, or cancelled
SlotSeries is the source of truth.
Slots are generated artifacts.
Slots must never be treated as configuration.
Supported Recurrence Types
NONE— single occurrenceDAILY— every N daysWEEKLY— specific weekdaysWEEKDAY_MON_FRI— every weekday (preset)WEEKDAYS— custom weekdaysMONTH_NTH— Nth weekday of the monthMONTH_LAST— last weekday of the monthYEARLY— Nth weekday of a specific month
All declared recurrence types are fully implemented and tested.
What timeblocks Does NOT Do
- booking logic
- payments
- permissions
- notifications
- UI or API views
These belong in your application layer.
For questions or design discussions, please use GitHub Discussions instead of Issues.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file timeblocks-1.0.2.tar.gz.
File metadata
- Download URL: timeblocks-1.0.2.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b2aeb91d1690df658f85342e9cbb79d5a9cd4c1472e6391cd04b8fb3016720a
|
|
| MD5 |
db12c96b1d4db27847f688b4cdabd76a
|
|
| BLAKE2b-256 |
bf59df168fb84db10ad5461dfc50be1d6dd332a60ef5f83fa2c05a523df1394f
|
File details
Details for the file timeblocks-1.0.2-py3-none-any.whl.
File metadata
- Download URL: timeblocks-1.0.2-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
998a1574737360d93518f88384b42e7646c67f92e7e550aef71922a882e0877c
|
|
| MD5 |
f493a67792500152587e73b8e2f10e1f
|
|
| BLAKE2b-256 |
bd685ee7411384ae60290ff2d7dc884c0588ceb29dd02ebbf4ea57e60c508322
|