bgo-cli 0.2.0__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.
bgo_cli/__init__.py ADDED
@@ -0,0 +1,50 @@
1
+ """bgo — lightweight background process manager.
2
+
3
+ The actual implementation lives in the single-file `bgo` script at
4
+ the repo root, which doubles as the canonical source-of-truth for
5
+ the executable. At build time, hatchling pulls it into this package
6
+ as `bgo_cli._core` via the `force-include` configuration in
7
+ pyproject.toml.
8
+
9
+ For development (editable installs and bare `python -m bgo_cli`
10
+ inside the repo), we load it dynamically so the dev tree doesn't
11
+ need to mirror the script.
12
+ """
13
+
14
+ from pathlib import Path
15
+ import importlib.util
16
+ import sys
17
+
18
+ __version__ = "0.2.0"
19
+
20
+
21
+ def _load_core():
22
+ """Resolve and load the underlying bgo script as a module."""
23
+ # 1. Built / installed: src/bgo_cli/_core.py exists alongside this file.
24
+ here = Path(__file__).resolve().parent
25
+ packaged = here / "_core.py"
26
+ if packaged.exists():
27
+ spec = importlib.util.spec_from_file_location("bgo_cli._core", packaged)
28
+ else:
29
+ # 2. Editable / source checkout: walk up to the repo root, find ./bgo.
30
+ repo_root = here.parent.parent
31
+ candidate = repo_root / "bgo"
32
+ if not candidate.exists():
33
+ raise ImportError(
34
+ "Cannot locate bgo core module — neither "
35
+ f"{packaged} nor {candidate} exists."
36
+ )
37
+ spec = importlib.util.spec_from_loader(
38
+ "bgo_cli._core",
39
+ importlib.machinery.SourceFileLoader("bgo_cli._core", str(candidate)),
40
+ )
41
+ mod = importlib.util.module_from_spec(spec)
42
+ sys.modules["bgo_cli._core"] = mod
43
+ spec.loader.exec_module(mod)
44
+ return mod
45
+
46
+
47
+ _core = _load_core()
48
+ main = _core.main
49
+
50
+ __all__ = ["main", "__version__"]
bgo_cli/__main__.py ADDED
@@ -0,0 +1,8 @@
1
+ """Allow `python -m bgo_cli` invocation."""
2
+
3
+ import sys
4
+
5
+ from bgo_cli import main
6
+
7
+ if __name__ == "__main__":
8
+ sys.exit(main())