timecore 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. timecore-0.1.0/PKG-INFO +111 -0
  2. timecore-0.1.0/README.md +89 -0
  3. timecore-0.1.0/pyproject.toml +55 -0
  4. timecore-0.1.0/pyproject.toml.orig +59 -0
  5. timecore-0.1.0/src/timecore/__init__.py +123 -0
  6. timecore-0.1.0/src/timecore/_internal/__init__.py +1 -0
  7. timecore-0.1.0/src/timecore/availability/__init__.py +7 -0
  8. timecore-0.1.0/src/timecore/availability/availability.py +360 -0
  9. timecore-0.1.0/src/timecore/calendar/__init__.py +13 -0
  10. timecore-0.1.0/src/timecore/calendar/_common.py +71 -0
  11. timecore-0.1.0/src/timecore/calendar/business.py +326 -0
  12. timecore-0.1.0/src/timecore/calendar/calendar.py +92 -0
  13. timecore-0.1.0/src/timecore/calendar/holidays.py +168 -0
  14. timecore-0.1.0/src/timecore/clock/__init__.py +14 -0
  15. timecore-0.1.0/src/timecore/clock/clock.py +138 -0
  16. timecore-0.1.0/src/timecore/clock/timer.py +142 -0
  17. timecore-0.1.0/src/timecore/core/__init__.py +26 -0
  18. timecore-0.1.0/src/timecore/core/_common.py +345 -0
  19. timecore-0.1.0/src/timecore/core/date.py +257 -0
  20. timecore-0.1.0/src/timecore/core/duration.py +264 -0
  21. timecore-0.1.0/src/timecore/core/instant.py +265 -0
  22. timecore-0.1.0/src/timecore/core/local_datetime.py +347 -0
  23. timecore-0.1.0/src/timecore/core/period.py +367 -0
  24. timecore-0.1.0/src/timecore/core/time.py +250 -0
  25. timecore-0.1.0/src/timecore/core/timezone.py +125 -0
  26. timecore-0.1.0/src/timecore/core/weekday.py +22 -0
  27. timecore-0.1.0/src/timecore/core/zoned_datetime.py +442 -0
  28. timecore-0.1.0/src/timecore/errors.py +48 -0
  29. timecore-0.1.0/src/timecore/formatting/__init__.py +10 -0
  30. timecore-0.1.0/src/timecore/formatting/format.py +249 -0
  31. timecore-0.1.0/src/timecore/interval/__init__.py +8 -0
  32. timecore-0.1.0/src/timecore/interval/interval.py +478 -0
  33. timecore-0.1.0/src/timecore/interval/interval_set.py +243 -0
  34. timecore-0.1.0/src/timecore/parsing/__init__.py +25 -0
  35. timecore-0.1.0/src/timecore/parsing/parse.py +477 -0
  36. timecore-0.1.0/src/timecore/py.typed +0 -0
  37. timecore-0.1.0/src/timecore/recurrence/__init__.py +8 -0
  38. timecore-0.1.0/src/timecore/recurrence/_shared.py +140 -0
  39. timecore-0.1.0/src/timecore/recurrence/cron.py +306 -0
  40. timecore-0.1.0/src/timecore/recurrence/recurrence.py +995 -0
  41. timecore-0.1.0/src/timecore/schedule/__init__.py +7 -0
  42. timecore-0.1.0/src/timecore/schedule/schedule.py +519 -0
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.4
2
+ Name: timecore
3
+ Version: 0.1.0
4
+ Summary: A modern, unified, fully typed, cross-platform Python library for date, time, duration, intervals, calendars, recurrence, and scheduling.
5
+ Author: Oceanus
6
+ Author-email: Oceanus <295322314+oceanus403@users.noreply.github.com>
7
+ License-Expression: MIT
8
+ Requires-Dist: whenever>=0.11.0
9
+ Requires-Dist: tzdata>=2025.1
10
+ Requires-Dist: tzlocal>=5.0
11
+ Requires-Dist: python-dateutil>=2.9.0
12
+ Requires-Dist: holidays>=0.109
13
+ Requires-Dist: portion>=2.6.3
14
+ Requires-Dist: babel>=2.19.0
15
+ Requires-Dist: croniter>=7.0.0
16
+ Requires-Dist: dateparser>=1.5.1 ; extra == 'natural'
17
+ Requires-Python: >=3.11
18
+ Project-URL: Repository, https://github.com/oceanus403/timecore
19
+ Project-URL: Documentation, https://oceanus403.github.io/timecore/
20
+ Provides-Extra: natural
21
+ Description-Content-Type: text/markdown
22
+
23
+ # TimeCore
24
+
25
+ A modern, unified, fully typed, cross-platform Python library for date, time, duration, intervals, calendars, recurrence, and scheduling.
26
+
27
+ 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.
28
+
29
+ ## Installation
30
+
31
+ Requires Python 3.11+.
32
+
33
+ ```bash
34
+ uv add timecore
35
+ ```
36
+
37
+ ```bash
38
+ pip install timecore
39
+ ```
40
+
41
+ With optional natural-language parsing support:
42
+
43
+ ```bash
44
+ uv add "timecore[natural]"
45
+ ```
46
+
47
+ ## Quick Start
48
+
49
+ ```python
50
+ from timecore import Date, DateTime, Duration, Period
51
+
52
+ today = Date(2026, 11, 25)
53
+ print(today + Period(months=1)) # 2026-12-25
54
+ print(today + Duration(days=10)) # 2026-12-05
55
+
56
+ meeting = DateTime(2026, 11, 25, 9, 0, timezone="America/New_York")
57
+ print(meeting.to_instant()) # 2026-11-25T14:00:00Z
58
+ ```
59
+
60
+ Schedule a weekly Monday 9am meeting in New York:
61
+
62
+ ```python
63
+ from timecore import Recurrence, Schedule, Time, Weekday
64
+
65
+ schedule = Schedule(
66
+ Recurrence.weekly([Weekday.MONDAY]),
67
+ time=Time(9, 0),
68
+ timezone="America/New_York",
69
+ )
70
+ print(schedule.occurrences(Date(2026, 11, 23), count=3))
71
+ ```
72
+
73
+ Parse strictly and format for a locale:
74
+
75
+ ```python
76
+ from timecore import parse_date
77
+
78
+ d = parse_date("2026-11-25") # strict ISO 8601; anything else raises ParseError
79
+ print(d.format()) # Nov 25, 2026
80
+ print(d.format(locale="fr_FR")) # 25 nov. 2026
81
+ ```
82
+
83
+ See the [documentation](https://oceanus403.github.io/timecore/) and the
84
+ [API reference](https://oceanus403.github.io/timecore/docs/api-reference) for more.
85
+
86
+ ## Features
87
+
88
+ - Immutable, fully typed temporal value types
89
+ - Date, time, datetime, instant, duration, and period arithmetic
90
+ - Intervals and interval sets
91
+ - Calendars, holidays, and business days
92
+ - Recurrence rules and cron expressions
93
+ - Scheduling and availability
94
+ - Strict ISO 8601 parsing, locale-aware formatting, and optional natural-language parsing
95
+ - Injectable clocks and timers for deterministic testing
96
+
97
+ ## Development
98
+
99
+ ```bash
100
+ uv sync --locked
101
+ uv run ruff format
102
+ uv run ruff check
103
+ uv run pyright
104
+ uv run pytest
105
+ uv run pytest --cov=timecore
106
+ uv build
107
+ ```
108
+
109
+ ## License
110
+
111
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,89 @@
1
+ # TimeCore
2
+
3
+ A modern, unified, fully typed, cross-platform Python library for date, time, duration, intervals, calendars, recurrence, and scheduling.
4
+
5
+ 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.
6
+
7
+ ## Installation
8
+
9
+ Requires Python 3.11+.
10
+
11
+ ```bash
12
+ uv add timecore
13
+ ```
14
+
15
+ ```bash
16
+ pip install timecore
17
+ ```
18
+
19
+ With optional natural-language parsing support:
20
+
21
+ ```bash
22
+ uv add "timecore[natural]"
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ```python
28
+ from timecore import Date, DateTime, Duration, Period
29
+
30
+ today = Date(2026, 11, 25)
31
+ print(today + Period(months=1)) # 2026-12-25
32
+ print(today + Duration(days=10)) # 2026-12-05
33
+
34
+ meeting = DateTime(2026, 11, 25, 9, 0, timezone="America/New_York")
35
+ print(meeting.to_instant()) # 2026-11-25T14:00:00Z
36
+ ```
37
+
38
+ Schedule a weekly Monday 9am meeting in New York:
39
+
40
+ ```python
41
+ from timecore import Recurrence, Schedule, Time, Weekday
42
+
43
+ schedule = Schedule(
44
+ Recurrence.weekly([Weekday.MONDAY]),
45
+ time=Time(9, 0),
46
+ timezone="America/New_York",
47
+ )
48
+ print(schedule.occurrences(Date(2026, 11, 23), count=3))
49
+ ```
50
+
51
+ Parse strictly and format for a locale:
52
+
53
+ ```python
54
+ from timecore import parse_date
55
+
56
+ d = parse_date("2026-11-25") # strict ISO 8601; anything else raises ParseError
57
+ print(d.format()) # Nov 25, 2026
58
+ print(d.format(locale="fr_FR")) # 25 nov. 2026
59
+ ```
60
+
61
+ See the [documentation](https://oceanus403.github.io/timecore/) and the
62
+ [API reference](https://oceanus403.github.io/timecore/docs/api-reference) for more.
63
+
64
+ ## Features
65
+
66
+ - Immutable, fully typed temporal value types
67
+ - Date, time, datetime, instant, duration, and period arithmetic
68
+ - Intervals and interval sets
69
+ - Calendars, holidays, and business days
70
+ - Recurrence rules and cron expressions
71
+ - Scheduling and availability
72
+ - Strict ISO 8601 parsing, locale-aware formatting, and optional natural-language parsing
73
+ - Injectable clocks and timers for deterministic testing
74
+
75
+ ## Development
76
+
77
+ ```bash
78
+ uv sync --locked
79
+ uv run ruff format
80
+ uv run ruff check
81
+ uv run pyright
82
+ uv run pytest
83
+ uv run pytest --cov=timecore
84
+ uv build
85
+ ```
86
+
87
+ ## License
88
+
89
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,55 @@
1
+ [project]
2
+ name = "timecore"
3
+ version = "0.1.0"
4
+ description = "A modern, unified, fully typed, cross-platform Python library for date, time, duration, intervals, calendars, recurrence, and scheduling."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ requires-python = ">=3.11"
8
+ dependencies = [
9
+ "whenever>=0.11.0",
10
+ "tzdata>=2025.1",
11
+ "tzlocal>=5.0",
12
+ "python-dateutil>=2.9.0",
13
+ "holidays>=0.109",
14
+ "portion>=2.6.3",
15
+ "babel>=2.19.0",
16
+ "croniter>=7.0.0",
17
+ ]
18
+
19
+ [[project.authors]]
20
+ name = "Oceanus"
21
+ email = "295322314+oceanus403@users.noreply.github.com"
22
+
23
+ [project.optional-dependencies]
24
+ natural = ["dateparser>=1.5.1"]
25
+
26
+ [project.urls]
27
+ Repository = "https://github.com/oceanus403/timecore"
28
+ Documentation = "https://oceanus403.github.io/timecore/"
29
+
30
+ [build-system]
31
+ requires = ["uv_build>=0.13.10,<0.14.0"]
32
+ build-backend = "uv_build"
33
+
34
+ [tool.uv_build]
35
+ module-root = "src"
36
+
37
+ [tool.pytest.ini_options]
38
+ testpaths = ["tests"]
39
+
40
+ [tool.ruff]
41
+ target-version = "py311"
42
+
43
+ [tool.pyright]
44
+ pythonVersion = "3.11"
45
+ typeCheckingMode = "strict"
46
+ include = ["src/timecore"]
47
+
48
+ [dependency-groups]
49
+ dev = [
50
+ "hypothesis>=6.170.17",
51
+ "pyright>=1.1.414",
52
+ "pytest>=9.2.0",
53
+ "pytest-cov>=7.1.0",
54
+ "ruff>=0.17.6",
55
+ ]
@@ -0,0 +1,59 @@
1
+ [project]
2
+ name = "timecore"
3
+ version = "0.1.0"
4
+ description = "A modern, unified, fully typed, cross-platform Python library for date, time, duration, intervals, calendars, recurrence, and scheduling."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ authors = [
8
+ { name = "Oceanus", email = "295322314+oceanus403@users.noreply.github.com" }
9
+ ]
10
+ requires-python = ">=3.11"
11
+ dependencies = [
12
+ "whenever>=0.11.0",
13
+ "tzdata>=2025.1",
14
+ "tzlocal>=5.0",
15
+ "python-dateutil>=2.9.0",
16
+ "holidays>=0.109",
17
+ "portion>=2.6.3",
18
+ "babel>=2.19.0",
19
+ "croniter>=7.0.0",
20
+ ]
21
+
22
+ [project.optional-dependencies]
23
+ natural = [
24
+ "dateparser>=1.5.1",
25
+ ]
26
+
27
+ [project.urls]
28
+ Repository = "https://github.com/oceanus403/timecore"
29
+ Documentation = "https://oceanus403.github.io/timecore/"
30
+
31
+ [build-system]
32
+ requires = ["uv_build>=0.13.10,<0.14.0"]
33
+ build-backend = "uv_build"
34
+
35
+ # Explicit source layout: the package lives in src/timecore.
36
+ [tool.uv_build]
37
+ module-root = "src"
38
+
39
+ [tool.pytest.ini_options]
40
+ testpaths = ["tests"]
41
+
42
+ [tool.ruff]
43
+ target-version = "py311"
44
+
45
+ [tool.pyright]
46
+ pythonVersion = "3.11"
47
+ typeCheckingMode = "strict"
48
+ # Pyright covers the library source only. Tests exercise runtime behavior
49
+ # and are intentionally excluded from strict checking.
50
+ include = ["src/timecore"]
51
+
52
+ [dependency-groups]
53
+ dev = [
54
+ "hypothesis>=6.170.17",
55
+ "pyright>=1.1.414",
56
+ "pytest>=9.2.0",
57
+ "pytest-cov>=7.1.0",
58
+ "ruff>=0.17.6",
59
+ ]
@@ -0,0 +1,123 @@
1
+ """TimeCore: a modern, unified, fully typed Python library for date, time,
2
+ duration, intervals, calendars, recurrence, and scheduling.
3
+ """
4
+
5
+ # ruff: noqa: I001 -- imports are grouped by contractual workstream
6
+ # section below, not by isort order (see the `# --- <section> ---` markers).
7
+ from __future__ import annotations
8
+
9
+ from importlib.metadata import PackageNotFoundError, version
10
+
11
+ from .errors import (
12
+ AmbiguousTimeError,
13
+ InvalidIntervalError,
14
+ InvalidLocaleError,
15
+ NonexistentTimeError,
16
+ ParseError,
17
+ TimeCoreError,
18
+ UnknownTimeZoneError,
19
+ )
20
+
21
+ try:
22
+ __version__ = version("timecore")
23
+ except PackageNotFoundError:
24
+ __version__ = "0.0.0"
25
+
26
+ __all__ = [
27
+ "AmbiguousTimeError",
28
+ "Availability",
29
+ "BusinessCalendar",
30
+ "Calendar",
31
+ "Clock",
32
+ "Cron",
33
+ "Date",
34
+ "DateTime",
35
+ "Duration",
36
+ "FixedClock",
37
+ "HolidayCalendar",
38
+ "Instant",
39
+ "Interval",
40
+ "IntervalSet",
41
+ "InvalidIntervalError",
42
+ "InvalidLocaleError",
43
+ "LocalDateTime",
44
+ "NonexistentTimeError",
45
+ "OffsetClock",
46
+ "ParseError",
47
+ "Period",
48
+ "Recurrence",
49
+ "Schedule",
50
+ "SystemClock",
51
+ "Time",
52
+ "TimeCoreError",
53
+ "TimeZone",
54
+ "Timer",
55
+ "UnknownTimeZoneError",
56
+ "Weekday",
57
+ "__version__",
58
+ "available_timezones",
59
+ "format_duration",
60
+ "format_temporal",
61
+ "parse_date",
62
+ "parse_datetime",
63
+ "parse_duration",
64
+ "parse_instant",
65
+ "parse_local_datetime",
66
+ "parse_natural_language",
67
+ "parse_period",
68
+ "parse_time",
69
+ ]
70
+
71
+ # --- errors ---
72
+ # (Exports above.)
73
+
74
+ # --- core ---
75
+ # NOTE: the section imports below are in contractual section order, not
76
+ # alphabetical order, so import sorting (I001) is exempted for this block.
77
+ from .core import (
78
+ Date,
79
+ DateTime,
80
+ Duration,
81
+ Instant,
82
+ LocalDateTime,
83
+ Period,
84
+ Time,
85
+ TimeZone,
86
+ Weekday,
87
+ available_timezones,
88
+ )
89
+
90
+ # --- interval ---
91
+ from .interval import Interval, IntervalSet
92
+
93
+ # --- calendar ---
94
+ # NOTE: kept in its contractual section below the core import; ruff's
95
+ # import sorting would move it above, so the ordering is exempted here.
96
+ from .calendar import BusinessCalendar, Calendar, HolidayCalendar
97
+
98
+ # --- recurrence ---
99
+ from .recurrence import Cron, Recurrence
100
+
101
+ # --- schedule ---
102
+ from .schedule import Schedule
103
+
104
+ # --- availability ---
105
+ from .availability import Availability
106
+
107
+ # --- parsing ---
108
+ from .parsing import (
109
+ parse_date,
110
+ parse_datetime,
111
+ parse_duration,
112
+ parse_instant,
113
+ parse_local_datetime,
114
+ parse_natural_language,
115
+ parse_period,
116
+ parse_time,
117
+ )
118
+
119
+ # --- formatting ---
120
+ from .formatting import format_duration, format_temporal
121
+
122
+ # --- clock ---
123
+ from .clock import Clock, FixedClock, OffsetClock, SystemClock, Timer
@@ -0,0 +1 @@
1
+ """Shared private helpers. Not part of the public API."""
@@ -0,0 +1,7 @@
1
+ """Availability and free/busy interval computation."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .availability import Availability
6
+
7
+ __all__ = ["Availability"]