Utilities and value objects for working with the Gorman calendar.
Project description
dateutil-gorman
dateutil-gorman is a typed Python package for converting between Gregorian
dates and the Gorman calendar.
Features
src/layout with a small, explicit public API.- Immutable value objects for regular Gorman dates and intermission days.
- Bidirectional Gregorian conversion helpers.
- String parsing for common Gorman date formats.
- No runtime dependencies outside the Python standard library.
Installation
pip install dateutil-gorman
For local development with uv:
uv sync --extra dev
Quick Start
from datetime import date, datetime
from dateutil_gorman import (
GormanDate,
gregorian_to_gorman,
gorman_to_gregorian,
parse_gorman,
)
gorman_value = gregorian_to_gorman(date(2024, 1, 1))
assert str(gorman_value) == "1 March 2024"
gregorian_value = gorman_to_gregorian(2024, 6, 15)
assert gregorian_value.isoformat() == "2024-06-03"
parsed = parse_gorman("June 15, 2024 14:30")
assert parsed == datetime(2024, 4, 8, 14, 30)
same_day = GormanDate.fromisoformat("2024-06-10")
assert same_day.to_gregorian().isoformat() == "2024-06-10"
Usage
Convert Gregorian values
from datetime import date
from dateutil_gorman import gregorian_to_gorman
assert str(gregorian_to_gorman(date(2024, 12, 30))) == "Intermission 1 2024"
assert str(gregorian_to_gorman(date(2024, 12, 31))) == "Intermission 2 2024"
Work with immutable value objects
from dateutil_gorman import GormanDate
gorman_date = GormanDate(year=2024, month=6, day=15)
updated = gorman_date.replace(day=1)
assert str(gorman_date) == "15 Sextilis 2024"
assert str(updated) == "1 Sextilis 2024"
Parse Gorman strings
from dateutil_gorman import parse_gorman
assert parse_gorman("15 June 2024").isoformat() == "2024-04-08T00:00:00"
assert parse_gorman("Intermission 1 2024 08:15").isoformat() == "2024-12-30T08:15:00"
Public API
Classes
GormanDate: Immutable regular-month date with conversion, week-calendar, ordinal, and replacement helpers.Intermission: Immutable year-end intermission day with Gregorian conversion and replacement helpers.
Functions
gregorian_to_gorman(d): Convert a Gregoriandateordatetime.gorman_to_gregorian(year, month, day): Convert a regular Gorman date.intermission_to_gregorian(year, day): Convert an intermission day.parse_gorman(date_string): Parse supported Gorman date strings into a Gregoriandatetime.
Constants
GORMAN_MONTHS: Ordered tuple of month names used by the Gorman calendar.
Development
uv sync --extra dev
uv run pytest
uv run ruff check .
uv run mypy src
Contributing
- Fork the repository and create a feature branch.
- Keep the public API typed and documented with Google-style docstrings.
- Add or update tests for behavior changes.
- Run
uv run pytest,uv run ruff check ., anduv run mypy srcbefore opening a pull request.
License
Released under the MIT License.
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
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 dateutil_gorman-0.1.4.tar.gz.
File metadata
- Download URL: dateutil_gorman-0.1.4.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f2b18705d5f058b03406d8db769c359062d9937aaa0ca825077eaefed313a5f
|
|
| MD5 |
91333f0286130fa2ce832ee6254ce5a6
|
|
| BLAKE2b-256 |
56020e03988ce143b4982cecceeb0eaaf8ce3ba5f0445dff87b2e6f2f28b41f6
|
Provenance
The following attestation bundles were made for dateutil_gorman-0.1.4.tar.gz:
Publisher:
publish.yaml on BGarber42/dateutil_gorman
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dateutil_gorman-0.1.4.tar.gz -
Subject digest:
5f2b18705d5f058b03406d8db769c359062d9937aaa0ca825077eaefed313a5f - Sigstore transparency entry: 1108171953
- Sigstore integration time:
-
Permalink:
BGarber42/dateutil_gorman@98cfe0ef2231abe31aae57d42d45fd217f8a0b93 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/BGarber42
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@98cfe0ef2231abe31aae57d42d45fd217f8a0b93 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dateutil_gorman-0.1.4-py3-none-any.whl.
File metadata
- Download URL: dateutil_gorman-0.1.4-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ecd7354b63ccb3e73737c25f25b6fde8c5b69b2c5b3bb374cee3dc2df4c0aab
|
|
| MD5 |
f534398d5c40f5d5750690712c5a8c59
|
|
| BLAKE2b-256 |
874a53c5b9d20232a335e3541112cda6a5cc34378298b20bf105fe5a3182cc7c
|
Provenance
The following attestation bundles were made for dateutil_gorman-0.1.4-py3-none-any.whl:
Publisher:
publish.yaml on BGarber42/dateutil_gorman
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dateutil_gorman-0.1.4-py3-none-any.whl -
Subject digest:
7ecd7354b63ccb3e73737c25f25b6fde8c5b69b2c5b3bb374cee3dc2df4c0aab - Sigstore transparency entry: 1108171954
- Sigstore integration time:
-
Permalink:
BGarber42/dateutil_gorman@98cfe0ef2231abe31aae57d42d45fd217f8a0b93 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/BGarber42
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@98cfe0ef2231abe31aae57d42d45fd217f8a0b93 -
Trigger Event:
push
-
Statement type: