lexdays 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 (62) hide show
  1. lexdays-0.1.0/.gitignore +29 -0
  2. lexdays-0.1.0/LICENSE +21 -0
  3. lexdays-0.1.0/PKG-INFO +78 -0
  4. lexdays-0.1.0/README.md +45 -0
  5. lexdays-0.1.0/hatch_build.py +22 -0
  6. lexdays-0.1.0/pyproject.toml +96 -0
  7. lexdays-0.1.0/src/lexdays/__init__.py +53 -0
  8. lexdays-0.1.0/src/lexdays/__main__.py +3 -0
  9. lexdays-0.1.0/src/lexdays/_calendar.py +541 -0
  10. lexdays-0.1.0/src/lexdays/_data/calendars/de-bb.json +23 -0
  11. lexdays-0.1.0/src/lexdays/_data/calendars/de-be.json +56 -0
  12. lexdays-0.1.0/src/lexdays/_data/calendars/de-bw.json +46 -0
  13. lexdays-0.1.0/src/lexdays/_data/calendars/de-by-augsburg.json +23 -0
  14. lexdays-0.1.0/src/lexdays/_data/calendars/de-by-catholic.json +23 -0
  15. lexdays-0.1.0/src/lexdays/_data/calendars/de-by.json +60 -0
  16. lexdays-0.1.0/src/lexdays/_data/calendars/de-hb.json +30 -0
  17. lexdays-0.1.0/src/lexdays/_data/calendars/de-he.json +22 -0
  18. lexdays-0.1.0/src/lexdays/_data/calendars/de-hh.json +24 -0
  19. lexdays-0.1.0/src/lexdays/_data/calendars/de-mv.json +36 -0
  20. lexdays-0.1.0/src/lexdays/_data/calendars/de-ni.json +24 -0
  21. lexdays-0.1.0/src/lexdays/_data/calendars/de-nw.json +34 -0
  22. lexdays-0.1.0/src/lexdays/_data/calendars/de-rp.json +34 -0
  23. lexdays-0.1.0/src/lexdays/_data/calendars/de-sh.json +24 -0
  24. lexdays-0.1.0/src/lexdays/_data/calendars/de-sl.json +46 -0
  25. lexdays-0.1.0/src/lexdays/_data/calendars/de-sn.json +50 -0
  26. lexdays-0.1.0/src/lexdays/_data/calendars/de-st.json +35 -0
  27. lexdays-0.1.0/src/lexdays/_data/calendars/de-th.json +39 -0
  28. lexdays-0.1.0/src/lexdays/_data/calendars/de.json +143 -0
  29. lexdays-0.1.0/src/lexdays/_data/calendars/eu-cj.json +164 -0
  30. lexdays-0.1.0/src/lexdays/_data/calendars/gb-eaw.json +220 -0
  31. lexdays-0.1.0/src/lexdays/_data/calendars/tr.json +204 -0
  32. lexdays-0.1.0/src/lexdays/_data/calendars/us-ma.json +69 -0
  33. lexdays-0.1.0/src/lexdays/_data/calendars/us.json +245 -0
  34. lexdays-0.1.0/src/lexdays/_data/i18n/messages.json +523 -0
  35. lexdays-0.1.0/src/lexdays/_data/rulepacks/de/zpo.json +64 -0
  36. lexdays-0.1.0/src/lexdays/_data/rulepacks/eu/cj.json +86 -0
  37. lexdays-0.1.0/src/lexdays/_data/rulepacks/gb-eaw/cpr.json +537 -0
  38. lexdays-0.1.0/src/lexdays/_data/rulepacks/tr/aym.json +81 -0
  39. lexdays-0.1.0/src/lexdays/_data/rulepacks/tr/cmk.json +322 -0
  40. lexdays-0.1.0/src/lexdays/_data/rulepacks/tr/hmk.json +440 -0
  41. lexdays-0.1.0/src/lexdays/_data/rulepacks/tr/iik.json +124 -0
  42. lexdays-0.1.0/src/lexdays/_data/rulepacks/tr/iyuk.json +357 -0
  43. lexdays-0.1.0/src/lexdays/_data/rulepacks/tr/vuk.json +103 -0
  44. lexdays-0.1.0/src/lexdays/_data/rulepacks/us/frcp.json +121 -0
  45. lexdays-0.1.0/src/lexdays/_data.py +59 -0
  46. lexdays-0.1.0/src/lexdays/_dates.py +130 -0
  47. lexdays-0.1.0/src/lexdays/_i18n.py +55 -0
  48. lexdays-0.1.0/src/lexdays/_rules.py +816 -0
  49. lexdays-0.1.0/src/lexdays/cli.py +162 -0
  50. lexdays-0.1.0/src/lexdays/errors.py +31 -0
  51. lexdays-0.1.0/src/lexdays/py.typed +0 -0
  52. lexdays-0.1.0/tests/__init__.py +0 -0
  53. lexdays-0.1.0/tests/conftest.py +21 -0
  54. lexdays-0.1.0/tests/test_api.py +130 -0
  55. lexdays-0.1.0/tests/test_cli.py +109 -0
  56. lexdays-0.1.0/tests/test_i18n.py +57 -0
  57. lexdays-0.1.0/tests/test_metadata.py +57 -0
  58. lexdays-0.1.0/tests/test_properties.py +159 -0
  59. lexdays-0.1.0/tests/test_schemas.py +52 -0
  60. lexdays-0.1.0/tests/test_vectors_bundled.py +108 -0
  61. lexdays-0.1.0/tests/test_vectors_core.py +117 -0
  62. lexdays-0.1.0/uv.lock +1159 -0
