Skip to main content

objectionengine2

objectionengine2 converts comment chains and scripted dialogue into Ace Attorney style videos. It is an independent continuation of Objection Engine, originally created by Luis Mayo Valbuena. The original copyright and MIT license are preserved in LICENSE.

The distribution, repository, and Python import are all named objectionengine2. Update existing objection_engine imports when migrating scripts.

Requirements

  • Python 3.10 through 3.14
  • FFmpeg and ffprobe on PATH
  • The Objection Engine asset pack. The renderer downloads it on first use into the user cache directory selected by platformdirs for objectionengine2. An existing complete ./assets/ pack is copied there on first use.

Install

From a clone, sync the locked environment with uv:

uv sync --python 3.14 --locked

The package supports Python 3.10–3.14; .python-version selects 3.14 by default. To enable Hugging Face sentiment, add --extra sentiment to the run command, for example uv run --locked --extra sentiment python examples/example_easy.py. For installations from PyPI, use uv add --torch-backend cpu "objectionengine2[sentiment]" to select CPU-only PyTorch; the CPU index setting in this checkout does not propagate to installed packages. This downloads a model on first use into the same user cache under models/. The base installation does not need a model. Find the cache location with uv run python -c 'from objectionengine2.cache import cache_path; print(cache_path())'.

Render comments

from objectionengine2.beans.comment import Comment
from objectionengine2.renderer import render_comment_list

comments = [
    Comment(user_name="Phoenix", text_content="The defense is ready."),
    Comment(user_name="Edgeworth", text_content="The prosecution is ready."),
]
render_comment_list(comments, output_filename="outputs/output.mp4")

Run uv run python examples/example_easy.py from the repository root for a complete example. Additional scene, XML, and casting examples are in examples/; reference documentation is in docs/. Pass an output_filename in an existing directory. Scripts with literal assets/... paths still need a local asset directory; generated comment dialogue uses the user cache.

Sentiment settings

By default, dialogue uses neutral sentiment and needs no machine learning dependency. Explicit Comment(score=...) values still select positive or negative sprites. Set oe_sentiment_model=hf after installing the sentiment extra to use the Hugging Face model. Setting oe_bypass_sentiment to a nonempty value forces neutral sentiment. The former Polyglot mode is no longer supported; an unsupported oe_sentiment_model value raises a clear error.

Set OE_DIRECT_H264_ENCODING=true only if your OpenCV build provides an H.264 encoder. The default path encodes the intermediate video with OpenCV and creates the final H.264/AAC MP4 with FFmpeg.

Container (Podman)

The Docker image uses Python 3.14 and includes FFmpeg. Build and run the included example from the repository root:

podman build -t objectionengine2 .
podman volume create objectionengine2-cache
podman run --rm \
  --mount type=volume,src=objectionengine2-cache,dst=/root/.cache/objectionengine2 \
  --mount type=bind,src="$(pwd)/outputs",dst=/app/outputs \
  objectionengine2

The result is outputs/output.mp4. Ensure outputs/ exists before running; the image saves downloaded assets and models in the mounted cache volume. To run your own script, mount it at /app/render.py and add render.py after the image name. Have the script write into outputs/.

Tests

uv sync --locked installs the default dev group, including pytest. Run uv run --locked pytest -q for offline tests. They generate their own small media inputs and require FFmpeg and ffprobe but do not download assets or models.

For a complete courtroom smoke test, run uv run --locked pytest -q -m asset_integration. The test calls ensure_assets_are_available() from objectionengine2.utils first, which populates the platform cache if needed. Keep that cache to avoid downloading the pack again.

Contributing

Changes and fixes are welcome. Please run the offline suite before opening a pull request.

Metadata

Release files for objectionengine2 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for objectionengine2 1.0.3
File Size Uploaded Provenance Actions
objectionengine2-1.0.3.tar.gz 35.7 kB With provenance Details for objectionengine2-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for objectionengine2 1.0.3
File Interpreter ABI Platform Actions
objectionengine2-1.0.3-py3-none-any.whl Python 3 none any Details for objectionengine2-1.0.3-py3-none-any.whl

Total release size: 78.3 kB

Release files / objectionengine2-1.0.3.tar.gz

Download URL objectionengine2-1.0.3.tar.gz
Size 35.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9d9687b77ce8cdfcf1b54138d7df53678cb4a5d6962a0f63d8e50883f25632b3
BLAKE2b-256 checksum
How to use checksums
4af0a41513d3ed7eba66a9d7cc4ed0abe90197649e47d388f85c5239a5ff0d0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / objectionengine2-1.0.3-py3-none-any.whl

Download URL objectionengine2-1.0.3-py3-none-any.whl
Size 42.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4e7f210aeb06482d795415332e8936aa5231b5543a357a2b6104f6570026cd2
BLAKE2b-256 checksum
How to use checksums
db1d3ee2e9cc1c0cdd35ec346b77115e170e48637883e80462447721d8f18520
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for objectionengine2 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for objectionengine2-1.0.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page