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.
Release files for timeblocks 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| timeblocks-1.0.2.tar.gz | 15.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| timeblocks-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:31.5 kB
Release files / timeblocks-1.0.2.tar.gz
| Download URL | timeblocks-1.0.2.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b2aeb91d1690df658f85342e9cbb79d5a9cd4c1472e6391cd04b8fb3016720a
|
|
BLAKE2b-256 checksum How to use checksums |
bf59df168fb84db10ad5461dfc50be1d6dd332a60ef5f83fa2c05a523df1394f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / timeblocks-1.0.2-py3-none-any.whl
| Download URL | timeblocks-1.0.2-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
998a1574737360d93518f88384b42e7646c67f92e7e550aef71922a882e0877c
|
|
BLAKE2b-256 checksum How to use checksums |
bd685ee7411384ae60290ff2d7dc884c0588ceb29dd02ebbf4ea57e60c508322
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|