@@ -0,0 +1,29 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ .venv/
5
+ .pytest_cache/
6
+ .mypy_cache/
7
+ .ruff_cache/
8
+ .hypothesis/
9
+ .coverage
10
+ coverage.xml
11
+ htmlcov/
12
+ dist/
13
+ build/
14
+ *.egg-info/
15
+
16
+ # JavaScript
17
+ node_modules/
18
+ js/dist/
19
+ js/coverage/
20
+ js/src/data.generated.ts
21
+ site/assets/lexdays.js
22
+
23
+ # OS / editors
24
+ .DS_Store
25
+ Thumbs.db
26
+ .idea/
27
+ .vscode/
28
+ .pkgtest/
29
+ .claude/
lexdays-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DoGood-Studio and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
lexdays-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.5
2
+ Name: lexdays
3
+ Version: 0.1.0
4
+ Summary: Explainable legal deadline and business-day calculator. Every result cites the rule it applied. Zero dependencies.
5
+ Project-URL: Homepage, https://github.com/DoGood-Studio/legal-deadline-calculator
6
+ Project-URL: Documentation, https://github.com/DoGood-Studio/legal-deadline-calculator#readme
7
+ Project-URL: Repository, https://github.com/DoGood-Studio/legal-deadline-calculator
8
+ Project-URL: Issues, https://github.com/DoGood-Studio/legal-deadline-calculator/issues
9
+ Project-URL: Changelog, https://github.com/DoGood-Studio/legal-deadline-calculator/blob/main/CHANGELOG.md
10
+ Author: DoGood-Studio
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: Turkey,Türkiye,adli tatil,business days,court rules,deadline calculator,holidays,iş günü,legal deadline,rules as code,statute of limitations,süre hesaplama,working days
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Financial and Insurance Industry
17
+ Classifier: Intended Audience :: Legal Industry
18
+ Classifier: Natural Language :: English
19
+ Classifier: Natural Language :: Turkish
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: 3.14
28
+ Classifier: Topic :: Office/Business :: Scheduling
29
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
30
+ Classifier: Typing :: Typed
31
+ Requires-Python: >=3.10
32
+ Description-Content-Type: text/markdown
33
+
34
+ # lexdays
35
+
36
+ **Legal deadlines and business days you can verify.** lexdays computes the last day to act and explains every step, with the statute or court decision it comes from.
37
+
38
+ - Türkiye (HMK, İİK, CMK, İYUK, VUK, Constitutional Court), US federal courts (FRCP 6), England and Wales (CPR 2.8), the EU Court of Justice and Germany (ZPO)
39
+ - Judicial recesses, half-day holidays, deemed service, add-on days for mail, counting back from a hearing, clear days, month ends
40
+ - Calculation steps explained in 12 languages
41
+ - Disputed points are options with a notice; dates outside the verified holiday data raise an error instead of guessing
42
+ - No dependencies, MIT licensed; the TypeScript package (`npm install lexdays`) gives identical results
43
+
44
+ ```bash
45
+ pip install lexdays
46
+ ```
47
+
48
+ ```python
49
+ import lexdays
50
+
51
+ r = lexdays.compute("tr/hmk", "2026-07-30", "P2W") # Turkish civil procedure, 2 weeks from service
52
+ r.deadline # datetime.date(2026, 9, 8): extended by the judicial recess
53
+ print(r.explain("en")) # numbered steps, each with its citation
54
+
55
+ lexdays.compute("us/frcp", "2025-07-31", "P30D", options={"service": "mail"}).deadline
56
+ # datetime.date(2025, 9, 5)
57
+
58
+ lexdays.compute("gb-eaw/cpr", "2025-10-20", "P3D", direction="before").deadline
59
+ # datetime.date(2025, 10, 14): 3 clear days before the hearing
60
+
61
+ lexdays.compute("de/zpo", "2025-07-15", "P1M", calendar="de-by-catholic").deadline
62
+ # datetime.date(2025, 8, 18): 15 August is a holiday at a Munich court
63
+
64
+ lexdays.calendar("tr").add_business_days("2026-05-22", 3)
65
+ # datetime.date(2026, 6, 1): skips the Feast of Sacrifice
66
+ ```
67
+
68
+ Command line:
69
+
70
+ ```bash
71
+ lexdays deadline tr/hmk 2026-07-30 P2W --lang de
72
+ lexdays deadline de/zpo 2025-07-25 P2W --calendar de-by-augsburg
73
+ lexdays holidays tr 2026
74
+ ```
75
+
76
+ Documentation, rule sources and the live demo: <https://github.com/DoGood-Studio/legal-deadline-calculator>
77
+
78
+ This is an informational tool, not legal advice. Always check a deadline that matters.
@@ -0,0 +1,45 @@
1
+ # lexdays
2
+
3
+ **Legal deadlines and business days you can verify.** lexdays computes the last day to act and explains every step, with the statute or court decision it comes from.
4
+
5
+ - Türkiye (HMK, İİK, CMK, İYUK, VUK, Constitutional Court), US federal courts (FRCP 6), England and Wales (CPR 2.8), the EU Court of Justice and Germany (ZPO)
6
+ - Judicial recesses, half-day holidays, deemed service, add-on days for mail, counting back from a hearing, clear days, month ends
7
+ - Calculation steps explained in 12 languages
8
+ - Disputed points are options with a notice; dates outside the verified holiday data raise an error instead of guessing
9
+ - No dependencies, MIT licensed; the TypeScript package (`npm install lexdays`) gives identical results
10
+
11
+ ```bash
12
+ pip install lexdays
13
+ ```
14
+
15
+ ```python
16
+ import lexdays
17
+
18
+ r = lexdays.compute("tr/hmk", "2026-07-30", "P2W") # Turkish civil procedure, 2 weeks from service
19
+ r.deadline # datetime.date(2026, 9, 8): extended by the judicial recess
20
+ print(r.explain("en")) # numbered steps, each with its citation
21
+
22
+ lexdays.compute("us/frcp", "2025-07-31", "P30D", options={"service": "mail"}).deadline
23
+ # datetime.date(2025, 9, 5)
24
+
25
+ lexdays.compute("gb-eaw/cpr", "2025-10-20", "P3D", direction="before").deadline
26
+ # datetime.date(2025, 10, 14): 3 clear days before the hearing
27
+
28
+ lexdays.compute("de/zpo", "2025-07-15", "P1M", calendar="de-by-catholic").deadline
29
+ # datetime.date(2025, 8, 18): 15 August is a holiday at a Munich court
30
+
31
+ lexdays.calendar("tr").add_business_days("2026-05-22", 3)
32
+ # datetime.date(2026, 6, 1): skips the Feast of Sacrifice
33
+ ```
34
+
35
+ Command line:
36
+
37
+ ```bash
38
+ lexdays deadline tr/hmk 2026-07-30 P2W --lang de
39
+ lexdays deadline de/zpo 2025-07-25 P2W --calendar de-by-augsburg
40
+ lexdays holidays tr 2026
41
+ ```
42
+
43
+ Documentation, rule sources and the live demo: <https://github.com/DoGood-Studio/legal-deadline-calculator>
44
+
45
+ This is an informational tool, not legal advice. Always check a deadline that matters.
@@ -0,0 +1,22 @@
1
+ """Bundle the repository-level ``data/`` directory into the package.
2
+
3
+ From a git checkout the shared data lives one level up. An sdist already
4
+ contains it under ``src/lexdays/_data``, so building a wheel from the sdist
5
+ needs nothing extra.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from pathlib import Path
11
+ from typing import Any
12
+
13
+ from hatchling.builders.hooks.plugin.interface import BuildHookInterface
14
+
15
+
16
+ class CustomBuildHook(BuildHookInterface):
17
+ def initialize(self, version: str, build_data: dict[str, Any]) -> None:
18
+ shared = Path(self.root).parent / "data"
19
+ if not shared.is_dir():
20
+ return
21
+ target = "src/lexdays/_data" if self.target_name == "sdist" else "lexdays/_data"
22
+ build_data["force_include"][str(shared)] = target
@@ -0,0 +1,96 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.26"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "lexdays"
7
+ version = "0.1.0"
8
+ description = "Explainable legal deadline and business-day calculator. Every result cites the rule it applied. Zero dependencies."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "DoGood-Studio" }]
14
+ keywords = [
15
+ "legal deadline", "deadline calculator", "business days", "working days",
16
+ "holidays", "court rules", "rules as code", "statute of limitations",
17
+ "süre hesaplama", "iş günü", "adli tatil", "Turkey", "Türkiye",
18
+ ]
19
+ classifiers = [
20
+ "Development Status :: 3 - Alpha",
21
+ "Intended Audience :: Developers",
22
+ "Intended Audience :: Legal Industry",
23
+ "Intended Audience :: Financial and Insurance Industry",
24
+ "Natural Language :: English",
25
+ "Natural Language :: Turkish",
26
+ "Operating System :: OS Independent",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3 :: Only",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ "Programming Language :: Python :: 3.14",
34
+ "Topic :: Office/Business :: Scheduling",
35
+ "Topic :: Software Development :: Libraries :: Python Modules",
36
+ "Typing :: Typed",
37
+ ]
38
+ dependencies = []
39
+
40
+ [project.scripts]
41
+ lexdays = "lexdays.cli:main"
42
+
43
+ [project.urls]
44
+ Homepage = "https://github.com/DoGood-Studio/legal-deadline-calculator"
45
+ Documentation = "https://github.com/DoGood-Studio/legal-deadline-calculator#readme"
46
+ Repository = "https://github.com/DoGood-Studio/legal-deadline-calculator"
47
+ Issues = "https://github.com/DoGood-Studio/legal-deadline-calculator/issues"
48
+ Changelog = "https://github.com/DoGood-Studio/legal-deadline-calculator/blob/main/CHANGELOG.md"
49
+
50
+ [dependency-groups]
51
+ dev = [
52
+ "pytest>=8.3",
53
+ "pytest-cov>=6.0",
54
+ "hypothesis>=6.120",
55
+ "mypy>=1.13",
56
+ "ruff>=0.8",
57
+ "jsonschema>=4.23",
58
+ ]
59
+
60
+ [tool.hatch.build]
61
+ artifacts = ["src/lexdays/_data/"]
62
+
63
+ [tool.hatch.build.targets.wheel]
64
+ packages = ["src/lexdays"]
65
+
66
+ [tool.hatch.build.hooks.custom]
67
+
68
+ [tool.pytest.ini_options]
69
+ testpaths = ["tests"]
70
+ addopts = "-ra --strict-markers"
71
+ xfail_strict = true
72
+
73
+ [tool.coverage.run]
74
+ source = ["lexdays"]
75
+ branch = true
76
+
77
+ [tool.coverage.report]
78
+ show_missing = true
79
+ skip_covered = true
80
+ exclude_also = ["if __name__ == .__main__.:", "raise NotImplementedError"]
81
+
82
+ [tool.mypy]
83
+ strict = true
84
+ python_version = "3.10"
85
+ files = ["src"]
86
+
87
+ [tool.ruff]
88
+ line-length = 110
89
+ target-version = "py310"
90
+
91
+ [tool.ruff.lint]
92
+ select = ["E", "F", "W", "I", "B", "UP", "SIM", "RUF", "PL", "C4", "PT"]
93
+ ignore = ["PLR0911", "PLR0912", "PLR0913", "PLR0915", "PLR2004", "RUF001", "RUF002", "RUF003"]
94
+
95
+ [tool.ruff.lint.per-file-ignores]
96
+ "tests/**" = ["PLC0415"]
@@ -0,0 +1,53 @@
1
+ """lexdays — explainable legal deadlines and business days.
2
+
3
+ >>> import lexdays
4
+ >>> cal = lexdays.calendar("us")
5
+ >>> cal.add_business_days("2026-07-02", 1).isoformat()
6
+ '2026-07-06'
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from ._calendar import Calendar, Holiday, calendar, list_calendars
12
+ from ._rules import (
13
+ Citation,
14
+ DeadlineResult,
15
+ Notice,
16
+ Period,
17
+ RulePack,
18
+ TraceStep,
19
+ compute,
20
+ list_rulepacks,
21
+ rulepack,
22
+ )
23
+ from .errors import (
24
+ CoverageError,
25
+ DataError,
26
+ LexdaysError,
27
+ NotFoundError,
28
+ OptionError,
29
+ )
30
+
31
+ __version__ = "0.1.0"
32
+
33
+ __all__ = [
34
+ "Calendar",
35
+ "Citation",
36
+ "CoverageError",
37
+ "DataError",
38
+ "DeadlineResult",
39
+ "Holiday",
40
+ "LexdaysError",
41
+ "NotFoundError",
42
+ "Notice",
43
+ "OptionError",
44
+ "Period",
45
+ "RulePack",
46
+ "TraceStep",
47
+ "__version__",
48
+ "calendar",
49
+ "compute",
50
+ "list_calendars",
51
+ "list_rulepacks",
52
+ "rulepack",
53
+ ]
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ raise SystemExit(main())