Skip to main content

Fernz banner: a white house and mailbox surrounded by ferns

Fernz

Fernz is a clean-room, pure Python reimplementation of Jericho and its underlying Frotz Z-machine engine, with a familiar Python API for playing and exploring interactive fiction. Here, clean-room means implementing the engine using only open specifications and documented public APIs, then testing its behavior against the original interpreters without inspecting their code (i.e., black-box behavioral comparisons).

It is also an experiment in agentic coding to see how far Astra could get with a public specification and a black-box reference implementation.

It was built to enable cross-platform play and redistribution in Cabin Fever x86 and to make Z-machine games easy to embed, test, and experiment with from Python. Fernz is MIT licensed and runs on Linux, macOS, and Windows.

It currently plays V3, V4, V5, and V8 stories and inspects V1–V8 files. The API covers gameplay, checkpoints, score/move queries, and object inspection; some Jericho methods and Z-machine features remain unimplemented.

Install

Requires Python 3.11+. Include the optional Textual terminal interface:

python -m pip install "fernz[textual]"

Use pip install fernz for the dependency-free library and simple terminal player.

Get a game and play

Download the BYU-PCCL game collection and play Zork I:

fernz --download-games
fernz zork1.z5

The download extracts only the contents of the archive's jericho-game-suite directly into ./games/, matching the test fixture. Games are distributed separately and retain their own copyrights and licenses. This Zork I file contains a V3 story despite its .z5 extension.

To choose a destination, use fernz --download-games /path/to/collection, then fernz /path/to/collection/zork1.z5. Existing destinations containing zork1.z5 are reused without downloading or overwriting files; an existing destination without that file reports an error.

You can also bring your own raw Z-machine story. Fernz first tries the exact supplied path, then, only if it is missing and relative, the same path under ./games. For example, zork1.z5 falls back to ./games/zork1.z5. There is no extension guessing or other search. Errors reading an existing path are reported without falling back. This lookup also applies to --inspect; the Python API accepts explicit paths or an already-loaded Story.

Try look, open mailbox, and read leaflet. Press Ctrl+Q to exit. Textual is selected automatically when installed; --simple selects plain text. The game's save and restore commands open file dialogs.

Zork I running in the Fernz terminal interface

Use the API

from fernz import FernzEnv

env = FernzEnv("games/zork1.z5", seed=42)
try:
    observation, info = env.reset()
    print(observation.text, end="")
    for command in ("open mailbox", "take leaflet", "read leaflet"):
        observation, reward, done, info = env.step(command)
        print(observation.text, end="")
        if done:
            break
    checkpoint = env.get_state()
    env.step("look")
    env.set_state(checkpoint)
finally:
    env.close()

Observations provide plain .text and an ordered .stream with display tags. reward is the score change, info includes score and moves for supported games, and done means the interpreter has quit. Checkpoints include RNG state for reproducible replay; env.copy() forks an environment for independent exploration.

Further reading

Detailed guide · Terminal controls · API and project overview · Testing

Specifications: Z-machine Standard 1.1, annotated edition, Quetzal save format, and Jericho's public API.

Maintainers: see the publishing setup and release guide for GitHub/PyPI configuration, tag releases, local packaging checks and recovery.

Metadata

Release files for fernz 0.0.4

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

Source distribution (sdist)

Source distribution for fernz 0.0.4
File Size Uploaded Provenance Actions
fernz-0.0.4.tar.gz 67.5 kB With provenance Details for fernz-0.0.4.tar.gz

Built distribution (wheel)

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

Total release size: 143.9 kB

Release files / fernz-0.0.4.tar.gz

Download URL fernz-0.0.4.tar.gz
Size 67.5 kB
Tags Source
SHA-256 checksum
How to use checksums
353b38a8175aa4e8601a91040215f537d405f78394533c33d0021e67c7e7d0b9
BLAKE2b-256 checksum
How to use checksums
1d2a187f45accd82b1165747decd8f566abcb37523a50ae6d128978a10f1eaaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 14, 2026.

Transparency log

Release files / fernz-0.0.4-py3-none-any.whl

Download URL fernz-0.0.4-py3-none-any.whl
Size 76.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6697358aaf8a34c033055023c417c9ee175285d436b4e13d08ac2f28d3631217
BLAKE2b-256 checksum
How to use checksums
84579ca483e0e78009e2568499a7c949a259c880b00ad7f258bc5dde9cf05b5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 14, 2026.

Transparency log

Security for fernz 0.0.4

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 fernz-0.0.4.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 Oct 14, 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