You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/API_reference.md
+98-1Lines changed: 98 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -185,7 +185,104 @@ A custom exception raised by `CommandRunner.run()` on failure. It is a subclass
185
185
186
186
---
187
187
188
-
### 5. Command-Line Interface (CLI)
188
+
### 5. CARPentry Command Execution
189
+
190
+
**Entry Point:**`pycemrg.system.CarpRunner`
191
+
192
+
A specialized runner for executing commands from the CARPentry/openCARP ecosystem. Its primary responsibility is to correctly source the `config.sh` file from a CARPentry installation, setting up the complex environment (`PATH`, `PYTHONPATH`, license variables, etc.) before delegating execution to a generic `CommandRunner`.
193
+
194
+
**Instantiation:**
195
+
196
+
There are two primary ways to initialize the `CarpRunner`: by providing an explicit path or by using the auto-discovery class method.
197
+
198
+
***1. Explicit Path (Recommended):**
199
+
200
+
```python
201
+
import logging
202
+
from pycemrg.system import CommandRunner, CarpRunner
203
+
204
+
# A generic CommandRunner is required
205
+
runner = CommandRunner()
206
+
207
+
# Instantiate CarpRunner with the path to the installation's config.sh
*`search_paths` (Optional[Sequence[Path]]): A list of directories to search. If `None`, a default list of common locations is used (e.g., `~/carpentry_bundle`, `/opt/CARPentry`).
272
+
***Returns:**
273
+
*`Optional[pathlib.Path]`: The path to the first `config.sh`file found, or`None`.
274
+
275
+
**Other Utility Methods:**
276
+
The class also provides several helper methods for convenience: `reload_environment()`, `get_carp_path()`, `get_carputils_settings_path()`, and`get_license_path()`.
277
+
278
+
**Associated Exception:**
279
+
280
+
#### `pycemrg.system.CarpEnvironmentError`
281
+
A custom exception raised by `CarpRunner`if it fails to source or validate the CARPentry environment from the `config.sh`file. This can happen if the fileis corrupted, incomplete, or the sourcing command fails. It is a subclass of `RuntimeError`.
282
+
283
+
---
284
+
285
+
### 6. Command-Line Interface (CLI)
189
286
190
287
For interactive use, the library provides a CLI to perform scaffolding.
0 commit comments