A dead-simple version manager for Open Policy Agent (OPA).
Project description
opavm
A dead-simple version manager for Open Policy Agent (OPA).
opavm lets you install, pin, and switch OPA versions locally and per-project so your policies run against the same OPA version in dev, CI, and production.
No Docker. No magic. Just predictable binaries.
Why opavm exists
OPA is "just a single binary" until it isn't. Teams regularly run into:
- different OPA versions in CI vs local
- silent upgrades via package managers
- subtle behavior changes across releases
- ad-hoc scripts and manual downloads
opavm solves this by making OPA versioning explicit, reproducible, and boring.
Features (v0.1)
- Install specific OPA versions (or
latest) - Install Regal (Rego linter/LSP) versions
- Set a global default version per tool (
opa/regal) - Pin per project with
.opa-versionor.regal-version - Automatically switch versions by directory
- CI-safe execution without PATH hacks
- Rich progress bar UI for installs
- Show recent OPA/Regal releases in a Rich table (
opavm releases) - Zero runtime services, zero configuration files
Installation
v0.1 supports:
- macOS (
amd64,arm64) - Linux (
amd64,arm64) - Windows (
amd64)
Install as a Python package (recommended with pipx):
pipx install opavm
Or with pip:
pip install opavm
Then add the shim directory to your shell.
macOS/Linux:
export PATH="$HOME/.opavm/shims:$PATH"
Windows PowerShell:
$env:Path = "$HOME\.opavm\shims;$env:Path"
GitHub API token
opavm uses fixed upstream repos:
open-policy-agent/opafor OPA release lookupStyraInc/regalfor Regal release lookup
If you hit GitHub API rate limits, set OPAVM_GITHUB_TOKEN.
Quick start
Install OPA:
opavm install 0.62.1
Set a global default:
opavm use 0.62.1
opavm use 0.38.1 --tool regal
Now:
opa version
uses OPA 0.62.1.
Per-project pinning
Inside a repo that requires a specific version:
opavm pin 0.61.0
opavm pin 0.38.1 --tool regal
If that version is not installed, opavm prompts to install it.
This creates tool-specific version files:
.opa-version # OPA
.regal-version # Regal
Anywhere inside that repo:
opa version
automatically resolves to 0.61.0.
Outside the repo, your global version is used again.
Common commands
Install versions:
opavm install 0.62.1
opavm install latest
opavm install regal 0.38.1
opavm install regal latest
List installed versions:
opavm list
opavm list --tool regal
Switch global version:
opavm use 0.63.0
opavm use 0.38.1 --tool regal
See what's active (and why):
opavm current
opavm current --tool regal
Get the actual binary path:
opavm which
opavm which --tool regal
opavm which prints the resolved binary as an absolute path.
Show recent OPA releases:
opavm releases --limit 10
opavm releases --tool regal --limit 10
Run OPA without relying on PATH (CI-safe):
opavm exec -- test -v ./policy
opavm exec --tool regal -- lint policy/
Remove a version:
opavm uninstall 0.59.0
opavm uninstall 0.38.1 --tool regal
How version resolution works
When you resolve a tool with current, which, or exec:
- Look for the tool pin file in the current directory or parents
- Use
.opa-versionfor OPA,.regal-versionfor Regal - If found, use that version
- Otherwise, use the global default for that tool
- If neither exists, error with guidance
This behavior is deterministic and transparent.
File layout
~/.opavm/
|- versions/
| |- 0.62.1/opa
| `- 0.63.0/opa
|- tools/
| `- regal/
| `- versions/
| `- 0.38.1/regal
|- shims/
| `- opa (or opa.cmd on Windows)
`- state.json
.opa-version and .regal-version files live in your project repos and should usually be committed.
CI usage
You don't need shell shims in CI:
opavm install 0.62.1
opavm exec -- test ./policy
This guarantees the correct OPA version regardless of environment.
Integrity and Reliability
opavmverifies downloaded binaries by executing<tool> versionafter install.- For releases that provide
*.sha256assets (for example OPA),opavmvalidates SHA256 before completing install. - GitHub error handling includes actionable messages for:
- proxy misconfiguration (
HTTP_PROXY/HTTPS_PROXY) - rate limit exhaustion
- network connectivity failures
- auth/permission failures
- proxy misconfiguration (
Contributor workflow, testing gates, and CircleCI release details are in contribution.md.
What opavm is not
- Not a container runtime
- Not a policy runner
- Not a plugin manager
It does one thing: manage OPA binaries predictably.
License
Apache 2.0.
See LICENSE and license.md.
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 opavm-0.1.4.tar.gz.
File metadata
- Download URL: opavm-0.1.4.tar.gz
- Upload date:
- Size: 40.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
501bfc0b6e1682f9a0da8613dc6d2a2464cd810857e467e36abc7540fda1660b
|
|
| MD5 |
177b4f42cf1333d40c725900ee819228
|
|
| BLAKE2b-256 |
341c64645760fd1e997e0ae70c590257d60e44ed5ee337c20c0b0e41374282eb
|
File details
Details for the file opavm-0.1.4-py3-none-any.whl.
File metadata
- Download URL: opavm-0.1.4-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25d5eca0b615f91d435c41ddf8f2d8a3934b94092ecb8ce1522c54aeb02c71b3
|
|
| MD5 |
ca796b13540b558516189d1a5e90bef8
|
|
| BLAKE2b-256 |
3477c197e27b32cd34593e6aa56c402edf96a162ce1295fdb59407476136e30c
|