Skip to main content

Lookup dates for events that cause unusual attendance patterns (Super Bowl, Oscars, ...) using Wikidata as the source of truth.

Project description

special-days

tests PyPI

Lookup dates for events that cause unusual attendance patterns at venues: Super Bowl Sunday, Oscars night, World Series Game 7, NCAA championship, etc. Data is sourced from Wikidata, so it doesn't go stale.

Zero runtime dependencies — only the Python standard library.

Status

Alpha. Currently supports: Super Bowl, Academy Awards (Oscars). More events to come.

Install

pip install special-days

Use

Two APIs over the same data. Pick whichever fits your question.

Year-keyed (planner-style)

from datetime import date
from special_days import super_bowl

super_bowl.date(2025)
# datetime.date(2025, 2, 9)

super_bowl.is_super_bowl_sunday(date(2025, 2, 9))
# True

super_bowl.all_known()
# {1967: date(1967, 1, 15), ..., 2026: date(2026, 2, 8)}

Date-keyed (holidays-compatible)

A dict-like class keyed by datetime.date, lazy on construction — only years you actually query get loaded.

from datetime import date
from special_days import SuperBowl, SpecialDays, union

sb = SuperBowl()
date(2025, 2, 9) in sb           # True
sb[date(2025, 2, 9)]             # 'Super Bowl'
sb.get_list(date(2025, 2, 9))    # ['Super Bowl']

# eager mode, like holidays.US(years=2025)
SuperBowl(years=[2024, 2025])

# edition-numbered labels for display strings
SuperBowl(label_with_edition=True)[date(2025, 2, 9)]    # 'Super Bowl LIX'

Compose with the holidays package via union(...), preserving laziness on both sides:

import holidays
from special_days import SpecialDays, union

combined = union(holidays.US(), SpecialDays())   # all known events
combined.get_list(date(2025, 2, 9))    # ['Super Bowl']
combined.get_list(date(2025, 3, 2))    # ['Academy Awards']
combined.get_list(date(2025, 7, 4))    # ['Independence Day']

SpecialDays(events=...) accepts registered string names ("super_bowl", "oscars"), event classes (SuperBowl, Oscars), or pre-built instances. With no argument it includes everything the package ships.

Far-future years

A snapshot through Super Bowl LX (Feb 8, 2026) ships with the package, so lookups for known years work offline. Asking for an unknown year transparently refreshes from Wikidata:

super_bowl.date(2035)   # hits Wikidata, caches the result

Disable the network fallback explicitly if you need it:

super_bowl.date(2035, allow_network=False)   # raises KeyError

Force a refresh:

super_bowl.refresh()   # re-fetch everything, update local cache

Why Wikidata?

  • Structured. Each Super Bowl has a stable Q-ID with a "point in time" property. We query that property directly — no HTML scraping, no infobox parsing.
  • Long-lived. Wikidata has been stable since 2012 and is increasingly the upstream source for Wikipedia infoboxes.
  • Public, no auth. No API keys, no signup, generous rate limits for conservative use like ours.

The package ships an offline snapshot so first use doesn't require network, and degrades gracefully when Wikidata is unreachable.

Cache

Refreshed data is cached at $XDG_CACHE_HOME/special-days/ (or ~/.cache/special-days/ on most systems). Safe to delete; it will be repopulated.

Tests

make venv install hooks        # one-time setup (venv, dev install, pre-commit)
make test                      # unit tests (mocked HTTP) — fast, always run
make test-live                 # opt-in: hits the real Wikidata SPARQL endpoint

The live tests exist precisely to catch the case where Wikidata reshapes its data and our SPARQL query stops returning the right items. If they fail, update EVENT_DATES_QUERY in src/special_days/_wikidata.py and cut a new release.

Maintenance

To regenerate every shipped snapshot from current Wikidata data:

make snapshots-live

make snapshots (no -live) writes embedded hand-curated lists where they exist — use this if Wikidata is wrong about a specific date and you want to ship a correction. Per-event targets: make snapshot-super-bowl, make snapshot-super-bowl-live, make snapshot-oscars, make snapshot-oscars-live.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

special_days-0.2.1.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

special_days-0.2.1-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file special_days-0.2.1.tar.gz.

File metadata

  • Download URL: special_days-0.2.1.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for special_days-0.2.1.tar.gz
Algorithm Hash digest
SHA256 137959f91056fc0aa56696dde527a449d4f70a860465c379ec99b8ec3d57c515
MD5 cb7fc4147a77f71e0c4e64429f7409e8
BLAKE2b-256 3c30f10ff19d6157a54aa3992ef336fd8144bb8dd0d69add5a03d29cde18e28a

See more details on using hashes here.

Provenance

The following attestation bundles were made for special_days-0.2.1.tar.gz:

Publisher: release.yml on stringertheory/special-days

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file special_days-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: special_days-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for special_days-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ad0ecc92cdb3af99e98048eda0e3b4c418dbeb36caa5aa45024fdce30b70a0c
MD5 11c63695aa82b5d7e403aa550165d1f0
BLAKE2b-256 5fe66ebc55f9098014fbdd48f16394c4b1f3be0d6dc2a670545b27696db6d93e

See more details on using hashes here.

Provenance

The following attestation bundles were made for special_days-0.2.1-py3-none-any.whl:

Publisher: release.yml on stringertheory/special-days

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page