devmap 0.2.3__py3-none-any.whl → 0.2.5__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.
devmap/__init__.py CHANGED
@@ -1,27 +1,53 @@
1
- """devmap — PyPI name-reservation shim.
1
+ """devmap — standalone CLI shipped via PyPI.
2
2
 
3
- The real devmap CLI is a TypeScript/Bun tool. This PyPI package exists only to
4
- reserve the ``devmap`` name and to point Python users at the canonical install:
3
+ This package embeds the compiled devmap app (a self-contained JavaScript bundle,
4
+ ``_devmap.mjs``) and launches it with Node.js (or Bun) when you run ``devmap``.
5
+ So ``pip install devmap && devmap`` works on its own — no separate npm/bun
6
+ install required, as long as a JavaScript runtime is on PATH.
5
7
 
6
- npm install -g devmap
7
- bun install -g devmap
8
-
9
- Run ``devmap`` after installing either of the above. This shim just prints that
10
- guidance so a stray ``pip install devmap`` does not leave the user empty-handed.
8
+ If you already manage devmap via ``npm i -g devmap`` / ``bun i -g devmap``,
9
+ that install takes precedence on PATH and is equally valid.
11
10
  """
12
11
 
13
- __version__ = "0.2.3"
12
+ import os
13
+ import shutil
14
+ import subprocess
15
+ import sys
16
+
17
+ __version__ = "0.2.5"
18
+
19
+ _BUNDLE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "_devmap.mjs")
20
+
21
+
22
+ def _find_runtime() -> "str | None":
23
+ for name in ("node", "node.exe", "bun", "bun.exe"):
24
+ path = shutil.which(name)
25
+ if path:
26
+ return path
27
+ return None
14
28
 
15
29
 
16
30
  def main() -> None:
17
- print("devmap — PyPI name-reservation shim (v" + __version__ + ")")
18
- print()
19
- print("The real devmap CLI is distributed via npm / bun, not PyPI:")
20
- print(" npm install -g devmap")
21
- print(" bun install -g devmap")
22
- print()
23
- print("After installing, run: devmap (the 'scan' word is optional)")
24
- print("Source & docs: https://github.com/StevenLOL/devmap")
31
+ runtime = _find_runtime()
32
+ if runtime is None:
33
+ sys.stderr.write(
34
+ "devmap requires Node.js (or Bun) to run.\n"
35
+ "Install Node.js from https://nodejs.org (or Bun from https://bun.sh)\n"
36
+ "and make sure it is on your PATH, then re-run `devmap`.\n"
37
+ )
38
+ sys.exit(1)
39
+ if not os.path.exists(_BUNDLE):
40
+ sys.stderr.write(
41
+ f"devmap: bundled app not found at {_BUNDLE}.\n"
42
+ "Reinstall with `pip install --force-reinstall --no-cache-dir devmap`.\n"
43
+ )
44
+ sys.exit(1)
45
+ try:
46
+ proc = subprocess.run([runtime, _BUNDLE, *sys.argv[1:]])
47
+ except Exception as exc: # pragma: no cover - defensive
48
+ sys.stderr.write(f"devmap: failed to launch runtime `{runtime}`: {exc}\n")
49
+ sys.exit(1)
50
+ sys.exit(proc.returncode)
25
51
 
26
52
 
27
53
  if __name__ == "__main__":