Metadata-Version: 2.4
Name: timecore
Version: 0.1.0
Summary: A modern, unified, fully typed, cross-platform Python library for date, time, duration, intervals, calendars, recurrence, and scheduling.
Author: Oceanus
Author-email: Oceanus <295322314+oceanus403@users.noreply.github.com>
License-Expression: MIT
Requires-Dist: whenever>=0.11.0
Requires-Dist: tzdata>=2025.1
Requires-Dist: tzlocal>=5.0
Requires-Dist: python-dateutil>=2.9.0
Requires-Dist: holidays>=0.109
Requires-Dist: portion>=2.6.3
Requires-Dist: babel>=2.19.0
Requires-Dist: croniter>=7.0.0
Requires-Dist: dateparser>=1.5.1 ; extra == 'natural'
Requires-Python: >=3.11
Project-URL: Repository, https://github.com/oceanus403/timecore
Project-URL: Documentation, https://oceanus403.github.io/timecore/
Provides-Extra: natural
Description-Content-Type: text/markdown

# TimeCore

A modern, unified, fully typed, cross-platform Python library for date, time, duration, intervals, calendars, recurrence, and scheduling.

TimeCore wraps established libraries (whenever, tzdata, tzlocal, python-dateutil, holidays, portion, babel, croniter) behind one cohesive, fully typed API, so date and time handling in Python no longer requires juggling several incompatible libraries.

## Installation

Requires Python 3.11+.

```bash
uv add timecore
```

```bash
pip install timecore
```

With optional natural-language parsing support:

```bash
uv add "timecore[natural]"
```

## Quick Start

```python
from timecore import Date, DateTime, Duration, Period

today = Date(2026, 11, 25)
print(today + Period(months=1))  # 2026-12-25
print(today + Duration(days=10))  # 2026-12-05

meeting = DateTime(2026, 11, 25, 9, 0, timezone="America/New_York")
print(meeting.to_instant())  # 2026-11-25T14:00:00Z
```

Schedule a weekly Monday 9am meeting in New York:

```python
from timecore import Recurrence, Schedule, Time, Weekday

schedule = Schedule(
    Recurrence.weekly([Weekday.MONDAY]),
    time=Time(9, 0),
    timezone="America/New_York",
)
print(schedule.occurrences(Date(2026, 11, 23), count=3))
```

Parse strictly and format for a locale:

```python
from timecore import parse_date

d = parse_date("2026-11-25")  # strict ISO 8601; anything else raises ParseError
print(d.format())  # Nov 25, 2026
print(d.format(locale="fr_FR"))  # 25 nov. 2026
```

See the [documentation](https://oceanus403.github.io/timecore/) and the
[API reference](https://oceanus403.github.io/timecore/docs/api-reference) for more.

## Features

- Immutable, fully typed temporal value types
- Date, time, datetime, instant, duration, and period arithmetic
- Intervals and interval sets
- Calendars, holidays, and business days
- Recurrence rules and cron expressions
- Scheduling and availability
- Strict ISO 8601 parsing, locale-aware formatting, and optional natural-language parsing
- Injectable clocks and timers for deterministic testing

## Development

```bash
uv sync --locked
uv run ruff format
uv run ruff check
uv run pyright
uv run pytest
uv run pytest --cov=timecore
uv build
```

## License

MIT. See [LICENSE](LICENSE).
