Date dimension and 4-4-5 / 4-5-4 retail calendar generator
retailcal builds any 52/53-week fiscal or retail calendar (4-4-5, 4-5-4, 5-4-4) as CSV: fiscal year, quarter, period, week, week of period, day of fiscal year, and period/week start and end dates. It needs Python 3 and nothing else (standard library only).
Install with pip install retailcal (once published) or run from a clone with PYTHONPATH=src python3 -m retailcal ....
# NRF-style 4-5-4 retail calendar (year ends Saturday nearest January 31)
retailcal --preset nrf-454 --from 2020 --to 2030 > nrf_454.csv
# One row per fiscal year: start, end, 52 or 53 weeks, weeks per period
retailcal --preset nrf-454 --year-table --from 2020 --to 2030
# Your own: 4-4-5, year ends on the last Sunday of June, named by end year
retailcal --end-month 6 --weekday sun --rule last --pattern 445 \
--naming end --from 2015 --to 2035 > my_calendar.csv
From Python:
from datetime import date
import retailcal
cal = retailcal.Calendar(*retailcal.PRESETS["nrf-454"])
cal.bounds(2025) # (date(2025, 2, 2), date(2026, 1, 31))
cal.row(date(2025, 11, 28)) # fiscal year, quarter, period, week, ...
Presets: nrf-454, 445-sat-nearest-dec, 544-sat-nearest-dec, 445-sat-last-sep. Rules: nearest = the year ends on the chosen weekday nearest the last day of the end month; last = the last such weekday of the month. A 53rd week goes to period 12 unless --extra-week-period says otherwise.
Guides
- 4-4-5, 4-5-4 and 5-4-4 retail calendars explained (52/53-week years)
- Build and load a date dimension table (dim_date) with SQL
Free sample data
| File | Contents |
|---|---|
sample/dim_date_2026.csv |
Every day of 2026 with 45 date-dimension columns: date key, ISO and US week numbers, month/quarter boundaries, US federal holidays, US business day, NYSE trading day, US federal fiscal year, NRF fiscal year/period/week |
sample/nrf_454_fiscal_years_2020_2030.csv |
NRF-style fiscal years 2020-2030 with 53-week years marked |
Full pack ($19, one-time)
Buy the full pack on Polar (Polar is the merchant of record and handles sales tax). It contains:
dim_datefor 2000-2050 (18,628 rows, 45 columns) as CSV and SQLite- Four precomputed fiscal calendars 2000-2050 (NRF 4-5-4; 4-4-5 and 5-4-4 ending Saturday nearest December 31; 4-4-5 ending last Saturday of September) and a fiscal-year summary table
- PostgreSQL tables + load script (tested) and a dbt seed config with column types and tests
- The build script and tests
Also sold as part of the calendar data bundle: this pack plus the other two Plainfold calendar data packs (business days, date dimension, time zone transitions) for $35 instead of $49.
Checks and limits
Tests confirm known NRF fiscal years (for example, fiscal 2024 = February 4 2024 to February 1 2025; 53-week years 2000, 2006, 2012, 2017, 2023, 2028) and last-Saturday-of-September fiscal years. "NRF-style" means the rule commonly published by the National Retail Federation; this project is not affiliated with or endorsed by the NRF. Companies use their own variants, so check yours. Not accounting or tax advice.
Related
- plainfoldhq/us-federal-calendar: US federal holidays, NYSE trading days and Federal Reserve holidays as CSV/ICS (Python package
usbizdays); full set on Polar. - plainfoldhq/tz-transitions: IANA time zone transitions 1970-2050 and DST test vectors.
License
Code: MIT. Sample data: CC0 1.0. Made by Plainfold, with AI assistance. Questions: plainfoldhq@proton.me.
Metadata
Release files for retailcal 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| retailcal-1.0.0.tar.gz | 7.3 kB | With provenance | Details for retailcal-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| retailcal-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for retailcal-1.0.0-py3-none-any.whl |
Total release size: 14.6 kB
Release files / retailcal-1.0.0.tar.gz
| Download URL | retailcal-1.0.0.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65e06442f2b16a9126bf87e69e2d754c29f09cda373625e2d3bd426340c39eb1
|
|
BLAKE2b-256 checksum How to use checksums |
82a113b29ec996ce6bd0c62cddbf411a127641d23b5854242b4e43e480c64984
|
| 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 18, 2026.
Transparency logRelease files / retailcal-1.0.0-py3-none-any.whl
| Download URL | retailcal-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
34502324b65760e998babc2845fb885eecb1feb7e17f8841265f77978e49eb04
|
|
BLAKE2b-256 checksum How to use checksums |
df35cf2c40393a21b324e59beb8b4d82eff5343a94d5b95b25bd12bbadd6bcff
|
| 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 18, 2026.
Transparency logSecurity for retailcal 1.0.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.
Attestation for retailcal-1.0.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 18, 2026.
Transparency logA 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.