Skip to main content

Date dimension and 4-4-5 / 4-5-4 retail calendar generator

tests

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 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.

Reference pages

4-5-4 retail calendar by fiscal year and 53-week fiscal years 2000-2050, generated with retailcal. For ISO 8601 weeks: ISO week numbers by year.

Guides

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_date for 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.

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for retailcal 1.0.1
File Size Uploaded Provenance Actions
retailcal-1.0.1.tar.gz 7.5 kB With provenance Details for retailcal-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for retailcal 1.0.1
File Interpreter ABI Platform Actions
retailcal-1.0.1-py3-none-any.whl Python 3 none any Details for retailcal-1.0.1-py3-none-any.whl

Total release size: 14.9 kB

Release files / retailcal-1.0.1.tar.gz

Download URL retailcal-1.0.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
959ae270d2efb509a5eeaa64d3a674e8ab6c908191d088fbda5eba180a148fd0
BLAKE2b-256 checksum
How to use checksums
b1a5223ea77a811514606a47bc8eba0ba1e9151ea1b84826aa7dfae6b2bc5286
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 19, 2026.

Transparency log

Release files / retailcal-1.0.1-py3-none-any.whl

Download URL retailcal-1.0.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a97af8281ce24b7996136365794747fb87e8ddcec0539fec4257f9e7ca8260f2
BLAKE2b-256 checksum
How to use checksums
15c9eb00f05033179feb33d3f3632c22d3e318a89a3b45166fc42d9ca420fb0f
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 19, 2026.

Transparency log

Security for retailcal 1.0.1

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 retailcal-1.0.1.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 19, 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

1.0.1 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