Add your description here
Reason this release was yanked:
Bad release
Project description
Open Policy Agent WebAssembly SDK for Python
This is based off opa-wasm, which uses wasmer, but this targets wasmtime. This allows you to use OPA WASM binaries in Python versions above 3.10, which is the cutoff for wasmer.
It also appears to run significantly faster due to some optimizations I made and some optimizations in python in general since 3.10.
Getting Started
Install the module
pip install opa-wasmtime
Usage
There are only a couple of steps required to start evaluating the policy.
# Import the module
from opa_wasmtime import OPAPolicy
# Load a policy by specifying its file path
policy = OPAPolicy('./policy.wasm')
# Optional: Set policy data
policy.set_data({"company_name": "ACME"})
# Evaluate the policy
input = {"user": "alice"}
result = policy.evaluate(input)
Support Targets
This module has been tested on python 3.10 and above and wasmtime 27.0.2 and above.
Writing the policy
See https://www.openpolicyagent.org/docs/latest/how-do-i-write-policies/
Compiling the policy
Either use the Compile REST API or opa build CLI tool.
For example, with OPA v0.20.5+:
opa build -t wasm -e 'example/allow' example.rego
Which compiles the example.rego policy file with the result set to
data.example.allow. The result will be an OPA bundle with the policy.wasm
binary included.
See opa build --help for more details.
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 opa_wasmtime-0.1.0.tar.gz.
File metadata
- Download URL: opa_wasmtime-0.1.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a78fad2c2e31d2998d8eb237718074d3916ca6ba441e229bf1e2bea118afbdc0
|
|
| MD5 |
2e7b41d99574649653f272db113b08ac
|
|
| BLAKE2b-256 |
f615a57471a185372eec78ca19fc4071480fe985b8e88113d4e1934ed5963c35
|
File details
Details for the file opa_wasmtime-0.1.0-py3-none-any.whl.
File metadata
- Download URL: opa_wasmtime-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c60319685552272ac4cdf9b1159e3f917352038bc506de1b11a7828779d5c960
|
|
| MD5 |
e73d9b09430e49a623e5651f086e2f9b
|
|
| BLAKE2b-256 |
1e08766da32c4c469a73d9d042d8563ac0b5211437e9fc110e55a7fe5d71c326
|