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

Uploaded CPython 3.13Windows x86-64

narrativeengine-0.1.12-cp313-cp313-manylinux_2_34_x86_64.whl (439.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

narrativeengine-0.1.12-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.12-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for narrativeengine-0.1.12-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2d0dcc27a58d59055020da6fae5fcbc5730935158bdbd16cae84d1732bdf269c
MD5 3626fbacb6f1b1b1c4a427321a2877f8
BLAKE2b-256 66aeaa99b4a48f04a11a6281559f48b1918ab19a84c53c2c1e98d6d71f83b50c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.12-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 83123db8bcf131debb3ba90fcf0b93c27f02f1aa3a154a5a02eea30a87f43d8a
MD5 1c25b635bea075c0b50df92807970a4b
BLAKE2b-256 094c692cdb6f679b76be11b5aab54f6a2126f92f0eccc127774e510fb20fe34f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.12-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e6649f1f45f93fb48a697ccaade89483866403d615da4dd85be4dd8af2868d0d
MD5 c89c8db4b1e4cc9ce0ca5361a01c7cf4
BLAKE2b-256 8603225c32dbbc09afc79d394c578d6d6bb803b8f0990e495aca72694ddf6032

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