mirror of
https://git.pumpin.online/funkpower/typikon.git
synced 2026-10-23 03:07:12 +00:00
rebuild the engine in Rust
Python was never the house language here: the mw-* desktop surface it came
from is 39 bash scripts and was exactly one Python script, the one this was
extracted from. What it cost was distribution, a widget dependency that
needed pipx and a Python floor, and 24ms of interpreter startup before a line
of the program ran.
The port is verified rather than asserted. Both implementations were run over
199,446 day-records, 26 jurisdictions across 21 years, with every field of
every record required to match; the JSON, the iCalendar and 480 renderings of
the text output are identical too. examples/dump.rs is the harness.
What the type system actually buys, which is less than the usual claim and
more than nothing:
- Level is an ordered enum, strictest first, so reads as 'a is
stricter' and relaxed_to() is the one place a feast can lift a fast. No
rule can get the direction backwards.
- Date is a newtype over the Julian Day Number and JulianDate is a separate
type, so a civil date and an ecclesiastical one cannot be mixed up. That
confusion is the single most common way calendar code goes wrong.
- Octets is a newtype in the iCalendar folder, because the bug it replaced
counted characters against a limit RFC 5545 states in octets.
- Movables is a struct, not a map, so a mistyped key is a compile error
rather than a None at the far end of the program.
Of the six defects an adversarial review found in the Python, exactly one had
a shape a type system would have caught. The rest were logic, and the tests
came with them.
The menologion is compiled in with include_str!, so the binary answers on its
own: 930KB, no runtime, 1.2ms to start against Python's 36ms.
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=64"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "typikon"
|
||||
version = "0.1.0"
|
||||
description = "The Orthodox liturgical day — feasts, seasons and the fast, computed rather than fetched"
|
||||
readme = "README.md"
|
||||
license = { text = "GPL-2.0-only" }
|
||||
requires-python = ">=3.9"
|
||||
authors = [{ name = "funkpower", email = "funkpower@pumpin.online" }]
|
||||
keywords = ["orthodox", "liturgical", "calendar", "byzantine", "pascha",
|
||||
"menologion", "typikon", "fasting"]
|
||||
classifiers = [
|
||||
"Development Status :: 4 - Beta",
|
||||
"Environment :: Console",
|
||||
"Intended Audience :: End Users/Desktop",
|
||||
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Topic :: Religion",
|
||||
"Topic :: Utilities",
|
||||
]
|
||||
dependencies = []
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = ["pytest>=7"]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://git.pumpin.online/funkpower/typikon"
|
||||
Source = "https://git.pumpin.online/funkpower/typikon"
|
||||
|
||||
[project.scripts]
|
||||
typikon = "typikon.cli:main"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["typikon*"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
typikon = ["data/*.json", "data/LICENSE"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["tests"]
|
||||
Reference in New Issue
Block a user