uv-guard is a CLI tool that harmonizes the uv package manager with the Guardrails AI ecosystem.
Project description
uv-guard
uv-guard is a CLI tool that harmonizes the uv package manager with the Guardrails AI ecosystem.
While uv excels at strict environment locking, its synchronization process often identifies and removes Guardrails' static assets as extraneous files. uv-guard resolves this conflict by wrapping both tools into a unified workflow. It maintains a persistent record of installed validators, tracks their dependencies, and automatically triggers post-installation scripts whenever the environment is updated—ensuring your validation logic remains intact without manual intervention.
Configuration & Persistence
To track Guardrails Hub URIs, uv-guard extends the standard pyproject.toml configuration. When a validator is added, uv-guard creates a dedicated guardrails list within the configuration file, functioning alongside standard dependencies.
This ensures that the pyproject.toml file remains the project's source of truth, tracking both standard Python packages and Guardrails Hub URIs in one place.
Example pyproject.toml structure:
[project]
name = "my-project"
dependencies = [
"guardrails-ai",
"guardrails-grhub-regex-match", # The underlying Python package resolved by uv-guard
]
# uv-guard tracks the specific Hub URIs here
guardrails = [
"hub://guardrails/regex_match"
]
Prerequisites
- Python: 3.10+
- uv: See the uv installation page
Installation
You can install uv-guard using pip, pipx, or uv tool:
# Recommended: Install as a standalone tool via uv
uv tool install uv-guard
Usage
uv-guard mirrors the uv commands but extends them to support Guardrails Hub URIs (hub://).
Initialize a Project
Initializes a new uv project and automatically adds the guardrails-ai core dependency.
uv-guard init
The command passes all arguments and options to uv init. For example:
uv-guard init --name my-project
forwards the --name my-project option.
Configure Guardrail AI
Configure Guardrails AI. You can get your API key from the Guardrails Hub website.
Guardrails has to be configured to add Guardrails validators from the Hub.
uv-guard configure
Passes all arguments and options to guardrails configure.
Add Dependencies
Adds a package to the project. This command intelligently handles both standard PyPI packages and Guardrails Hub URIs.
When adding a Guardrails Hub URI:
- It adds the URI to the
guardrailslist inpyproject.toml. - It resolves the underlying Python package required by the validator and adds it to the standard
dependencies. - It executes the Guardrails post-installation script to set up the validator.
# Add a standard Python package
uv-guard add pandas
# Add a Guardrails validator
uv-guard add hub://guardrails/regex_match
Passes all arguments and options to uv add.
Remove Dependencies
Uninstall the guardrails, removes the package from the uv environment and cleans up the pyproject.toml.
uv-guard remove hub://guardrails/regex_match
Passes all arguments and options to uv remove.
Sync Environment
Updates the project environment. This is the critical operation that ensures compatibility.
When syncing, uv-guard:
- Reads the
guardrailslist frompyproject.toml. - Ensures underlying Python packages are present in the
uvdependency tree. - Executes
uv syncto update the environment. - Re-runs Guardrails installation scripts to restore any assets removed during the sync process.
uv-guard sync
Passes all arguments and options to uv sync.
Other uv Commands
All other uv commands are explicitly forwarded to the underlying uv executable. This allows you to use uv-guard as a drop-in replacement for uv in your daily workflow.
Examples:
# Update the lockfile
uv-guard lock
# View the dependency tree
uv-guard tree
# Manage python versions
uv-guard python install 3.12
Supported commands include: auth, lock, export, tree, format, tool, python, pip, venv, build, publish, cache, and self.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uv_guard-0.1.0.tar.gz.
File metadata
- Download URL: uv_guard-0.1.0.tar.gz
- Upload date:
- Size: 228.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
536fd5db0e2c7512a989d86a92cea4590536c3eae0f011bc3ced93016899b06f
|
|
| MD5 |
1abfc1249d8bd90b88ac7356ebe24196
|
|
| BLAKE2b-256 |
50c84d88a5254648983e3a7dc549c0bc0810ca539be81124b25c8ed3f64c9af3
|
Provenance
The following attestation bundles were made for uv_guard-0.1.0.tar.gz:
Publisher:
cd.yml on Florian-BACHO/uv-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uv_guard-0.1.0.tar.gz -
Subject digest:
536fd5db0e2c7512a989d86a92cea4590536c3eae0f011bc3ced93016899b06f - Sigstore transparency entry: 936961380
- Sigstore integration time:
-
Permalink:
Florian-BACHO/uv-guard@c89e54a584ff0e399fc0567f94303e17b9ab2db6 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Florian-BACHO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@c89e54a584ff0e399fc0567f94303e17b9ab2db6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file uv_guard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: uv_guard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb73eedc5414470cba60f8bb91e2eef0664f0d108a7a7ba161639506e9b58ffb
|
|
| MD5 |
c72f8ac5e1a8022b6491117be3bd7dc3
|
|
| BLAKE2b-256 |
01d42666e7b5b5fb240a17fb38fb36b71993a92efae2d00246ea7e730f4d65c8
|
Provenance
The following attestation bundles were made for uv_guard-0.1.0-py3-none-any.whl:
Publisher:
cd.yml on Florian-BACHO/uv-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uv_guard-0.1.0-py3-none-any.whl -
Subject digest:
fb73eedc5414470cba60f8bb91e2eef0664f0d108a7a7ba161639506e9b58ffb - Sigstore transparency entry: 936961383
- Sigstore integration time:
-
Permalink:
Florian-BACHO/uv-guard@c89e54a584ff0e399fc0567f94303e17b9ab2db6 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Florian-BACHO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@c89e54a584ff0e399fc0567f94303e17b9ab2db6 -
Trigger Event:
release
-
Statement type: