omnigraph 0.14.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.
@@ -0,0 +1,51 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ checks:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ python-version: ["3.11", "3.12", "3.13"]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: astral-sh/setup-uv@v6
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+ - run: uv sync --locked
23
+ - run: uv run ruff check .
24
+ - run: uv run ruff format --check .
25
+ - run: uv run mypy
26
+ - run: uv run python scripts/generate.py --check
27
+ - run: uv run pytest
28
+
29
+ e2e:
30
+ # Against the checksum-verified server release the SDK is pinned to.
31
+ runs-on: ubuntu-latest
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: astral-sh/setup-uv@v6
35
+ with:
36
+ python-version: "3.12"
37
+ - run: uv sync --locked
38
+ - name: Install omnigraph-server
39
+ run: |
40
+ version=$(uv run python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['tool']['omnigraph']['server-version'])")
41
+ base="https://github.com/ModernRelay/omnigraph/releases/download/v${version}"
42
+ mkdir -p "$RUNNER_TEMP/og" && cd "$RUNNER_TEMP/og"
43
+ curl -sSfL -o og.tar.gz "$base/omnigraph-linux-x86_64.tar.gz"
44
+ curl -sSfL -o og.sha256 "$base/omnigraph-linux-x86_64.sha256"
45
+ sed -i 's/omnigraph-linux-x86_64.tar.gz/og.tar.gz/' og.sha256
46
+ sha256sum -c og.sha256
47
+ tar xzf og.tar.gz omnigraph omnigraph-server
48
+ echo "OMNIGRAPH_BIN_DIR=$RUNNER_TEMP/og" >> "$GITHUB_ENV"
49
+ - run: uv run pytest tests/test_e2e.py
50
+ env:
51
+ OMNIGRAPH_TEST_SERVER: "1"
@@ -0,0 +1,40 @@
1
+ name: Release
2
+
3
+ # Publishes to PyPI through trusted publishing when a `v*` tag is pushed.
4
+ # Configure the PyPI project's trusted publisher for this repository and the
5
+ # `pypi` environment first; no API token is stored anywhere.
6
+ on:
7
+ push:
8
+ tags: ["v*"]
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v6
19
+ - name: Check the tag matches the package version
20
+ run: |
21
+ version=$(uv run python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
22
+ test "v${version}" = "${GITHUB_REF_NAME}"
23
+ - run: uv build
24
+ - uses: actions/upload-artifact@v4
25
+ with:
26
+ name: dist
27
+ path: dist/
28
+
29
+ publish:
30
+ needs: build
31
+ runs-on: ubuntu-latest
32
+ environment: pypi
33
+ permissions:
34
+ id-token: write
35
+ steps:
36
+ - uses: actions/download-artifact@v4
37
+ with:
38
+ name: dist
39
+ path: dist/
40
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,7 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ dist/
5
+ .mypy_cache/
6
+ .pytest_cache/
7
+ .ruff_cache/
@@ -0,0 +1,19 @@
1
+ # AGENTS.md
2
+
3
+ Python SDK for the Omnigraph HTTP API. Reference implementation: `ModernRelay/omnigraph-ts`
4
+ (`packages/sdk`), pinned to the same server release. Match its behaviour (contract header,
5
+ discovery, no retries, no redirects, receipt validation, error classes); use Python idioms
6
+ for names and shapes.
7
+
8
+ - The server version lives in `pyproject.toml` `[tool.omnigraph] server-version`. Bumping it:
9
+ `scripts/sync_spec.py`, then `scripts/generate.py`, then run the e2e suite against that
10
+ release's binaries.
11
+ - Versioning: the package's major.minor equals the server's contract (`generate.py --check`
12
+ enforces it); bump the patch for an SDK-only fix, the minor only with `server-version`.
13
+ - `src/omnigraph/_models.py` and `_version.py` are generated; never edit them by hand.
14
+ `scripts/generate.py --check` must pass.
15
+ - Public results are the generated `TypedDict`s; do not rename wire fields.
16
+ - Never add automatic retries. A lost write response is `outcome_unknown`, not a retry signal.
17
+ - Runtime dependency: `httpx` only.
18
+ - Checks: `uv run pytest`, `uv run mypy`, `uv run ruff check .`, `uv run ruff format --check .`;
19
+ e2e with `OMNIGRAPH_TEST_SERVER=1 OMNIGRAPH_BIN_DIR=...` (needs a free local port).
@@ -0,0 +1 @@
1
+ AGENTS.md
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 EQTR, Inc. and Omnigraph 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.
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.5
2
+ Name: omnigraph
3
+ Version: 0.14.0
4
+ Summary: Python client for the Omnigraph HTTP API
5
+ Project-URL: Homepage, https://github.com/ModernRelay/omnigraph-python
6
+ Project-URL: Issues, https://github.com/ModernRelay/omnigraph/issues
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Framework :: AsyncIO
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Typing :: Typed
13
+ Requires-Python: >=3.11
14
+ Requires-Dist: httpx<1,>=0.27
15
+ Description-Content-Type: text/markdown
16
+
17
+ # omnigraph
18
+
19
+ Async Python client for the [Omnigraph](https://github.com/ModernRelay/omnigraph) HTTP API,
20
+ contract **0.14**. It mirrors the TypeScript SDK
21
+ [`@modernrelay/omnigraph`](https://github.com/ModernRelay/omnigraph-ts): the same routes, the
22
+ same contract checks, and the same error model, with Python names.
23
+
24
+ ```sh
25
+ pip install omnigraph
26
+ ```
27
+
28
+ ## Connect and query
29
+
30
+ ```python
31
+ from omnigraph import Omnigraph
32
+
33
+ async with Omnigraph("http://127.0.0.1:8080", graph_id="knowledge", token=TOKEN) as og:
34
+ result = await og.query(
35
+ "query find($name: String) { match { $p: Person { name: $name } } return { $p.name, $p.age } }",
36
+ params={"name": "Alice"},
37
+ )
38
+ print(result["rows"], result["graph_commit_id"])
39
+ ```
40
+
41
+ `base_url` is the server root, including any proxy prefix. Select a graph with `graph_id` or
42
+ `og.graph("beta")`, which shares the connection pool. Results are the server's JSON as
43
+ `TypedDict`s generated from the server's OpenAPI document; field names are the wire names.
44
+ Rows omit null-valued fields.
45
+
46
+ Every request carries `Omnigraph-Http-Api: 0.14`, every response is checked for it, and a
47
+ `HEAD /healthz` discovery precedes each data request. The client follows no redirects and
48
+ never retries.
49
+
50
+ ## Versions
51
+
52
+ The package's major.minor is the HTTP contract it speaks: `omnigraph` 0.14.x talks to
53
+ `omnigraph-server` 0.14.x and refuses any other contract. The patch number is the SDK's own,
54
+ for fixes that change nothing on the wire, so `omnigraph` 0.14.1 does not mean server 0.14.1.
55
+ Upgrade the server and this package together when the minor changes, and pin
56
+ `omnigraph>=0.14,<0.15` to follow SDK fixes for one contract.
57
+
58
+ ## Write and verify
59
+
60
+ ```python
61
+ changed = await og.mutate(
62
+ "query rename($old: String, $name: String) { update Person set { name: $name } where name = $old }",
63
+ params={"old": "Alice", "name": "Alicia"},
64
+ if_graph_commit=result["graph_commit_id"],
65
+ )
66
+ ```
67
+
68
+ A successful mutation returns its commit receipt; `commit: None` is a successful no-op. With
69
+ `if_graph_commit` the conditional route refuses a moved head with `PreconditionFailedError`.
70
+
71
+ Branches, merges, and unpublished commits:
72
+
73
+ ```python
74
+ await og.branches.create("review")
75
+ await og.mutate(insert_query, params=..., branch="review")
76
+ merged = await og.branches.merge("review", delete_branch=True)
77
+ ```
78
+
79
+ Merge and mutation receipts are validated; a receipt that does not name the requested
80
+ operation raises `ApiContractError`.
81
+
82
+ ## Streams, loads, feeds, and blobs
83
+
84
+ ```python
85
+ # NDJSON, not buffered
86
+ async for row in og.export(type_names=["Person"]):
87
+ ...
88
+ # One commit, up to 32 MiB
89
+ await og.load_ndjson(ndjson_text, branch="main", mode="merge")
90
+ # One bounded feed page
91
+ page = await og.changes.poll(start="beginning", limit=100)
92
+ # A snapshot, then {"baseline": ...}
93
+ async for record in og.changes.baseline():
94
+ ...
95
+ await og.blobs.put(b"...", entity="node", type="Doc", id="d1", property="body")
96
+ await og.queries.invoke("people", params={"name": "Ada"})
97
+ ```
98
+
99
+ Ordinary JSON requests are limited to 1 MiB by the server; bulk loads go through
100
+ `load_ndjson`.
101
+
102
+ ## Errors
103
+
104
+ Every error is an `OmnigraphError` subclass chosen by status and `code` (`ConflictError`,
105
+ `PreconditionFailedError`, `PayloadTooLargeError`, `GraphUnavailableError`, ...). Each carries:
106
+
107
+ - `disposition`: the server's `effects` (`none`, `partial`, `unknown`) and next `action`;
108
+ - `request_dispatched`: whether the request may have reached the server;
109
+ - `outcome_unknown`: a write may have taken effect — reconcile before retrying.
110
+
111
+ The token never appears in a `repr` or an error message.
112
+
113
+ ## Cluster deployments
114
+
115
+ `og.cluster.plan/apply/status/get_deployment` submit and observe captured deployment bundles.
116
+ Bundles are opaque here, as in the TypeScript SDK; for operator work use
117
+ `omnigraph cluster plan/apply --target NAME --config DIR`.
118
+
119
+ ## Development
120
+
121
+ ```sh
122
+ uv sync
123
+ uv run pytest # unit tests (mocked transport)
124
+ OMNIGRAPH_TEST_SERVER=1 OMNIGRAPH_BIN_DIR=/path/to/v0.14.0 uv run pytest tests/test_e2e.py
125
+ uv run python scripts/generate.py --check # generated files match spec/openapi.json
126
+ uv run mypy && uv run ruff check . && uv run ruff format --check .
127
+ ```
128
+
129
+ `spec/openapi.json` is the pinned server release's document (`scripts/sync_spec.py` fetches it
130
+ for the version in `[tool.omnigraph]`); `scripts/generate.py` regenerates `_models.py` and
131
+ `_version.py` from it.
@@ -0,0 +1,115 @@
1
+ # omnigraph
2
+
3
+ Async Python client for the [Omnigraph](https://github.com/ModernRelay/omnigraph) HTTP API,
4
+ contract **0.14**. It mirrors the TypeScript SDK
5
+ [`@modernrelay/omnigraph`](https://github.com/ModernRelay/omnigraph-ts): the same routes, the
6
+ same contract checks, and the same error model, with Python names.
7
+
8
+ ```sh
9
+ pip install omnigraph
10
+ ```
11
+
12
+ ## Connect and query
13
+
14
+ ```python
15
+ from omnigraph import Omnigraph
16
+
17
+ async with Omnigraph("http://127.0.0.1:8080", graph_id="knowledge", token=TOKEN) as og:
18
+ result = await og.query(
19
+ "query find($name: String) { match { $p: Person { name: $name } } return { $p.name, $p.age } }",
20
+ params={"name": "Alice"},
21
+ )
22
+ print(result["rows"], result["graph_commit_id"])
23
+ ```
24
+
25
+ `base_url` is the server root, including any proxy prefix. Select a graph with `graph_id` or
26
+ `og.graph("beta")`, which shares the connection pool. Results are the server's JSON as
27
+ `TypedDict`s generated from the server's OpenAPI document; field names are the wire names.
28
+ Rows omit null-valued fields.
29
+
30
+ Every request carries `Omnigraph-Http-Api: 0.14`, every response is checked for it, and a
31
+ `HEAD /healthz` discovery precedes each data request. The client follows no redirects and
32
+ never retries.
33
+
34
+ ## Versions
35
+
36
+ The package's major.minor is the HTTP contract it speaks: `omnigraph` 0.14.x talks to
37
+ `omnigraph-server` 0.14.x and refuses any other contract. The patch number is the SDK's own,
38
+ for fixes that change nothing on the wire, so `omnigraph` 0.14.1 does not mean server 0.14.1.
39
+ Upgrade the server and this package together when the minor changes, and pin
40
+ `omnigraph>=0.14,<0.15` to follow SDK fixes for one contract.
41
+
42
+ ## Write and verify
43
+
44
+ ```python
45
+ changed = await og.mutate(
46
+ "query rename($old: String, $name: String) { update Person set { name: $name } where name = $old }",
47
+ params={"old": "Alice", "name": "Alicia"},
48
+ if_graph_commit=result["graph_commit_id"],
49
+ )
50
+ ```
51
+
52
+ A successful mutation returns its commit receipt; `commit: None` is a successful no-op. With
53
+ `if_graph_commit` the conditional route refuses a moved head with `PreconditionFailedError`.
54
+
55
+ Branches, merges, and unpublished commits:
56
+
57
+ ```python
58
+ await og.branches.create("review")
59
+ await og.mutate(insert_query, params=..., branch="review")
60
+ merged = await og.branches.merge("review", delete_branch=True)
61
+ ```
62
+
63
+ Merge and mutation receipts are validated; a receipt that does not name the requested
64
+ operation raises `ApiContractError`.
65
+
66
+ ## Streams, loads, feeds, and blobs
67
+
68
+ ```python
69
+ # NDJSON, not buffered
70
+ async for row in og.export(type_names=["Person"]):
71
+ ...
72
+ # One commit, up to 32 MiB
73
+ await og.load_ndjson(ndjson_text, branch="main", mode="merge")
74
+ # One bounded feed page
75
+ page = await og.changes.poll(start="beginning", limit=100)
76
+ # A snapshot, then {"baseline": ...}
77
+ async for record in og.changes.baseline():
78
+ ...
79
+ await og.blobs.put(b"...", entity="node", type="Doc", id="d1", property="body")
80
+ await og.queries.invoke("people", params={"name": "Ada"})
81
+ ```
82
+
83
+ Ordinary JSON requests are limited to 1 MiB by the server; bulk loads go through
84
+ `load_ndjson`.
85
+
86
+ ## Errors
87
+
88
+ Every error is an `OmnigraphError` subclass chosen by status and `code` (`ConflictError`,
89
+ `PreconditionFailedError`, `PayloadTooLargeError`, `GraphUnavailableError`, ...). Each carries:
90
+
91
+ - `disposition`: the server's `effects` (`none`, `partial`, `unknown`) and next `action`;
92
+ - `request_dispatched`: whether the request may have reached the server;
93
+ - `outcome_unknown`: a write may have taken effect — reconcile before retrying.
94
+
95
+ The token never appears in a `repr` or an error message.
96
+
97
+ ## Cluster deployments
98
+
99
+ `og.cluster.plan/apply/status/get_deployment` submit and observe captured deployment bundles.
100
+ Bundles are opaque here, as in the TypeScript SDK; for operator work use
101
+ `omnigraph cluster plan/apply --target NAME --config DIR`.
102
+
103
+ ## Development
104
+
105
+ ```sh
106
+ uv sync
107
+ uv run pytest # unit tests (mocked transport)
108
+ OMNIGRAPH_TEST_SERVER=1 OMNIGRAPH_BIN_DIR=/path/to/v0.14.0 uv run pytest tests/test_e2e.py
109
+ uv run python scripts/generate.py --check # generated files match spec/openapi.json
110
+ uv run mypy && uv run ruff check . && uv run ruff format --check .
111
+ ```
112
+
113
+ `spec/openapi.json` is the pinned server release's document (`scripts/sync_spec.py` fetches it
114
+ for the version in `[tool.omnigraph]`); `scripts/generate.py` regenerates `_models.py` and
115
+ `_version.py` from it.
@@ -0,0 +1,54 @@
1
+ [project]
2
+ name = "omnigraph"
3
+ version = "0.14.0"
4
+ description = "Python client for the Omnigraph HTTP API"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.11"
9
+ dependencies = ["httpx>=0.27,<1"]
10
+ classifiers = [
11
+ "Development Status :: 4 - Beta",
12
+ "Framework :: AsyncIO",
13
+ "Programming Language :: Python :: 3",
14
+ "Typing :: Typed",
15
+ ]
16
+
17
+ [project.urls]
18
+ Homepage = "https://github.com/ModernRelay/omnigraph-python"
19
+ Issues = "https://github.com/ModernRelay/omnigraph/issues"
20
+
21
+ [tool.omnigraph]
22
+ # The server release this SDK is generated from and tested against. The SDK
23
+ # minor tracks the server minor; `spec/openapi.json` is that release's file.
24
+ server-version = "0.14.0"
25
+
26
+ [dependency-groups]
27
+ dev = [
28
+ "pytest>=8",
29
+ "pytest-asyncio>=0.24",
30
+ "mypy>=1.11",
31
+ "ruff>=0.6",
32
+ "datamodel-code-generator==0.34.0",
33
+ ]
34
+
35
+ [build-system]
36
+ requires = ["hatchling>=1.26"]
37
+ build-backend = "hatchling.build"
38
+
39
+ [tool.hatch.build.targets.wheel]
40
+ packages = ["src/omnigraph"]
41
+
42
+ [tool.pytest.ini_options]
43
+ asyncio_mode = "auto"
44
+ asyncio_default_fixture_loop_scope = "function"
45
+ testpaths = ["tests"]
46
+
47
+ [tool.mypy]
48
+ python_version = "3.11"
49
+ strict = true
50
+ files = ["src", "tests", "scripts"]
51
+
52
+ [tool.ruff]
53
+ line-length = 88
54
+ extend-exclude = ["src/omnigraph/_models.py"]
@@ -0,0 +1,111 @@
1
+ """Regenerate `src/omnigraph/_models.py` and `_version.py` from the pinned spec.
2
+
3
+ uv run python scripts/generate.py # write
4
+ uv run python scripts/generate.py --check # fail when the files are stale
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import json
10
+ import re
11
+ import subprocess
12
+ import sys
13
+ import tempfile
14
+ import tomllib
15
+ from pathlib import Path
16
+ from typing import Any
17
+
18
+ ROOT = Path(__file__).resolve().parents[1]
19
+ SPEC = ROOT / "spec" / "openapi.json"
20
+ MODELS = ROOT / "src" / "omnigraph" / "_models.py"
21
+ VERSION = ROOT / "src" / "omnigraph" / "_version.py"
22
+
23
+ HEADER = '''\
24
+ """Wire models generated from spec/openapi.json. Do not edit by hand.
25
+
26
+ Regenerate with `uv run python scripts/generate.py`.
27
+ """
28
+
29
+ '''
30
+
31
+
32
+ def _pyproject() -> dict[str, Any]:
33
+ return tomllib.loads((ROOT / "pyproject.toml").read_text())
34
+
35
+
36
+ def server_version() -> str:
37
+ return str(_pyproject()["tool"]["omnigraph"]["server-version"])
38
+
39
+
40
+ def check_package_version(contract: str) -> None:
41
+ """The package's major.minor is the HTTP contract it speaks; its patch
42
+ number is the SDK's own, for fixes that change nothing on the wire."""
43
+ version = str(_pyproject()["project"]["version"])
44
+ m = re.match(r"(\d+)\.(\d+)", version)
45
+ if m is None or f"{m.group(1)}.{m.group(2)}" != contract:
46
+ sys.exit(f"package version {version} must start with contract {contract}")
47
+
48
+
49
+ def render_models() -> str:
50
+ with tempfile.TemporaryDirectory() as tmp:
51
+ out = Path(tmp) / "models.py"
52
+ subprocess.run(
53
+ [
54
+ "datamodel-codegen",
55
+ "--input",
56
+ str(SPEC),
57
+ "--input-file-type",
58
+ "openapi",
59
+ "--output-model-type",
60
+ "typing.TypedDict",
61
+ "--target-python-version",
62
+ "3.11",
63
+ "--use-standard-collections",
64
+ "--use-union-operator",
65
+ "--enum-field-as-literal",
66
+ "all",
67
+ "--use-schema-description",
68
+ "--disable-timestamp",
69
+ "--output",
70
+ str(out),
71
+ ],
72
+ check=True,
73
+ )
74
+ body = out.read_text()
75
+ # Drop the generator's own banner; ours names the source and the command.
76
+ lines = body.splitlines(keepends=True)
77
+ while lines and (lines[0].startswith("#") or not lines[0].strip()):
78
+ lines.pop(0)
79
+ return HEADER + "".join(lines)
80
+
81
+
82
+ def render_version() -> str:
83
+ spec_version = json.loads(SPEC.read_text())["info"]["version"]
84
+ pinned = server_version()
85
+ if spec_version != pinned:
86
+ sys.exit(f"spec/openapi.json is {spec_version}, pyproject pins {pinned}")
87
+ major, minor, _ = pinned.split(".")
88
+ check_package_version(f"{major}.{minor}")
89
+ return (
90
+ '"""Generated by scripts/generate.py. Do not edit by hand."""\n\n'
91
+ f'SERVER_VERSION = "{pinned}"\n'
92
+ f'HTTP_API_CONTRACT = "{major}.{minor}"\n'
93
+ 'HTTP_API_CONTRACT_HEADER = "Omnigraph-Http-Api"\n'
94
+ )
95
+
96
+
97
+ def main() -> None:
98
+ check = "--check" in sys.argv[1:]
99
+ stale = []
100
+ for path, text in ((MODELS, render_models()), (VERSION, render_version())):
101
+ if check:
102
+ if not path.exists() or path.read_text() != text:
103
+ stale.append(path.relative_to(ROOT))
104
+ else:
105
+ path.write_text(text)
106
+ if stale:
107
+ sys.exit(f"stale generated files: {', '.join(map(str, stale))}")
108
+
109
+
110
+ if __name__ == "__main__":
111
+ main()
@@ -0,0 +1,23 @@
1
+ """Replace spec/openapi.json with the one from the pinned server release.
2
+
3
+ uv run python scripts/sync_spec.py
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import sys
9
+ import urllib.request
10
+
11
+ from generate import SPEC, server_version
12
+
13
+
14
+ def main() -> None:
15
+ tag = f"v{server_version()}"
16
+ url = f"https://raw.githubusercontent.com/ModernRelay/omnigraph/{tag}/openapi.json"
17
+ with urllib.request.urlopen(url, timeout=60) as resp:
18
+ SPEC.write_bytes(resp.read())
19
+ print(f"spec/openapi.json <- {url}", file=sys.stderr)
20
+
21
+
22
+ if __name__ == "__main__":
23
+ main()