rensoai-code-graph 1.0.19__py3-none-any.whl

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,5 @@
1
+ """rensoai-code-graph — packaging shim for the prebuilt code_graph binaries."""
2
+
3
+ from .__version__ import __version__
4
+
5
+ __all__ = ["__version__"]
@@ -0,0 +1,3 @@
1
+ """Wheel version. Templated by build_wheels.py."""
2
+
3
+ __version__ = "1.0.19"
@@ -0,0 +1,146 @@
1
+ """Fetch the prebuilt binary on first run, then exec it.
2
+
3
+ The wheel ships no binary (so it stays a tiny pure-Python package that fits
4
+ under PyPI's per-file size limit). On the first invocation of ``code_graph``
5
+ or ``code_graph-mcp`` this downloads the matching prebuilt archive from the
6
+ public release, verifies its SHA256 against the templated manifest, caches the
7
+ extracted binary, and execs it. Subsequent runs use the cached binary.
8
+
9
+ Stdlib only — no third-party dependencies.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import hashlib
15
+ import os
16
+ import platform
17
+ import shutil
18
+ import sys
19
+ import tarfile
20
+ import tempfile
21
+ import urllib.request
22
+ import zipfile
23
+ from pathlib import Path
24
+
25
+ from . import _manifest
26
+
27
+ _DOWNLOAD_CHUNK = 1 << 20 # 1 MiB
28
+
29
+
30
+ def _target() -> str:
31
+ """Map the host OS/arch to the Rust target triple of its release archive."""
32
+ machine = platform.machine().lower()
33
+ arm = machine in ("arm64", "aarch64")
34
+ intel = machine in ("x86_64", "amd64", "x64")
35
+ if sys.platform.startswith("linux"):
36
+ if intel:
37
+ return "x86_64-unknown-linux-gnu"
38
+ if arm:
39
+ return "aarch64-unknown-linux-gnu"
40
+ elif sys.platform == "darwin":
41
+ if intel:
42
+ return "x86_64-apple-darwin"
43
+ if arm:
44
+ return "aarch64-apple-darwin"
45
+ elif sys.platform == "win32":
46
+ if intel:
47
+ return "x86_64-pc-windows-msvc"
48
+ raise RuntimeError(
49
+ f"rensoai-code-graph has no prebuilt binary for {sys.platform}/{machine}. "
50
+ "Supported: linux/macOS/Windows on x86_64 and arm64."
51
+ )
52
+
53
+
54
+ def _cache_dir() -> Path:
55
+ """Per-version cache root for the extracted binaries."""
56
+ override = os.environ.get("CODE_GRAPH_CACHE_DIR")
57
+ if override:
58
+ root = Path(override)
59
+ elif sys.platform == "win32":
60
+ root = Path(os.environ.get("LOCALAPPDATA") or (Path.home() / "AppData" / "Local"))
61
+ elif sys.platform == "darwin":
62
+ root = Path.home() / "Library" / "Caches"
63
+ else:
64
+ root = Path(os.environ.get("XDG_CACHE_HOME") or (Path.home() / ".cache"))
65
+ return root / "rensoai-code-graph" / _manifest.VERSION
66
+
67
+
68
+ def _sha256(path: Path) -> str:
69
+ h = hashlib.sha256()
70
+ with path.open("rb") as fh:
71
+ for chunk in iter(lambda: fh.read(_DOWNLOAD_CHUNK), b""):
72
+ h.update(chunk)
73
+ return h.hexdigest()
74
+
75
+
76
+ def _download(url: str, dest: Path) -> None:
77
+ req = urllib.request.Request(url, headers={"User-Agent": "rensoai-code-graph"})
78
+ with urllib.request.urlopen(req) as resp, dest.open("wb") as out: # noqa: S310 (trusted host)
79
+ shutil.copyfileobj(resp, out, _DOWNLOAD_CHUNK)
80
+
81
+
82
+ def _ensure_binary(name: str) -> Path:
83
+ is_windows = sys.platform == "win32"
84
+ suffix = ".exe" if is_windows else ""
85
+ dest = _cache_dir() / f"{name}{suffix}"
86
+ if dest.exists():
87
+ return dest
88
+
89
+ target = _target()
90
+ expected = (_manifest.SHA256_BY_TARGET.get(target) or {}).get(name)
91
+ if not expected:
92
+ raise RuntimeError(
93
+ f"rensoai-code-graph manifest has no {name} entry for {target}; "
94
+ "the wheel may be a placeholder build."
95
+ )
96
+
97
+ ext = "zip" if is_windows else "tar.gz"
98
+ url = f"{_manifest.BASE_URL}/v{_manifest.VERSION}/{name}-{target}.{ext}"
99
+
100
+ dest.parent.mkdir(parents=True, exist_ok=True)
101
+ with tempfile.TemporaryDirectory() as tmp:
102
+ tmp_path = Path(tmp)
103
+ archive = tmp_path / f"{name}.{ext}"
104
+ sys.stderr.write(f"rensoai-code-graph: fetching {name} ({target}) on first run...\n")
105
+ _download(url, archive)
106
+
107
+ got = _sha256(archive)
108
+ if got != expected:
109
+ raise RuntimeError(
110
+ f"sha256 mismatch for {url}\n expected {expected}\n got {got}"
111
+ )
112
+
113
+ if is_windows:
114
+ with zipfile.ZipFile(archive) as zf:
115
+ zf.extractall(tmp_path)
116
+ else:
117
+ with tarfile.open(archive, "r:gz") as tf:
118
+ tf.extractall(tmp_path)
119
+ # Archives contain a single top dir "<name>-<target>/<binary>".
120
+ extracted = tmp_path / f"{name}-{target}" / f"{name}{suffix}"
121
+ if not extracted.exists():
122
+ raise RuntimeError(f"archive {url} did not contain {extracted.name}")
123
+
124
+ # Atomic publish into the cache (temp + rename) so concurrent first
125
+ # runs never observe a half-written binary.
126
+ staged = dest.with_name(dest.name + ".tmp")
127
+ shutil.copy(extracted, staged)
128
+ if not is_windows:
129
+ staged.chmod(0o755)
130
+ os.replace(staged, dest)
131
+ return dest
132
+
133
+
134
+ def exec_binary(name: str) -> "int | None":
135
+ """Ensure ``name`` is cached, then run it forwarding argv + env.
136
+
137
+ On Unix ``os.execv`` replaces this process. On Windows ``os.spawnv``
138
+ waits and ``sys.exit``s with the child's exit code.
139
+ """
140
+ path = _ensure_binary(name)
141
+ args = [str(path), *sys.argv[1:]]
142
+ if sys.platform == "win32":
143
+ rc = os.spawnv(os.P_WAIT, str(path), args)
144
+ sys.exit(int(rc))
145
+ os.execv(str(path), args)
146
+ return None # unreachable
@@ -0,0 +1,28 @@
1
+ """Release manifest (version + per-target archive SHA256). Templated by build_wheels.py."""
2
+
3
+ VERSION = "1.0.19"
4
+
5
+ BASE_URL = "https://github.com/Renso-AI/code-graph-dist/releases/download"
6
+
7
+ SHA256_BY_TARGET = {
8
+ "aarch64-apple-darwin": {
9
+ "code_graph": "93c4eefb933bbb8f851f3cfe7d8b1ebd3ad6f05c0e1e42f65b4f6173f2c9cd63",
10
+ "code_graph-mcp": "02dbcaefe674011147e3ef9f28b3e0485722a3fa39e237da78e6377ffb8df73f"
11
+ },
12
+ "aarch64-unknown-linux-gnu": {
13
+ "code_graph": "da5de8974b8bc01cb7007e3015a11cdf1a3a452e4877cfd572100dc141baf9d6",
14
+ "code_graph-mcp": "680d30bbfe834a317feb7de1efaf5b1cb4dbf77a22b90ef41296b3ad15842e3c"
15
+ },
16
+ "x86_64-apple-darwin": {
17
+ "code_graph": "4520ff4da46501c58048dea4d0feae67785bd2721b33dae5fd7f9c46f529d87e",
18
+ "code_graph-mcp": "3042bde451547269595ceb9bfcd72931cab793c3f09279919bd5946e176c3e28"
19
+ },
20
+ "x86_64-pc-windows-msvc": {
21
+ "code_graph": "818e152bb4eb000fdaf42cfa44767dbacabc908fefd699663659354ea1068d06",
22
+ "code_graph-mcp": "842ad09e68525255794778b036aa81fcbf86f5b20c76937ecfe14c608d869ffc"
23
+ },
24
+ "x86_64-unknown-linux-gnu": {
25
+ "code_graph": "54c153c5659fa7dc468b2ed7cf41bf1942c98e9335253978821beca538775fbd",
26
+ "code_graph-mcp": "a8a6e7854d61e058d0edf60b7f790384107d0db5aabdef14216a3091d64ad485"
27
+ }
28
+ }
@@ -0,0 +1,7 @@
1
+ """Console-script entry point for the `code_graph` CLI."""
2
+
3
+ from ._launcher import exec_binary
4
+
5
+
6
+ def main() -> None:
7
+ exec_binary("code_graph")
@@ -0,0 +1,7 @@
1
+ """Console-script entry point for the `code_graph-mcp` server."""
2
+
3
+ from ._launcher import exec_binary
4
+
5
+
6
+ def main() -> None:
7
+ exec_binary("code_graph-mcp")
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: rensoai-code-graph
3
+ Version: 1.0.19
4
+ Summary: Dependency graph analyzer for code, tests, docs, and policy surfaces. A tiny launcher that downloads + SHA256-verifies the prebuilt code_graph + code_graph-mcp binaries on first run.
5
+ Project-URL: Homepage, https://cg.renso.ai
6
+ Project-URL: Documentation, https://cg.renso.ai/docs
7
+ Project-URL: Source, https://github.com/Renso-AI/code-graph-dist
8
+ Project-URL: Issues, https://github.com/Renso-AI/code-graph-dist/issues
9
+ Author: Renso AI
10
+ License: Proprietary - (c) Renso AI. All rights reserved. NOT open source.
11
+ Keywords: blast-radius,code-graph,llm,mcp,static-analysis
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: Other/Proprietary License
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Topic :: Software Development
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+
23
+ # rensoai-code-graph (PyPI distribution wrapper)
24
+
25
+ This package is still published for distribution compatibility, but
26
+ customer-facing install docs live at https://cg.renso.ai/docs#install
27
+ and document only the curl/script installer. The PyPI artifacts are
28
+ per-platform wheels with the prebuilt `code_graph` and `code_graph-mcp`
29
+ binaries bundled.
30
+
31
+ ## Files in this directory
32
+
33
+ - `pyproject.toml` — Hatch backend, `[project.scripts]` entries,
34
+ pinned cibuildwheel matrix
35
+ - `src/rensoai_code_graph/` — Python package: launcher + console-script
36
+ entry points
37
+ - `scripts/build_wheels.py` — release-time wheel builder
38
+ - `README.md` — what users see on PyPI
39
+
40
+ ## Per-platform wheel matrix
41
+
42
+ | Wheel tag | Binary target |
43
+ |-------------------------------------------------|----------------------------|
44
+ | `py3-none-manylinux_2_28_x86_64.whl` | x86_64-unknown-linux-gnu |
45
+ | `py3-none-manylinux_2_28_aarch64.whl` | aarch64-unknown-linux-gnu |
46
+ | `py3-none-macosx_10_12_x86_64.whl` | x86_64-apple-darwin |
47
+ | `py3-none-macosx_11_0_arm64.whl` | aarch64-apple-darwin |
48
+ | `py3-none-win_amd64.whl` | x86_64-pc-windows-msvc |
49
+
50
+ Each wheel is `py3-none-<platform>` so end users only ever pull one
51
+ wheel per machine, regardless of Python version.
52
+
53
+ ## No sdist
54
+
55
+ `pyproject.toml` excludes everything from the sdist target. Only
56
+ wheels go to PyPI — there is no source distribution that could
57
+ trick a user (or a downstream build system) into compiling from
58
+ source.
59
+
60
+ ## How a release ships wheels
61
+
62
+ `.github/workflows/release.yml` job `publish-pip`:
63
+
64
+ 1. Downloads the prebuilt-binary tarballs from `dist/`.
65
+ 2. Runs `scripts/build_wheels.py` which, per platform:
66
+ - Templates `src/rensoai_code_graph/__version__.py` with the
67
+ release version.
68
+ - Copies the matching binary into
69
+ `src/rensoai_code_graph/_binaries/`.
70
+ - Runs `python -m build --wheel` (Hatch backend) targeting the
71
+ correct platform tag.
72
+ 3. `twine upload` ships all wheels to PyPI.
@@ -0,0 +1,10 @@
1
+ rensoai_code_graph/__init__.py,sha256=Jec2a96uIZpYwwOCYX10naTm8QZajlnvhLsI2Q4flPE,147
2
+ rensoai_code_graph/__version__.py,sha256=OCjtoXZDKr_sdhVw0OhQ3GBaYhdVZPanrvQnjD3y3WQ,75
3
+ rensoai_code_graph/_launcher.py,sha256=m_r6K0sljgP6Qe1RonPwS5kH6XtNe4GH-dO3k6dwUYc,5029
4
+ rensoai_code_graph/_manifest.py,sha256=r_uiCMskFW6yLoXLx-rBTZiUnxYgBZQDVPIOuntnsyw,1321
5
+ rensoai_code_graph/cli.py,sha256=4lyZ1A09cd2F2M_MJLjhctPMzb2dVIh2hUxF5td_FKw,147
6
+ rensoai_code_graph/mcp.py,sha256=h2bGLAORofefrZPH2npFPr1qZQrdyjKMjW_Y0ymxPN8,158
7
+ rensoai_code_graph-1.0.19.dist-info/METADATA,sha256=IrNO4gRL9SoRqaP-PKQglSuFkuIqDZbQDLHiJLS7kGM,3168
8
+ rensoai_code_graph-1.0.19.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
9
+ rensoai_code_graph-1.0.19.dist-info/entry_points.txt,sha256=751xul2s0PVNhrwbdPn2GvwdZga4BH9xSuKWerAQtUM,104
10
+ rensoai_code_graph-1.0.19.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ code_graph = rensoai_code_graph.cli:main
3
+ code_graph-mcp = rensoai_code_graph.mcp:main