Registry / serialization / poyo
library0.5.0pypypi✓ verified 87d ago

Poyo is a lightweight YAML parser for Python (current version 0.5.0). It focuses on parsing a chosen subset of the YAML format, primarily designed for configuration files like those used by cookiecutter. It explicitly does not support deserialization of arbitrary Python objects, YAML serialization, or JSON compatibility. The project is in maintenance mode with infrequent updates, with the last release in July 2019, but it remains functional for its intended scope.

pip install poyo
INSTALL
IMPORT
SIG · POYO
P
poyo
serializationpythonv0.5.0
Install
1.5s avg
Import
27ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.029s · 17.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.5s · import 0.026s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse_string
from poyo import parse_string
Main function to parse a YAML string into a Python dictionary.
PoyoException
from poyo import PoyoException
Custom exception raised for parsing errors.

Parses a simple YAML string using `parse_string` and demonstrates basic type conversion and multiline string handling, with error handling for parsing issues.

from poyo import parse_string, PoyoException yaml_string = """ default_context: greeting: Hello is_enabled: true count: 123 items: - apple - banana - null long_description: > This is a multiline string. It demonstrates how to handle text blocks introduced in 0.5.0. """ try: config = parse_string(yaml_string) print(config) # Expected output similar to: # { # 'default_context': { # 'greeting': 'Hello', # 'is_enabled': True, # 'count': 123, # 'items': ['apple', 'banana', None] # }, # 'long_description': 'This is a multiline string. It demonstrates how to handle text blocks introduced in 0.5.0.' # } except PoyoException as e: print(f"Error parsing YAML: {e}")
Debug
Known issues
gotchaPoyo only supports a *subset* of the YAML specification. It does not support arbitrary Python object deserialization, YAML serialization, or compatibility with JSON. Attempting to use advanced YAML features (e.g., anchors, tags, complex mappings) will likely result in parsing errors.
fix
Ensure your YAML adheres to the basic structure supported by Poyo (scalars, lists, dictionaries). For full YAML specification support, consider libraries like PyYAML.
affects: All versions
gotchaThe `~` character (YAML's representation for null) was not correctly recognized as `None` in Python before version 0.3.0, leading to unexpected string values.
fix
Upgrade to `poyo>=0.3.0` to ensure `~` is correctly parsed as `None`.
affects: <0.3.0
gotchaEarlier versions had bugs with parsing list items that included comments or blank lines, leading to incorrect or incomplete data structures.
fix
Upgrade to `poyo>=0.4.2` to resolve issues with lists containing comments and blank lines.
affects: <0.4.2
gotchaMultiline strings using the `>` or `|` block scalar indicators are only supported in version 0.5.0 and later.
fix
Upgrade to `poyo>=0.5.0` to use multiline string features. For older versions, represent long strings as single-line quoted strings.
affects: <0.5.0
Errors
Common errors & fixes
poyo.PoyoException: Error parsing YAML: Line ... Column ...: Expected a mapping or sequence start
Attempting to parse YAML that uses features outside of Poyo's supported subset (e.g., YAML tags, anchors/aliases, or malformed syntax).
fix
Review the YAML content and simplify it to basic key-value pairs, lists, and scalars. If advanced YAML features are required, switch to a full-featured YAML parser like `PyYAML`.
KeyError: 'some_key' or AttributeError: 'NoneType' object has no attribute 'get'
A YAML `null` value (represented by `~` or `null`) was not parsed as Python's `None`, but as a string, or a key was expected but not found due to a parsing error in older versions.
fix
This often occurs in older versions of poyo. Ensure you are using `poyo>=0.3.0` to correctly handle `null` values. Also, verify that your YAML structure matches the expected Python dictionary access path.
Error parsing YAML: Line ... Column ...: Could not parse scalar
This error can occur when Poyo encounters unexpected characters or structures, such as unquoted strings containing special characters or improper indentation, especially in older versions when list/comment handling was less robust.
fix
Check for correct YAML indentation and ensure all strings with special characters or spaces are properly quoted. Consider upgrading to the latest Poyo version (`0.5.0`) as several parsing bugs were fixed in later releases.
Upgrade
Version history
0.5.0latest on PyPI · released Jul 26, 2019
Audit
Dependencies
pythonrequiredRuntime environment
Agent activity
11 hits · last 30 days
node
10
Resources
poyo — pip install poyo · libregistry