grimx 0.3.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.
grimx-0.3.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GRIMX LABS
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.
grimx-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: grimx
3
+ Version: 0.3.0
4
+ Summary: GCC Runtime & Installation Manager, Cross-platform — minimal tooling for C and C++ projects
5
+ License: MIT License
6
+
7
+ Copyright (c) 2026 GRIMX LABS
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Requires-Python: >=3.10
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: click>=8.1
31
+ Requires-Dist: tomlkit>=0.12
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=7.0; extra == "dev"
34
+ Dynamic: license-file
35
+
36
+ # GRIMX
37
+
38
+ **GCC Runtime & Installation Manager - Cross Platform**
39
+
40
+ A minimal developer tool for reproducible C and C++ environments.
41
+
42
+ ---
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pip install grimx
48
+ ```
49
+
50
+ That's it. The `grimx` command is now available globally.
51
+
52
+ ---
53
+
54
+ ## Quick Start
55
+
56
+ ```bash
57
+ grimx new hello_world
58
+ cd hello_world
59
+ grimx install fmt
60
+ grimx build
61
+ grimx test
62
+ grimx run
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Commands
68
+
69
+ | Command | Description |
70
+ |---|---|
71
+ | `grimx new <name>` | Scaffold a new project |
72
+ | `grimx new <name> --type c` | Scaffold a C project (default: cpp) |
73
+ | `grimx install <pkg>` | Install a dependency |
74
+ | `grimx install` | Restore all dependencies from lock file |
75
+ | `grimx build` | Build the project via CMake |
76
+ | `grimx test` | Run tests via CTest |
77
+ | `grimx run` | Run the compiled application |
78
+
79
+ ---
80
+
81
+ ## Project Structure
82
+
83
+ ```
84
+ my_project/
85
+ src/ source files
86
+ include/ project headers
87
+ tests/ unit tests
88
+ cmake/ optional cmake modules
89
+ CMakeLists.txt
90
+ grimx.config
91
+ grimx.lock
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Project Types
97
+
98
+ ```bash
99
+ grimx new my_app --type c # C application
100
+ grimx new my_app --type cpp # C++ application (default)
101
+ grimx new my_fw --type embedded-c # Embedded C
102
+ grimx new my_fw --type embedded-cpp # Embedded C++
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Contributing
108
+
109
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
110
+
111
+ ---
112
+
113
+ ## License
114
+
115
+ MIT — see [LICENSE](LICENSE).
grimx-0.3.0/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # GRIMX
2
+
3
+ **GCC Runtime & Installation Manager - Cross Platform**
4
+
5
+ A minimal developer tool for reproducible C and C++ environments.
6
+
7
+ ---
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install grimx
13
+ ```
14
+
15
+ That's it. The `grimx` command is now available globally.
16
+
17
+ ---
18
+
19
+ ## Quick Start
20
+
21
+ ```bash
22
+ grimx new hello_world
23
+ cd hello_world
24
+ grimx install fmt
25
+ grimx build
26
+ grimx test
27
+ grimx run
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Commands
33
+
34
+ | Command | Description |
35
+ |---|---|
36
+ | `grimx new <name>` | Scaffold a new project |
37
+ | `grimx new <name> --type c` | Scaffold a C project (default: cpp) |
38
+ | `grimx install <pkg>` | Install a dependency |
39
+ | `grimx install` | Restore all dependencies from lock file |
40
+ | `grimx build` | Build the project via CMake |
41
+ | `grimx test` | Run tests via CTest |
42
+ | `grimx run` | Run the compiled application |
43
+
44
+ ---
45
+
46
+ ## Project Structure
47
+
48
+ ```
49
+ my_project/
50
+ src/ source files
51
+ include/ project headers
52
+ tests/ unit tests
53
+ cmake/ optional cmake modules
54
+ CMakeLists.txt
55
+ grimx.config
56
+ grimx.lock
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Project Types
62
+
63
+ ```bash
64
+ grimx new my_app --type c # C application
65
+ grimx new my_app --type cpp # C++ application (default)
66
+ grimx new my_fw --type embedded-c # Embedded C
67
+ grimx new my_fw --type embedded-cpp # Embedded C++
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Contributing
73
+
74
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
75
+
76
+ ---
77
+
78
+ ## License
79
+
80
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,142 @@
1
+ """
2
+ grimx.build
3
+ Orchestrate CMake configure, build, test, and run.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import subprocess
9
+ import shutil
10
+ from pathlib import Path
11
+
12
+ import click
13
+
14
+ BUILD_DIR = "build"
15
+
16
+
17
+ def run() -> None:
18
+ """Configure and build the project."""
19
+ _require_tool("cmake")
20
+ _guard_project_root()
21
+ _cmake_configure()
22
+ _cmake_build()
23
+
24
+
25
+ def run_tests() -> None:
26
+ """Run tests via CTest."""
27
+ _require_tool("ctest")
28
+ _guard_project_root()
29
+
30
+ build_path = _build_path()
31
+ if not build_path.exists():
32
+ click.echo("No build directory found — running build first...")
33
+ run()
34
+
35
+ click.echo("Running tests...")
36
+ result = subprocess.run(
37
+ ["ctest", "--output-on-failure", "--test-dir", str(build_path)],
38
+ )
39
+ if result.returncode != 0:
40
+ raise SystemExit(result.returncode)
41
+ click.echo("✓ all tests passed")
42
+
43
+
44
+ def run_app() -> None:
45
+ """Run the compiled application binary."""
46
+ _guard_project_root()
47
+
48
+ build_path = _build_path()
49
+ if not build_path.exists():
50
+ click.echo("error: no build directory found. Run 'grimx build' first.", err=True)
51
+ raise SystemExit(1)
52
+
53
+ project_name = Path.cwd().name
54
+ binary = build_path / project_name
55
+
56
+ # Fallback: look for any executable in build root
57
+ if not binary.exists():
58
+ candidates = [
59
+ p for p in build_path.iterdir()
60
+ if p.is_file() and _is_executable(p)
61
+ ]
62
+ if not candidates:
63
+ click.echo("error: no binary found in build/. Run 'grimx build' first.", err=True)
64
+ raise SystemExit(1)
65
+ binary = candidates[0]
66
+
67
+ click.echo(f"Running {binary.name}...")
68
+ result = subprocess.run([str(binary)])
69
+ raise SystemExit(result.returncode)
70
+
71
+
72
+ # ---------------------------------------------------------------------------
73
+ # Internal
74
+ # ---------------------------------------------------------------------------
75
+
76
+ def _cmake_configure() -> None:
77
+ project_root = Path.cwd()
78
+ build_path = _build_path()
79
+ build_path.mkdir(exist_ok=True)
80
+
81
+ click.echo("Configuring with CMake...")
82
+ result = subprocess.run(
83
+ [
84
+ "cmake",
85
+ str(project_root), # explicit source dir — never ".."
86
+ f"-B{build_path}", # explicit build dir
87
+ "-DCMAKE_BUILD_TYPE=Debug",
88
+ ],
89
+ cwd=project_root,
90
+ )
91
+ if result.returncode != 0:
92
+ raise SystemExit(result.returncode)
93
+
94
+
95
+ def _cmake_build() -> None:
96
+ build_path = _build_path()
97
+ click.echo("Building...")
98
+ result = subprocess.run(
99
+ ["cmake", "--build", str(build_path), "--parallel"],
100
+ )
101
+ if result.returncode != 0:
102
+ raise SystemExit(result.returncode)
103
+ click.echo("✓ build succeeded")
104
+
105
+
106
+ def _build_path() -> Path:
107
+ return Path.cwd() / BUILD_DIR
108
+
109
+
110
+ def _guard_project_root() -> None:
111
+ """Abort with a clear message if not run from a GRIMX project directory."""
112
+ cwd = Path.cwd()
113
+ has_cmake = (cwd / "CMakeLists.txt").exists()
114
+ has_config = (cwd / "grimx.config").exists()
115
+
116
+ if not has_cmake and not has_config:
117
+ click.echo(
118
+ "error: no CMakeLists.txt or grimx.config found in current directory.\n"
119
+ " Run this command from inside a GRIMX project.",
120
+ err=True,
121
+ )
122
+ raise SystemExit(1)
123
+
124
+ if not has_cmake:
125
+ click.echo(
126
+ "error: CMakeLists.txt not found.\n"
127
+ " Make sure your project was scaffolded correctly.",
128
+ err=True,
129
+ )
130
+ raise SystemExit(1)
131
+
132
+
133
+ def _require_tool(name: str) -> None:
134
+ if not shutil.which(name):
135
+ click.echo(f"error: '{name}' not found in PATH.", err=True)
136
+ click.echo(f" Install it and re-run, or check 'grimx doctor' (coming in v2).")
137
+ raise SystemExit(1)
138
+
139
+
140
+ def _is_executable(path: Path) -> bool:
141
+ import os
142
+ return os.access(path, os.X_OK)
@@ -0,0 +1,51 @@
1
+ """
2
+ grimx.cli
3
+ Entry point for the GRIMX command-line interface
4
+ """
5
+
6
+ import click
7
+ from grimx import __version__
8
+ from grimx import scaffold, install as install_mod, build as build_mod
9
+
10
+ @click.group()
11
+ @click.version_option(__version__, prog_name="grimx")
12
+ def main():
13
+ """GRIMX - GNU Runtime & Installation Manager.
14
+
15
+ Minimal tooling for reproducible C and C++ environments.
16
+ """
17
+
18
+ @main.command()
19
+ @click.argument("name", required=False, default=None)
20
+ @click.option(
21
+ "--type",
22
+ "project_type",
23
+ default=None,
24
+ type=click.Choice(["c", "cpp", "embedded-c", "embedded-cpp"], case_sensitive=False),
25
+ help="Project type (skips prompt if provided).",
26
+ )
27
+ def new(name: str | None, project_type: str | None):
28
+ """Scaffold a new project interactivity, or pass NAME to skip the name prompt."""
29
+ scaffold.create_project(name, project_type)
30
+
31
+
32
+ @main.command("install")
33
+ @click.argument("package", required=False, default=None)
34
+ def install_cmd(package):
35
+ """Install a dependency, or restore all from grimx.lock."""
36
+ install_mod.run(package)
37
+
38
+ @main.command("build")
39
+ def build_cmd():
40
+ """Build the project via CMake."""
41
+ build_mod.run()
42
+
43
+ @main.command("test")
44
+ def test_cmd():
45
+ """Run tests via CTest."""
46
+ build_mod.run_tests()
47
+
48
+ @main.command("run")
49
+ def run_cmd():
50
+ """Run the compiled application."""
51
+ build_mod.run_app()
@@ -0,0 +1,84 @@
1
+ """
2
+ grimx.config
3
+ Read and write grimx.config and grimx.lock using TOML.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import os
9
+ from pathlib import Path
10
+ from typing import Any
11
+
12
+ import tomlkit
13
+
14
+ CONFIG_FILE = "grimx.config"
15
+ LOCK_FILE = "grimx.lock"
16
+
17
+ DEFAULT_CONFIG: dict[str, Any] = {
18
+ "package_manager": {
19
+ "priority": ["vcpkg", "conan"],
20
+ }
21
+ }
22
+
23
+
24
+ # ---------------------------------------------------------------------------
25
+ # Config helpers
26
+ # ---------------------------------------------------------------------------
27
+
28
+ def load_config(root: Path | None = None) -> dict[str, Any]:
29
+ """Load grimx.config from root (defaults to cwd)."""
30
+ path = _resolve(root, CONFIG_FILE)
31
+ if not path.exists():
32
+ return dict(DEFAULT_CONFIG)
33
+ return tomlkit.loads(path.read_text())
34
+
35
+
36
+ def write_config(data: dict[str, Any], root: Path | None = None) -> None:
37
+ path = _resolve(root, CONFIG_FILE)
38
+ path.write_text(tomlkit.dumps(data))
39
+
40
+
41
+ # ---------------------------------------------------------------------------
42
+ # Lock file helpers
43
+ # ---------------------------------------------------------------------------
44
+
45
+ def load_lock(root: Path | None = None) -> dict[str, Any]:
46
+ path = _resolve(root, LOCK_FILE)
47
+ if not path.exists():
48
+ doc = tomlkit.document()
49
+ doc["dependencies"] = tomlkit.table()
50
+ return doc
51
+ return tomlkit.loads(path.read_text())
52
+
53
+
54
+ def write_lock(data: dict[str, Any], root: Path | None = None) -> None:
55
+ path = _resolve(root, LOCK_FILE)
56
+ path.write_text(tomlkit.dumps(data))
57
+
58
+
59
+ def add_dependency(
60
+ name: str,
61
+ manager: str,
62
+ version: str,
63
+ root: Path | None = None,
64
+ ) -> None:
65
+ lock = load_lock(root)
66
+
67
+ if "dependencies" not in lock:
68
+ lock["dependencies"] = tomlkit.table()
69
+
70
+ entry = tomlkit.inline_table()
71
+ entry.append("manager", manager)
72
+ entry.append("version", version)
73
+
74
+ lock["dependencies"][name] = entry
75
+ write_lock(lock, root)
76
+
77
+
78
+ # ---------------------------------------------------------------------------
79
+ # Internal
80
+ # ---------------------------------------------------------------------------
81
+
82
+ def _resolve(root: Path | None, filename: str) -> Path:
83
+ base = root or Path(os.getcwd())
84
+ return base / filename