Python SDK for Ruleforge policy CLI orchestration and alert integrations.
Project description
Ruleforge Python SDK
ruleforge-python is a cross-platform Python SDK for running Ruleforge
policies through the existing policy executable.
It provides:
- High-level managed service APIs with restart supervision.
- Low-level wrappers for
run,serve,test,fmt, andbundle. - Typed alert parsing from JSONL output.
- Pluggable alert sinks with optional disk-backed retry queue.
Supported wheel platforms (v1):
- Windows
x86_64 - Linux
manylinux2014_x86_64 - Linux
manylinux2014_aarch64
Note: Windows connectors (winlog, evtx) remain Windows-only CLI features.
Install
pip install ruleforge-python
Quick Start (High Level)
from ruleforge.service import RuleforgeService
from ruleforge.sinks import StdoutSink
svc = RuleforgeService.from_sources_config(
sources_config="/opt/ruleforge/config/sources.live.json",
sources_status="/opt/ruleforge/state/ruleforge.sources.status.json",
sinks=[StdoutSink()],
)
svc.start()
try:
for alert in svc.iter_alerts():
print(alert.rule, alert.severity, alert.emit)
finally:
svc.stop()
svc.wait()
Quick Start (Low Level)
from ruleforge.cli import run
result = run(
rules="examples/rules.dsl",
schema="examples/schema.json",
input_path="examples/events.jsonl",
)
print("exit:", result.exit_code)
print("alerts:", len(result.alerts))
Binary Resolution
By default the SDK resolves policy in this order:
- Explicit
policy_path=argument. RULEFORGE_POLICY_PATHenvironment variable.- Embedded packaged binary (
ruleforge/bin/policy.exeon Windows,ruleforge/bin/policyon Linux). PATHlookup (platform-specific names).
If no executable is found, an actionable BinaryResolutionError is raised.
Packaging Note
Build artifacts (wheel only):
python python/scripts/build_release_artifacts.py \
--policy-binary-path <path-to-policy-binary> \
--output-root <cmake-build>/python_package/<config> \
--clean-dist \
--skip-tests
Or use the CMake target:
cmake --build cmake-build-debug --config Debug --target package_ruleforge_python
Output location for the CMake target:
cmake-build-debug/python_package/Debug/dist
Stage a profile wheel into the shared release folder:
cmake --build cmake-build-debug --config Debug --target stage_ruleforge_python_wheel
Default staged release folder:
release/python/<RULEFORGE_VERSION>
Verify staged multi-platform bundle before upload:
cmake --build cmake-build-debug --config Debug --target verify_ruleforge_python_release
Manual publish flow (TestPyPI first):
python -m twine upload --repository-url https://test.pypi.org/legacy/ release/python/<version>/*.whl
python -m twine upload release/python/<version>/*.whl
Use API-token auth for uploads:
TWINE_USERNAME=__token__TWINE_PASSWORD=<token>
The packaging flow stages files in a build-only folder and does not modify
python/src/ruleforge/bin.
Windows Notifier Pack
The Windows notifier deployment assets are intentionally not shipped inside the Python wheel. Use the canonical pack under:
examples/windows_bad_event_notifier
License
- Package/project license:
LICENSE(proprietary). - Third-party notices:
THIRD_PARTY_NOTICES.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 Distributions
Built Distributions
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 ruleforge_python-0.1.2-py3-none-win_amd64.whl.
File metadata
- Download URL: ruleforge_python-0.1.2-py3-none-win_amd64.whl
- Upload date:
- Size: 372.5 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6067e02f01239023209d12715c14f06504e70c411b74a93c75dd79e68fe1ccc0
|
|
| MD5 |
b17fc05d29f6910a25feab1b249b3a1e
|
|
| BLAKE2b-256 |
9a53d8b8e7ac485742cce11b8a6df21870134208571ff17acbbb826c4c245cde
|
File details
Details for the file ruleforge_python-0.1.2-py3-none-manylinux2014_x86_64.whl.
File metadata
- Download URL: ruleforge_python-0.1.2-py3-none-manylinux2014_x86_64.whl
- Upload date:
- Size: 404.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
545248072d7491af220bff95a586d597e9ecfb351614ae92884cd020269d325a
|
|
| MD5 |
90c0b3465b39d8268fa181fdcb6dc9bb
|
|
| BLAKE2b-256 |
464c41f333985d6fa58674a8abac2eff99aa1dfd000b99457483edbf0c3a519a
|