Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

plain-parser

Python parser for ***plain specification files.

Reads a .plain module and its import / requires chain, resolves Liquid templates, validates concepts and linked resources, and returns the marshalled specification tree plus the ordered list of functionalities (FRIDs).

Install

pip install plain-parser

Command line

plain-parser check <file.plain> [--template-dir DIR] [--config-name NAME]
plain-parser parse <file.plain> [--template-dir DIR] [--config-name NAME]

Both commands parse the module and its requires chain, check that every linked resource is an existing file (not a directory), and walk the module's functionalities. They stop at the first error.

check

Validates the module. In addition to the steps above it reads every linked file and rejects binary files and files holding a large base64 blob.

$ plain-parser check my_spec.plain
my_spec.plain: OK

Exit 0 when the module is valid. On an error, Error: … is written to stderr and the exit code is 1.

parse

Prints the parse result as one UTF-8 JSON document on stdout. Linked files are located but not read.

$ plain-parser parse my_spec.plain
{
  "format_version": 1,
  "modules": [{"module": "...", "tree": {...}}, ...],
  "resources": {...}
}
  • format_version: 1.
  • modules: every module in the requires chain, in build order: deepest ancestor first, the module itself last. Each entry has the module name and its specification tree, in the shape described under Python below.
  • resources: every linked-resource target in the chain, as written in the spec, mapped to the path it resolves to, relative to the entry module's directory, with / as separator: notes.md when found next to the module, ../tpl/notes.md when found in a template directory. The directory part is lexical (symlinks not resolved) and the target is appended as written (.. kept), so joining the value onto the entry module's directory names the file the parser matched. When no relative path exists (another drive on Windows) the value is the absolute path, still with /. Two spellings of one file (notes.md, ./notes.md) are two keys.

Exit 0 on success. On a parser error the JSON is {"format_version": 1, "type": "<error class>", "message": "…"} and the exit code is 1.

Options and exit codes

Modules and {% include %} templates are looked up in the .plain file's directory, then in --template-dir. When --template-dir is not given, it is read from the template-dir key of config.yaml (or the file named by --config-name), found next to the .plain file or in the working directory. Finding it in both is a usage error. The config file is read even when --template-dir is given, so a malformed one fails the run either way. Other config keys are ignored.

Exit code Meaning
0 Success
1 The module, its chain, or a linked resource is invalid
2 Usage error, including an ambiguous or malformed config file
130 Interrupted

Python

from plain_parser import plain_file_parser

module_name, plain_source_tree, required_modules = plain_file_parser("my_spec.plain", ["."])

plain_source_tree is a dict keyed by section (definitions, implementation reqs, test reqs, functional specs), each a list of {"markdown": ..., "linked_resources": [...]} entries. plain_parser.plain_spec has helpers for walking functionalities (get_frids, get_specifications_for_frid, collect_linked_resources).

Development

uv venv --python 3.11 && source .venv/bin/activate
uv pip install -e ".[dev]"
pytest
black . --check && isort . --check-only && flake8 . && mypy src

License

MIT, see LICENSE.

Metadata

Release files for plain-parser 0.1.4.dev10

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

Source distribution (sdist)

Source distribution for plain-parser 0.1.4.dev10
File Size Uploaded
plain_parser-0.1.4.dev10.tar.gz 87.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for plain-parser 0.1.4.dev10
File Interpreter ABI Platform
plain_parser-0.1.4.dev10-py3-none-any.whl Python 3 none any Details

Total release size: 118.2 kB

Release files / plain_parser-0.1.4.dev10.tar.gz

Download URL plain_parser-0.1.4.dev10.tar.gz
Size 87.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ecfc2d718f36694f6971e7d625259073ec91fc1b8ea3e90f5be54ceccd74bd1c
BLAKE2b-256 checksum
How to use checksums
e3f9db00dfb6b5b632667ca296b29239f7ea1a2fe8eeda0cd8206a66defd2e65
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 / plain_parser-0.1.4.dev10-py3-none-any.whl

Download URL plain_parser-0.1.4.dev10-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c377bb7f4d2501ed091965492ccfa675616015c9c7377edff8f792f8a654735
BLAKE2b-256 checksum
How to use checksums
185630ff7806ac76482b5a8a519bd4e0eafc3987122a20c47c84f407924be1b7
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
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