Python SDK for NarrativeEngine, powered by Rust and PyO3.
Project description
NarrativeEngine Python SDK
The Python SDK is a thin PyO3 wrapper over the canonical Rust implementation. All domain models are generated from Rust schemas.
Installation
pip install narrativeengine
pip install "narrativeengine[pydantic]"
Usage
from narrativeengine import LabConfig, NarrativeLore, create_block, generate_candidate
block = create_block("intro", "A signal appears in the archive.")
lore = NarrativeLore(id="lore-1", title="Archive Signal", blocks=[block])
candidate = generate_candidate(lore, LabConfig(temperature=0.7, max_candidates=4, seed=7))
Development
python -m pip install -e ".[dev]"
maturin develop --manifest-path ../crates/python-bindings/Cargo.toml --extras pydantic
python -m pytest
ruff check .
mypy narrativeengine
Build
maturin build --manifest-path ../crates/python-bindings/Cargo.toml --release
Release
Wheels are built through GitHub Actions and published by scripts/publish-all.sh.
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
narrativeengine-0.1.0.tar.gz
(56.9 kB
view details)
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 narrativeengine-0.1.0.tar.gz.
File metadata
- Download URL: narrativeengine-0.1.0.tar.gz
- Upload date:
- Size: 56.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43d0f5cf68dc04e341dddff7a73170e61b087ff7b65d1ede498ce4e6d2dab982
|
|
| MD5 |
ef3862f3778ff82b4837c39daad722de
|
|
| BLAKE2b-256 |
ebb39eafc07c2fdf3c1b2e0f76256981996e39c2bed8d917577654ebb2901c26
|
File details
Details for the file narrativeengine-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: narrativeengine-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 342.1 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96bb9d11cb43cec462de10f7ef3958592be93f04cbd28fdd041b2a24ea53f39e
|
|
| MD5 |
3db376c6646fecbda5e0d46de6dfe149
|
|
| BLAKE2b-256 |
828b88167a5ce468780ba31300bdd39fe8a811686af98835dbce042855b77b09
|