regopy
Python interface for the OPA Rego Language and Runtime
What it is and what it does
regopy is a Python wrapper around rego-cpp, Microsoft's open-source C++ implementation of the Rego language from the Open Policy Agent project. Rego is a declarative query language designed for policy evaluation and data querying. The package lets you instantiate a Rego interpreter in Python, load policy modules, set input and data contexts, and execute queries that return structured results with variable bindings.
You can use regopy to embed policy-as-code evaluation into Python applications—defining rules in Rego syntax, then querying them from Python with dynamic input and data. The wrapper provides idiomatic Python interfaces: you load modules as strings, set input and data via dictionaries, and receive results as JSON-like objects. It also supports building and executing pre-compiled Rego bundles, useful for performance-sensitive deployments.
Use it for:
- Embed policy evaluation in Python microservices to enforce authorization rules or compliance checks without external API calls.
- Build configuration validation tools that use declarative Rego rules to check infrastructure or application settings.
- Implement access control logic in Python applications by writing Rego policies and querying them with user/resource context.
- Integrate OPA-compatible policies into Python data pipelines for dynamic filtering or transformation rules.
- Prototype and test Rego policies in a Python environment before deploying them to a full OPA instance.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
regopy wraps the Open Policy Agent's Rego language compiler and runtime, letting you write and execute Rego policy queries directly from Python code.
Yes, if you need to run Rego policies from Python. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and provides prebuilt wheels for common platforms. Medium install friction is typical for compiled packages and not a barrier. Start with it if you're already using or planning to adopt Rego for policy evaluation.
Install
regopy on PyPI
pip
pip install regopyuv
uv add regopypoetry
poetry add regopyInstalling regopy
Before you install
Medium install friction due to compiled wheels; however, prebuilt binaries are available for common platforms (macOS, Linux, Windows) across Python 3.10–3.12, and the package is actively maintained with a recent release.
License in practice
MIT license is permissive; you can use regopy in commercial and proprietary projects with minimal restrictions.
Quickstart
from regopy import Interpreter
rego = Interpreter()
result = rego.query("x=5;y=x + (2 - 4 * 0.25) * -3 + 7.4;2 * 5")
print(result)
Requires Python 3.10 or later; prebuilt wheels are available for macOS (arm64, x86_64), Linux (aarch64, x86_64), and Windows (x86_64).
Verify before relying
- Whether the C++ runtime dependency (rego-cpp) is bundled in wheels or requires separate installation.
- Performance characteristics when executing complex policies or large datasets.
- Exact scope of custom built-in function support beyond the documented standard Rego built-ins.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4,>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 39 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 185,354/month — #10,011 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: regopy-1.5.2-cp310-cp310-macosx_15_0_arm64.whl; regopy-1.5.2-cp310-cp310-macosx_15_0_x86_64.whl; regopy-1.5.2-cp310-cp310-manylinux_2_34_aarch64.whl; regopy-1.5.2-cp310-cp310-manylinux_2_34_x86_64.whl; regopy-1.5.2-cp310-cp310-musllinux_1_2_aarch64.whl; regopy-1.5.2-cp310-cp310-musllinux_1_2_x86_64.whl; regopy-1.5.2-cp310-cp310-win_amd64.whl; regopy-1.5.2-cp311-cp311-macosx_15_0_arm64.whl; regopy-1.5.2-cp311-cp311-macosx_15_0_x86_64.whl; regopy-1.5.2-cp311-cp311-manylinux_2_34_aarch64.whl; regopy-1.5.2-cp311-cp311-manylinux_2_34_x86_64.whl; regopy-1.5.2-cp311-cp311-musllinux_1_2_aarch64.whl; regopy-1.5.2-cp311-cp311-musllinux_1_2_x86_64.whl; regopy-1.5.2-cp311-cp311-win_amd64.whl; regopy-1.5.2-cp312-cp312-macosx_15_0_arm64.whl; regopy-1.5.2-cp312-cp312-macosx_15_0_x86_64.whl; regopy-1.5.2-cp312-cp312-manylinux_2_34_aarch64.whl; regopy-1.5.2-cp312-cp312-manylinux_2_34_x86_64.whl; regopy-1.5.2-cp312-cp312-musllinux_1_2_aarch64.whl; regopy-1.5.2-cp312-cp312-musllinux_1_2_x86_64.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
agent-framework-declarativeEnables building agents from YAML…
permissive · top 15,000 on PyPI
opikOpik is an open-source LLM observability and…
permissive · top 5,000 on PyPI
pulumi-policyDefines and enforces policy rules on cloud…
permissive · top 15,000 on PyPI
toolguardGenerates deterministic Python code that…
permissive · top 15,000 on PyPI
oslo.policyoslo.policy enforces role-based access control…
permissive · top 15,000 on PyPI
open-interpreterOpen Interpreter lets language models execute…
unclear · top 15,000 on PyPI
agent-framework-purviewAdds Microsoft Purview data governance and DLP…
permissive · top 15,000 on PyPI
agentopsAgentOps provides observability and monitoring…
permissive · top 15,000 on PyPI
mo-parsingmo-parsing is a PEG parser generator that lets…
permissive · top 15,000 on PyPI
policyuniverseParses and analyzes AWS IAM and Resource…
permissive · top 15,000 on PyPI