chronow 0.2.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.
- chronow-0.2.0/PKG-INFO +36 -0
- chronow-0.2.0/README.md +22 -0
- chronow-0.2.0/chronow/__init__.py +3 -0
- chronow-0.2.0/chronow/api.py +46 -0
- chronow-0.2.0/chronow.egg-info/PKG-INFO +36 -0
- chronow-0.2.0/chronow.egg-info/SOURCES.txt +8 -0
- chronow-0.2.0/chronow.egg-info/dependency_links.txt +1 -0
- chronow-0.2.0/chronow.egg-info/top_level.txt +1 -0
- chronow-0.2.0/pyproject.toml +28 -0
- chronow-0.2.0/setup.cfg +4 -0
chronow-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chronow
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Chronow deterministic temporal engine Python bindings (CLI bridge)
|
|
5
|
+
Author-email: Hunter Bown <hunter@chronow.dev>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Hmbown/chronow
|
|
8
|
+
Project-URL: Repository, https://github.com/Hmbown/chronow
|
|
9
|
+
Project-URL: Documentation, https://github.com/Hmbown/chronow/tree/main/docs
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# chronow
|
|
16
|
+
|
|
17
|
+
Python bindings for the Chronow temporal engine.
|
|
18
|
+
|
|
19
|
+
This package is a thin wrapper around the `chronow` CLI so the Python adapter stays byte-identical with the Rust and TypeScript adapters.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install chronow
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You also need the `chronow` binary on your `$PATH` (or set `CHRONOW_BIN=/path/to/chronow`).
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from chronow import evaluate
|
|
33
|
+
|
|
34
|
+
resp = evaluate({"op": "now", "zone": "America/Chicago"})
|
|
35
|
+
print(resp["value"]["zoned"])
|
|
36
|
+
```
|
chronow-0.2.0/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# chronow
|
|
2
|
+
|
|
3
|
+
Python bindings for the Chronow temporal engine.
|
|
4
|
+
|
|
5
|
+
This package is a thin wrapper around the `chronow` CLI so the Python adapter stays byte-identical with the Rust and TypeScript adapters.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install chronow
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
You also need the `chronow` binary on your `$PATH` (or set `CHRONOW_BIN=/path/to/chronow`).
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from chronow import evaluate
|
|
19
|
+
|
|
20
|
+
resp = evaluate({"op": "now", "zone": "America/Chicago"})
|
|
21
|
+
print(resp["value"]["zoned"])
|
|
22
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import subprocess
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any, Dict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
JsonDict = Dict[str, Any]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _resolve_chronow_bin(chronow_bin: str | None = None) -> str:
|
|
14
|
+
if chronow_bin:
|
|
15
|
+
return chronow_bin
|
|
16
|
+
|
|
17
|
+
env_bin = os.environ.get("CHRONOW_BIN")
|
|
18
|
+
if env_bin:
|
|
19
|
+
return env_bin
|
|
20
|
+
|
|
21
|
+
local_bin = Path.cwd() / "target" / "debug" / "chronow"
|
|
22
|
+
if local_bin.exists():
|
|
23
|
+
return str(local_bin)
|
|
24
|
+
|
|
25
|
+
return "chronow"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _run(args: list[str], chronow_bin: str | None = None) -> str:
|
|
29
|
+
bin_path = _resolve_chronow_bin(chronow_bin)
|
|
30
|
+
completed = subprocess.run(
|
|
31
|
+
[bin_path, *args],
|
|
32
|
+
check=True,
|
|
33
|
+
capture_output=True,
|
|
34
|
+
text=True,
|
|
35
|
+
)
|
|
36
|
+
return completed.stdout
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def evaluate(request: JsonDict, chronow_bin: str | None = None) -> JsonDict:
|
|
40
|
+
stdout = _run(["eval", "--request", json.dumps(request)], chronow_bin)
|
|
41
|
+
return json.loads(stdout)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def evaluate_corpus_file(cases_file: str, chronow_bin: str | None = None) -> JsonDict:
|
|
45
|
+
stdout = _run(["eval-corpus", "--cases-file", cases_file], chronow_bin)
|
|
46
|
+
return json.loads(stdout)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chronow
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Chronow deterministic temporal engine Python bindings (CLI bridge)
|
|
5
|
+
Author-email: Hunter Bown <hunter@chronow.dev>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Hmbown/chronow
|
|
8
|
+
Project-URL: Repository, https://github.com/Hmbown/chronow
|
|
9
|
+
Project-URL: Documentation, https://github.com/Hmbown/chronow/tree/main/docs
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# chronow
|
|
16
|
+
|
|
17
|
+
Python bindings for the Chronow temporal engine.
|
|
18
|
+
|
|
19
|
+
This package is a thin wrapper around the `chronow` CLI so the Python adapter stays byte-identical with the Rust and TypeScript adapters.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install chronow
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You also need the `chronow` binary on your `$PATH` (or set `CHRONOW_BIN=/path/to/chronow`).
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from chronow import evaluate
|
|
33
|
+
|
|
34
|
+
resp = evaluate({"op": "now", "zone": "America/Chicago"})
|
|
35
|
+
print(resp["value"]["zoned"])
|
|
36
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chronow
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=70.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "chronow"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Chronow deterministic temporal engine Python bindings (CLI bridge)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
dependencies = []
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[[project.authors]]
|
|
19
|
+
name = "Hunter Bown"
|
|
20
|
+
email = "hunter@chronow.dev"
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/Hmbown/chronow"
|
|
24
|
+
Repository = "https://github.com/Hmbown/chronow"
|
|
25
|
+
Documentation = "https://github.com/Hmbown/chronow/tree/main/docs"
|
|
26
|
+
|
|
27
|
+
[tool.setuptools]
|
|
28
|
+
packages = ["chronow"]
|
chronow-0.2.0/setup.cfg
ADDED