envguard-tool
macOS-first Python environment orchestration framework
Note: The PyPI distribution name is
envguard-tool. The installed CLI command and Python import name are bothenvguard.
What is envguard?
envguard is a CLI tool that detects, validates, orchestrates, and guards Python environments. It catches problems before you run your code — not after a cryptic traceback.
Instead of python train.py (and hoping for the best), you run envguard run -- python train.py. Before execution envguard runs a preflight pipeline that verifies:
- Platform compatibility and macOS version
- Python architecture — Apple Silicon (arm64) vs Intel (x86_64) vs Rosetta 2
- Package manager health (pip, conda, mamba, uv, poetry)
- Dependency conflicts and wheel architecture compatibility
- GPU accelerator availability (MPS on Apple Silicon; CUDA flagged as unsupported on macOS)
- Environment integrity, permissions, and ownership
If anything is wrong, execution is blocked with a clear, actionable error. If everything passes, your command runs in the validated environment.
Beyond validation, envguard also handles:
- Dependency resolution — resolve project deps to a pinned set via the PyPI JSON API
- Package installation — install into venv/uv/conda/mamba environments
- Lock file management — generate and sync
envguard.lock
Installation
pip install envguard-tool
# Verify
envguard --version
Requirements:
| Requirement | Version |
|---|---|
| Python | 3.10, 3.11, or 3.12 |
| macOS | 12.0 (Monterey)+ for full feature set |
| Linux | Ubuntu, Debian, Fedora, Arch — partial support |
| Windows | Not supported |
Quick Start
cd /path/to/your/project
# Check your host and project setup
envguard doctor
# Initialise envguard for this project
envguard init
# Run a command with full preflight validation
envguard run -- pytest -v
envguard run -- python train.py
envguard run -- jupyter lab
# Resolve dependencies to pinned versions
envguard resolve
# Generate a lock file
envguard lock generate
# Install from the lock file
envguard install --from-lock
All Commands
Environment management
| Command | Description |
|---|---|
envguard init |
Initialise envguard state for the current project |
envguard doctor |
Full host and project diagnostic report |
envguard detect |
Show detected host facts (OS, arch, Python, tools) |
envguard preflight |
Run the preflight validation pipeline |
envguard run -- <cmd> |
Run a command after passing preflight |
envguard repair |
Auto-repair broken or inconsistent environments |
envguard freeze |
Capture a snapshot of the current environment |
envguard rollback [snapshot-id] |
Restore environment to a previous snapshot |
envguard health |
Show environment health report |
envguard status |
Show current project and environment status |
Dependency management
| Command | Description |
|---|---|
envguard resolve |
Resolve project deps to pinned versions via PyPI API |
envguard install [packages] |
Install packages (or project deps, or from lock) |
envguard install --from-lock |
Sync environment exactly to envguard.lock |
envguard install --dev |
Include dev/optional dependency groups |
Lock file
| Command | Description |
|---|---|
envguard lock generate |
Resolve and write envguard.lock |
envguard lock update |
Re-resolve and refresh envguard.lock |
envguard lock update --package <name> |
Update a single package in the lock |
envguard lock sync |
Sync environment to match lock file exactly |
envguard lock check |
Check if lock file is up-to-date (exit 13 if stale) |
Updates and self-management
| Command | Description |
|---|---|
envguard update |
Check for and apply envguard updates |
envguard update --dry-run |
Check for updates without applying |
Shell and launchd integration
| Command | Description |
|---|---|
envguard install-shell-hooks |
Install zsh/bash shell integration |
envguard uninstall-shell-hooks |
Remove shell integration |
envguard shell-hook |
Emit shell hook code (for use with eval) |
envguard install-launch-agent |
Install macOS launchd periodic update checker |
envguard uninstall-launch-agent |
Remove the launchd agent |
The Preflight Pipeline
envguard run and envguard preflight execute a 9-step pipeline:
| Step | Name | What it does | Fails if |
|---|---|---|---|
| 1 | Host detect | OS, arch, Python, tools, network | Unsupported platform |
| 2 | Project discover | pyproject.toml, requirements.txt, environment.yml, setup.py | Project root not found |
| 3 | Intent analyze | Infer env type, Python version, accelerator targets | — |
| 4 | Rules evaluate | Run 15+ validation rules | Any CRITICAL rule fires |
| 5 | Fail-fast | Block on unrecoverable issues | CUDA on macOS, arch mismatch |
| 6 | Resolution | Choose package manager + Python version | No compatible Python found |
| 7 | Env create/repair | Create venv or repair existing env | Creation fails |
| 8 | Validate | Dependency consistency check | pip check fails |
| 9 | Smoke test | Import key packages | Import error |
Lock File Format
envguard.lock is a TOML file written to the project root:
# envguard.lock — generated by envguard
# Do not edit manually. Regenerate with: envguard lock generate
[metadata]
envguard_version = "1.0.1"
generated_at = "2026-04-08T12:00:00+00:00"
python_requires = ">=3.10"
content_hash = "sha256:abc123..."
sources = ["pyproject.toml"]
[[package]]
name = "requests"
version = "2.31.0"
specifier = "requests==2.31.0"
source = "pypi"
Commit envguard.lock to version control. Use envguard lock check in CI to detect stale locks (exits with code 13 if stale).
Configuration
Create envguard.toml in your project root:
[envguard]
env_type = "venv" # venv | conda | mamba | auto
python_version = "3.11" # pinned Python version
auto_repair = true # auto-repair on preflight failure
fail_fast = true # stop on first CRITICAL finding
[envguard.update]
policy = "stable" # stable | beta | off
check_on_run = true # check for updates before envguard run
Environment Variables
| Variable | Effect |
|---|---|
ENVGUARD_DISABLED |
Set to 1 to skip all preflight checks |
ENVGUARD_LOG_LEVEL |
DEBUG, INFO, WARNING, ERROR |
JSON Output
Every command supports --json / -j for machine-readable output:
envguard doctor --json | jq '.checks[] | select(.status == "error")'
envguard resolve --json | jq '.packages[] | .name + "==" + .version'
envguard lock check --json
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Preflight failed |
| 3 | Environment not found |
| 4 | Environment corrupt |
| 5 | Permission denied |
| 6 | Network unavailable |
| 7 | Platform not supported |
| 8 | Configuration error |
| 10 | Update available |
| 11 | Already up to date |
| 12 | Rollback failed |
| 13 | Lock file stale |
Platform Support
| Platform | Level | Notes |
|---|---|---|
| macOS 12+ (Monterey+) | Full | All features. Primary target. |
| macOS 11 (Big Sur) | Partial | Below recommended minimum. |
| Linux (Ubuntu, Debian, Fedora, Arch) | Partial | Core pipeline works. No LaunchAgent, no MPS. |
| Windows | Not supported | — |
macOS-only features: install-launch-agent, MPS/Metal detection, Rosetta 2 detection, Xcode CLI tools check.
Source Code
Source code and issue tracker: https://github.com/rotsl/envguard
License
Apache 2.0 — see LICENSE.
Metadata
Release files for envguard-tool 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| envguard_tool-1.0.1.tar.gz | 146.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| envguard_tool-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 326.5 kB
Release files / envguard_tool-1.0.1.tar.gz
| Download URL | envguard_tool-1.0.1.tar.gz |
|---|---|
| Size | 146.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f788a6b30336485186373a1c2d4d0364f15f95f772aaca886d11107dbebb528
|
|
BLAKE2b-256 checksum How to use checksums |
e38dfa9eb6fa408ac9f58a8b25f1b0269d00e4343c7b72485fc4301627966cef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / envguard_tool-1.0.1-py3-none-any.whl
| Download URL | envguard_tool-1.0.1-py3-none-any.whl |
|---|---|
| Size | 180.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
94daf8e612fc55b8514e219f78f302845cb6dd65454b7067c5b436b7e3e8cc7a
|
|
BLAKE2b-256 checksum How to use checksums |
c33f35813d3415b9ade8cde8bb9935dd647a3aee6bfb64ef45731520bb66f12a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for envguard-tool 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.