Skip to main content

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/narrativeengine-py/Cargo.toml --extras pydantic
python -m pytest
ruff check .
mypy narrativeengine

Build

maturin build --manifest-path ../crates/narrativeengine-py/Cargo.toml --release

Release

Wheels are built through GitHub Actions and published by scripts/publish-all.sh.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

narrativeengine-0.1.22-cp313-cp313-win_amd64.whl (287.5 kB view details)

Uploaded CPython 3.13Windows x86-64

narrativeengine-0.1.22-cp313-cp313-manylinux_2_34_x86_64.whl (439.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

narrativeengine-0.1.22-cp313-cp313-macosx_11_0_arm64.whl (380.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

Details for the file narrativeengine-0.1.22-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for narrativeengine-0.1.22-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0954b8bcada707703a0c651acf4f1c115dfe4cdcae62b733c1f8cd1c6f42cf20
MD5 0833a23449e5c810032f295c4f6637b9
BLAKE2b-256 8b3f15c66b4e7334da38a15b94c3d2508ed0834150b290034b229397b85c6b5a

See more details on using hashes here.

File details

Details for the file narrativeengine-0.1.22-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for narrativeengine-0.1.22-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 27cd6eaa519726b0cea175bad85a303982431e0f1b65ea962a35c9269c979616
MD5 787fad8eca1893bff2c8aa6265dcf6f7
BLAKE2b-256 c851f7a3976eeac672a23dae92291ab7e22da30d3d5c00dde2c76f7c02449280

See more details on using hashes here.

File details

Details for the file narrativeengine-0.1.22-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for narrativeengine-0.1.22-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9ba9eb3db8865347550c83972ac3a8973870efc88b390989c49c986056208fa7
MD5 dc61fffebe7ba5e0fb3cd1d4692e8711
BLAKE2b-256 992d7405e46ce7ef4ee5bbfbc42ba9f8c6e10bf643d482a287e9abca90e6f0d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page