Source-agnostic YAML file reader for declarative-content libraries in the Evennia ecosystem.
Project description
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
- CLAUDE.md — load-bearing principles and orientation for working in the repository.
- docs/INDEX.md — index of design documents.
- docs/reader-api.md — the architectural decisions behind the
Readercontract. - src/evennia_yaml_reader/base.md —
ReaderandReaderResultreference, co-located with the code.
License
BSD 3-Clause. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file evennia_yaml_reader-0.1.0.tar.gz.
File metadata
- Download URL: evennia_yaml_reader-0.1.0.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0afccc6c0cbf11eb6eb14e31ddd22f198fe24bcb45c65041307703336524f26d
|
|
| MD5 |
23b6a09eaa706d15e3c9de0a7cbb4108
|
|
| BLAKE2b-256 |
6a1a3127ed43ce08272c99d8ab317663b01eb4397fc7080fddbcc9bce8f84d1d
|
File details
Details for the file evennia_yaml_reader-0.1.0-py3-none-any.whl.
File metadata
- Download URL: evennia_yaml_reader-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e798a1d69e523eeb7c6821512546e405c8ef9605030e309ae607c6449cde8fe6
|
|
| MD5 |
c79d49ce18e2f70468eb49c85bb10ee3
|
|
| BLAKE2b-256 |
5d81e5c7676a56cd26aabb4969af86b9eb9e25c6d27ae8b4680d4f308e02c9b5
|