Skip to main content

evennia-yaml-reader

A source-agnostic YAML file reader for declarative-content libraries in the Evennia ecosystem.

The library abstracts where the YAML lives — local filesystem, GitHub repo, future sources — behind a uniform Reader interface. Consumers fetch a file by path, get back its raw bytes and parsed YAML, and dispatch on a small set of typed errors when something goes wrong.

Status

Foundational. Reader contract + GitHubReader + LocalReader are in place, ported from evennia-world-builder where the pattern was first proven. 15 unit tests green. See docs/progress.md for the running milestone log.

What's in the box

Class Source Use case
GitHubReader GitHub Contents API Production fetch of content committed to a remote repo
LocalReader Local filesystem tree Dev iteration, CI / pre-commit validation, standalone tooling

Both honour the same contract: read(path) returns a ReaderResult with raw_bytes and parsed YAML; failures raise one of ReaderAuthError, ReaderNotFoundError, ReaderNetworkError, or ReaderParseError.

from evennia_yaml_reader import LocalReader

reader = LocalReader(root="/path/to/content")
result = reader.read("subfolder/file.yaml")
print(result.parsed)        # dict / list / scalar / None
print(result.raw_bytes)     # the bytes as they came back from the source
from evennia_yaml_reader import GitHubReader

reader = GitHubReader(repo="owner/content-repo", ref="main", pat="ghp_…")
result = reader.read("subfolder/file.yaml")

The Reader instance is reusable — construct once per source, call read(path) as many times as you need.

Is this for me?

This library is a plumbing dependency — most of its value shows up one layer removed, inside other Evennia-ecosystem libraries that read declarative YAML content, rather than in a gamedir installing it directly. Current examples: evennia-world-builder and evennia-mob-spawner. Each is intended to publish to PyPI the same way this library does; if one hasn't published yet, its GitHub repo linked above is the source in the meantime.

You'd install this library directly if you're building a new Evennia-flavored library that:

  • Wants to keep YAML content in a separate repository (e.g. a content repo distinct from your gamedir).
  • Wants to develop locally against a working copy of that repo and deploy from GitHub in production — without changing call sites.
  • Wants typed errors (not None / empty defaults) when a file is missing, an auth call fails, the network blips, or the YAML is malformed.

If you only ever read YAML from one location with one auth model, open(path) + yaml.safe_load(...) is fine and you do not need this library.

Install

pip install evennia-yaml-reader

Editable install for development against a checkout:

git clone https://github.com/FullCircleMUD/evennia-yaml-reader.git
cd evennia-yaml-reader
python -m venv venv
# Activate the venv (platform-specific)
pip install -e .
python runtests.py

Learn more

License

BSD 3-Clause. See LICENSE.

Release files for evennia-yaml-reader 0.1.0

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

Source distribution (sdist)

Source distribution for evennia-yaml-reader 0.1.0
File Size Uploaded
evennia_yaml_reader-0.1.0.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for evennia-yaml-reader 0.1.0
File Interpreter ABI Platform
evennia_yaml_reader-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.5 kB

Release files / evennia_yaml_reader-0.1.0.tar.gz

Download URL evennia_yaml_reader-0.1.0.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0afccc6c0cbf11eb6eb14e31ddd22f198fe24bcb45c65041307703336524f26d
BLAKE2b-256 checksum
How to use checksums
6a1a3127ed43ce08272c99d8ab317663b01eb4397fc7080fddbcc9bce8f84d1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / evennia_yaml_reader-0.1.0-py3-none-any.whl

Download URL evennia_yaml_reader-0.1.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e798a1d69e523eeb7c6821512546e405c8ef9605030e309ae607c6449cde8fe6
BLAKE2b-256 checksum
How to use checksums
5d81e5c7676a56cd26aabb4969af86b9eb9e25c6d27ae8b4680d4f308e02c9b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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