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/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


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.1.tar.gz (57.4 kB view details)

Uploaded Source

Built Distribution

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

narrativeengine-0.1.1-cp313-cp313-macosx_11_0_arm64.whl (342.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

Details for the file narrativeengine-0.1.1.tar.gz.

File metadata

  • Download URL: narrativeengine-0.1.1.tar.gz
  • Upload date:
  • Size: 57.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.0

File hashes

Hashes for narrativeengine-0.1.1.tar.gz
Algorithm Hash digest
SHA256 969019c1b5a10f8126ce88e9df3dfe38808caa187a97dfee12c0d1ba857231b0
MD5 d03f91bb4a88cbb43c52bec4feffd9c0
BLAKE2b-256 06814d7484f53b82fde390f83ebc2b0fbe460da3290a8dcabaf26b960507d2f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6af2e5678e65eb6b7f18c74d21ffbcf70cb5611b180670abb08c55c11f3ec82d
MD5 a2e61f1e7cbdb0138605909f21dd5b9a
BLAKE2b-256 865774ad4ca02af12c9bf403e3a1b91cff28c520f7e26164d1ead3d7e26029bf

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