ryaml 0.5.1


pip install ryaml

  Latest version

Released: Feb 04, 2026


Meta
Author: Emma Harper Smith
Requires Python: >=3.10, <4

Classifiers

Programming Language
  • Python
  • Rust
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14

Development Status
  • 3 - Alpha

Operating System
  • Microsoft :: Windows
  • POSIX :: Linux
  • MacOS

Typing
  • Typed

ryaml

Quickly and safely parse yaml

What is ryaml?

ryaml is a Python library that wraps a Rust yaml parser, serde-yaml, to quickly and safely parse and dump yaml to and from Python objects.

It is not fully compatible with PyYAML, and it has a similar design to the json module. The hope is this will be used as a safe and fast yaml parser in lieu of PyYAML.

Like PyYAML, this library implements the YAML 1.1 specification.

Installation

We ship binary wheels for Windows, Linux, and macOS, so as long as you are using Python 3.10+, you can run:

$ python -m pip install ryaml

Otherwise, you will need to build from source. To do so, first install Rust 1.41 stable.

Then you should be able to just

$ git clone https://github.com/emmatyping/ryaml
$ cd ryaml
$ python -m pip install .

Or if you want to build a wheel:

$ git clone https://github.com/emmatyping/ryaml
$ cd ryaml
$ python -m pip install maturin
$ maturin build --release --no-sdist
# OR if you want an abi3 wheel (compatible with Python 3.10+)
$ maturin build --release --no-sdist --cargo-extra-args="--features=abi3"

And a wheel will be created in target/wheels which you can install.

Usage

The API of ryaml is very similar to that of json in the standard library:

You can use ryaml.loads to read from a str:

import ryaml
obj = ryaml.loads('key: [10, "hi"]')
assert isinstance(obj, dict) # True
assert obj['key'][1] == "hi" # True

And ryaml.dumps to dump an object into a yaml file:

import ryaml
s = ryaml.dumps({ 'key' : None })
print(s)
# prints:
# ---
# key: ~

There are also ryaml.load and ryaml.load_all to read yaml document(s) from files:

import ryaml
obj = {'a': [{'b': 1}]}
with open('test.yaml', 'w') as w:
    ryaml.dump(w, obj)
with open('test.yaml', 'r') as r:
    assert ryaml.load(r) == obj
with open('multidoc.yaml', 'w') as multi:
    multi.write('''
---
a:
  key:
...
---
b:
  key:
    ''')
with open('multidoc.yaml', 'r') as multi:
    docs = ryaml.load_all(multi)
assert len(docs) == 2
assert docs[0]['a']['key'] is None

ryaml.load_all will, as seen above, load multiple documents from a single file.

Thanks

This project is standing on the shoulders of giants, and would not be possible without:

pyo3

serde-yaml

yaml-rust

pythonize

Wheel compatibility matrix

Platform CPython 3.10 CPython 3.11 CPython 3.12 CPython 3.13 CPython 3.14 CPython (additional flags: t) 3.14
macosx_10_12_x86_64
macosx_10_13_x86_64
macosx_10_15_x86_64
macosx_11_0_arm64
manylinux_2_28_aarch64
manylinux_2_28_x86_64
win_amd64
win_arm64

Files in release

ryaml-0.5.1-cp310-cp310-macosx_10_12_x86_64.whl (360.3KiB)
ryaml-0.5.1-cp310-cp310-macosx_11_0_arm64.whl (350.9KiB)
ryaml-0.5.1-cp310-cp310-manylinux_2_28_aarch64.whl (386.5KiB)
ryaml-0.5.1-cp310-cp310-manylinux_2_28_x86_64.whl (398.4KiB)
ryaml-0.5.1-cp310-cp310-win_amd64.whl (249.6KiB)
ryaml-0.5.1-cp310-cp310-win_arm64.whl (241.5KiB)
ryaml-0.5.1-cp311-cp311-macosx_10_12_x86_64.whl (359.9KiB)
ryaml-0.5.1-cp311-cp311-macosx_11_0_arm64.whl (350.6KiB)
ryaml-0.5.1-cp311-cp311-manylinux_2_28_aarch64.whl (386.4KiB)
ryaml-0.5.1-cp311-cp311-manylinux_2_28_x86_64.whl (398.3KiB)
ryaml-0.5.1-cp311-cp311-win_amd64.whl (249.7KiB)
ryaml-0.5.1-cp311-cp311-win_arm64.whl (241.5KiB)
ryaml-0.5.1-cp312-cp312-macosx_10_13_x86_64.whl (358.2KiB)
ryaml-0.5.1-cp312-cp312-macosx_11_0_arm64.whl (347.8KiB)
ryaml-0.5.1-cp312-cp312-manylinux_2_28_aarch64.whl (386.8KiB)
ryaml-0.5.1-cp312-cp312-manylinux_2_28_x86_64.whl (398.4KiB)
ryaml-0.5.1-cp312-cp312-win_amd64.whl (250.0KiB)
ryaml-0.5.1-cp312-cp312-win_arm64.whl (241.5KiB)
ryaml-0.5.1-cp313-cp313-macosx_10_13_x86_64.whl (358.3KiB)
ryaml-0.5.1-cp313-cp313-macosx_11_0_arm64.whl (348.0KiB)
ryaml-0.5.1-cp313-cp313-manylinux_2_28_aarch64.whl (386.6KiB)
ryaml-0.5.1-cp313-cp313-manylinux_2_28_x86_64.whl (398.6KiB)
ryaml-0.5.1-cp313-cp313-win_amd64.whl (250.2KiB)
ryaml-0.5.1-cp313-cp313-win_arm64.whl (242.0KiB)
ryaml-0.5.1-cp314-cp314-macosx_10_15_x86_64.whl (359.2KiB)
ryaml-0.5.1-cp314-cp314-macosx_11_0_arm64.whl (348.5KiB)
ryaml-0.5.1-cp314-cp314-manylinux_2_28_aarch64.whl (387.1KiB)
ryaml-0.5.1-cp314-cp314-manylinux_2_28_x86_64.whl (398.8KiB)
ryaml-0.5.1-cp314-cp314-win_amd64.whl (250.7KiB)
ryaml-0.5.1-cp314-cp314-win_arm64.whl (241.9KiB)
ryaml-0.5.1-cp314-cp314t-macosx_10_15_x86_64.whl (357.5KiB)
ryaml-0.5.1-cp314-cp314t-macosx_11_0_arm64.whl (346.9KiB)
ryaml-0.5.1-cp314-cp314t-manylinux_2_28_aarch64.whl (385.7KiB)
ryaml-0.5.1-cp314-cp314t-manylinux_2_28_x86_64.whl (398.1KiB)
ryaml-0.5.1-cp314-cp314t-win_amd64.whl (250.2KiB)
ryaml-0.5.1-cp314-cp314t-win_arm64.whl (240.7KiB)
ryaml-0.5.1.tar.gz (10.0KiB)
No dependencies