chore: initialize containerized Python learning workbook (2026 DevOps/SRE)
This commit is contained in:
commit
ae4c421815
63 files changed
+1273
No files matched your search
@@ -0,0 +1,11 @@
|
||||
# 03 — Cross-Platform OS (`pathlib`, bezpieczny `subprocess`, JSON logi)
|
||||
|
||||
## Zadania (`cross_os.py`)
|
||||
1. `config_path(base_dir: Path, app_name: str) -> Path` — przenośna ścieżka `<base_dir>/<app_name>/config.yaml`.
|
||||
2. `run_echo_safely(message: str) -> str` — uruchom komendę `[sys.executable, "-c", "import sys; print(sys.argv[1])", message]` używając `subprocess.run(..., shell=False, capture_output=True, text=True, check=True, timeout=5)`.
|
||||
3. `format_json_log(level: str, event: str, **fields: object) -> str` — zwróć jedną linię JSON z kluczami `level`, `event` oraz dodatkowymi polami.
|
||||
|
||||
## Uruchomienie testów
|
||||
```bash
|
||||
make test MOD=02-engineering-2026/03-cross-platform-os
|
||||
```
|
||||
Reference in new issue
Block a user