Python bindings for Regorus - a fast, lightweight Rego interpreter written in Rust
Project description
regorus
Regorus is
- Rego-Rus(t) - A fast, light-weight Rego interpreter written in Rust.
- Rigorous - A rigorous enforcer of well-defined Rego semantics.
Regorus can be used in Python via regorus
package. (It is not yet available in PyPI, but can be manually built.)
See Repository.
To build this binding, see building
Usage
import regorus
# Create engine
engine = regorus.Engine()
# Load policies
engine.add_policy_from_file('../../tests/aci/framework.rego')
engine.add_policy_from_file('../../tests/aci/api.rego')
engine.add_policy_from_file('../../tests/aci/policy.rego')
# Add policy data
data = {
"metadata": {
"devices": {
"/run/layers/p0-layer0": "1b80f120dbd88e4355d6241b519c3e25290215c469516b49dece9cf07175a766",
"/run/layers/p0-layer1": "e769d7487cc314d3ee748a4440805317c19262c7acd2fdbdb0d47d2e4613a15c",
"/run/layers/p0-layer2": "eb36921e1f82af46dfe248ef8f1b3afb6a5230a64181d960d10237a08cd73c79",
"/run/layers/p0-layer3": "41d64cdeb347bf236b4c13b7403b633ff11f1cf94dbc7cf881a44d6da88c5156",
"/run/layers/p0-layer4": "4dedae42847c704da891a28c25d32201a1ae440bce2aecccfa8e6f03b97a6a6c",
"/run/layers/p0-layer5": "fe84c9d5bfddd07a2624d00333cf13c1a9c941f3a261f13ead44fc6a93bc0e7a"
}
}
}
engine.add_data(data)
# Set input
input = {
"containerID": "container0",
"layerPaths": [
"/run/layers/p0-layer0",
"/run/layers/p0-layer1",
"/run/layers/p0-layer2",
"/run/layers/p0-layer3",
"/run/layers/p0-layer4",
"/run/layers/p0-layer5"
],
"target": "/run/gcs/c/container0/rootfs"
}
engine.set_input(input)
# Eval query
results = engine.eval_query('data.framework.mount_overlay=x')
# Print results
print(results['result'][0])
# Eval query as json
results_json = engine.eval_query_as_json('data.framework.mount_overlay=x')
print(results_json)
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 Distributions
Built Distributions
File details
Details for the file lakera_regorus-0.1.0-cp311-cp311-manylinux_2_34_aarch64.whl
.
File metadata
- Download URL: lakera_regorus-0.1.0-cp311-cp311-manylinux_2_34_aarch64.whl
- Upload date:
- Size: 19.9 MB
- Tags: CPython 3.11, manylinux: glibc 2.34+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbc683256faea08a09fe8d03ee09939bc4d2b2307bf4714b117a0c79a54a654b |
|
MD5 | d3f7bd1d3d683f1a06798f33c055a6e3 |
|
BLAKE2b-256 | 893f4f97249a6036849f39cedf1f517f5b03936d6912f7380ee9ba1e88b07148 |
File details
Details for the file lakera_regorus-0.1.0-cp311-cp311-manylinux_2_27_x86_64.whl
.
File metadata
- Download URL: lakera_regorus-0.1.0-cp311-cp311-manylinux_2_27_x86_64.whl
- Upload date:
- Size: 20.5 MB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2d346c2023206f57afac8a749f756b9cc2a7feeb155a79aba6693471f7fdd8c |
|
MD5 | cd7455180fd2cdc79fc7a10c1b35c141 |
|
BLAKE2b-256 | f9551322cee33da41d4f8abf11877bbb80f978ab5f3e99182f4e40aafcee2940 |
File details
Details for the file lakera_regorus-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: lakera_regorus-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 20.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7a797e225ce653c665e15710f05b23b8495474456dc4cabc8111ec2c3c7608f |
|
MD5 | 81c19780c56209b68dd8c21816f17d4a |
|
BLAKE2b-256 | ba14ca8df72aca11140abf40c33a0d032ac5218d5962e7230d33a2a902b88135 |
File details
Details for the file lakera_regorus-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: lakera_regorus-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 19.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95f5d046bbf13f17f19426e56f1a77f1a6e1c10c85847c7164792160562f6ebf |
|
MD5 | 9651011f21c4de9a11564ee3ae765427 |
|
BLAKE2b-256 | 337a9441dfe7adac34ca8111333fc146b6e2a4e22474c55cf2723a12b1507fad |
File details
Details for the file lakera_regorus-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: lakera_regorus-0.1.0-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15d58bdc5aaee2bb39cfea34ef16b742ad1164927c4b6f8654e454e6ec1a0083 |
|
MD5 | ee3c62697d1c52f7758c198ca0390c5e |
|
BLAKE2b-256 | 311a5b8f0d42b78db6bcd7ca93c852e0b956916ad433e2affd515b70f38da0a9 |
File details
Details for the file lakera_regorus-0.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
.
File metadata
- Download URL: lakera_regorus-0.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.11, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4970b41d029add72dc1788755fe494e40da208f47f2fa6d43abf0a1d6bf8f777 |
|
MD5 | 72e75248913c364ec540881d53ea44dd |
|
BLAKE2b-256 | d82e92ec80ff01831214dbc380d9aaaf3d13f8fa2db984faab3bc5675602d1aa |
File details
Details for the file lakera_regorus-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: lakera_regorus-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 20.4 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d671e58f122fb2ce16be258d31a5762e122eddbfdc5c7681c2c931268d08416b |
|
MD5 | d4695cc93dd520e51dbf0ae4371dbb0d |
|
BLAKE2b-256 | 8af781dadaf1c747f01a2773e086d1c676502eabf9431ecd696f61538149634a |
File details
Details for the file lakera_regorus-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: lakera_regorus-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 19.8 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bca3942bff8c405c3a84bf5594fece7f0831257d0377ac5685247ab5b6043ed |
|
MD5 | be0c1ea4cac4558598332f8697cec098 |
|
BLAKE2b-256 | 1c05a0542ee1605f88b35dc182480b23a7d80de5369ecc32135be17606f5e3fd |