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.13-cp313-cp313-win_amd64.whl (286.5 kB view details)

Uploaded CPython 3.13Windows x86-64

narrativeengine-0.1.13-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.13-cp313-cp313-macosx_11_0_arm64.whl (380.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.13-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6048b23b41069b1cc5e1aeef4a60eeedfaa071602c207d84eef2590955aba3bd
MD5 e06ea797ee6a7f79f677e2a8885343f4
BLAKE2b-256 36d18bc5253bf8de37d2aa58b94ecd5361d151980b19acf408d00fa56db66ac4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.13-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 714180f22ee7e14f347965a888fd4797a68a9deb2d1fa7b8cbdbb5ddf2122c2f
MD5 ccafd0b645cc1b4c3d5b40c6eb4a2cda
BLAKE2b-256 678ce701b87943c89e2ff8f2def0dc1b935faf1ab43389b092ee8eef2012ef86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.13-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0294c23c869807f1b27e572f29424c2d2319028d08968e286db3e0ddcf5be5ea
MD5 332ac578cdffdea9c392a761c5d8409e
BLAKE2b-256 1cdf116535f0c9ca791d62e2c3c2e3558a783a487f470f2982c0e3580d92cba5

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