Skip to main content

A simple yaml serializer and deserializer using Rust.

Project description

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 compatible with PyYAML, and it has a similar design to the json module. Furthermore PyYAML implements version 1.1 of the yaml spec whereas ryaml implements version 1.2 of the spec.

Notable differences between version 1.1 and 1.2 are

  • YAML 1.2 dropped support for several features unquoted Yes, No, On, Off
  • YAML 1.2 no longer accepts strings that start with a 0 and solely consist of number characters as octal, you need to specify such strings with 0o[0-7]+ (zero + lower-case o for octal + one or more octal characters).
  • YAML 1.2 no longer supports sexagesimals <https://en.wikipedia.org/wiki/Sexagesimal>_, so the string scalar 12:34:56 doesn't need quoting.
  • \/ escape for JSON compatibility
  • correct parsing of floating point scalars with exponentials

The hope is this will be used as a safe and fast yaml parser in lieu of PyYAML.

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

pyo3-file

pythonize

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ryaml-0.5.0-cp312-cp312-manylinux_2_28_x86_64.whl (427.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

ryaml-0.5.0-cp312-cp312-manylinux_2_28_aarch64.whl (417.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

ryaml-0.5.0-cp312-cp312-macosx_11_0_arm64.whl (377.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ryaml-0.5.0-cp312-cp312-macosx_10_13_x86_64.whl (387.6 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

ryaml-0.5.0-cp311-cp311-win_arm64.whl (265.0 kB view details)

Uploaded CPython 3.11Windows ARM64

ryaml-0.5.0-cp311-cp311-win_amd64.whl (273.1 kB view details)

Uploaded CPython 3.11Windows x86-64

ryaml-0.5.0-cp311-cp311-manylinux_2_28_x86_64.whl (427.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

ryaml-0.5.0-cp311-cp311-manylinux_2_28_aarch64.whl (418.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

ryaml-0.5.0-cp311-cp311-macosx_11_0_arm64.whl (380.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ryaml-0.5.0-cp311-cp311-macosx_10_12_x86_64.whl (390.8 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

ryaml-0.5.0-cp310-cp310-win_arm64.whl (265.0 kB view details)

Uploaded CPython 3.10Windows ARM64

ryaml-0.5.0-cp310-cp310-win_amd64.whl (273.1 kB view details)

Uploaded CPython 3.10Windows x86-64

ryaml-0.5.0-cp310-cp310-manylinux_2_28_x86_64.whl (427.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

ryaml-0.5.0-cp310-cp310-manylinux_2_28_aarch64.whl (418.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

ryaml-0.5.0-cp310-cp310-macosx_11_0_arm64.whl (380.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

ryaml-0.5.0-cp310-cp310-macosx_10_12_x86_64.whl (391.2 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file ryaml-0.5.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ryaml-0.5.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 14f2236651652ad3c968dcf7320c0310a7de1388dd2ddc5cb3494163e193e49c
MD5 b2312f5bb749248bc7dbb3153af5f517
BLAKE2b-256 efaaa52f68bfbde9fc093e318292246a17ac9801e367722385ca692ff1705f8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ryaml-0.5.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9e4b659b20a2ca1d5ca6c15e0c9b6957fd39a32a67a18ce78af24358232247fa
MD5 e8771a7b77c2a3d09081d7a726dc35f5
BLAKE2b-256 1df4f389108d3e9713b3df758795f15388ef7827775e44b6c7e4ef53c4b34e41

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp312-cp312-manylinux_2_28_aarch64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ryaml-0.5.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8b8c30731781d0b7f533dd9408f87053e6f3f5e16f97a0ebe173b9239f4c8586
MD5 c125df04191c4318b5debd23c0328279
BLAKE2b-256 fc95cacd272bb0552ab5805f614bf6370ae8479342c58c7d97cd6743cb13a36d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for ryaml-0.5.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 14fcc685eda392506a9f1c534d805a8cb71326f257e5a715126466ca448fe8ca
MD5 0b2ad11897115c4e4b47fc04fb7724a9
BLAKE2b-256 b27b0b35b2046e5ed22540a471e15d63c5b623ac8874386dbaacb46b2207b2f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp312-cp312-macosx_10_13_x86_64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp311-cp311-win_arm64.whl.

File metadata

  • Download URL: ryaml-0.5.0-cp311-cp311-win_arm64.whl
  • Upload date:
  • Size: 265.0 kB
  • Tags: CPython 3.11, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ryaml-0.5.0-cp311-cp311-win_arm64.whl
Algorithm Hash digest
SHA256 75604995638d1906056cf4d09917b78dfc9e29e0354006da38fb05195c57a432
MD5 237c7503b0b618c392fc38c69ccca1cf
BLAKE2b-256 ddc9a70114b3bf66772a453b5c5b9c04b3495fe097282b6f71841f0426bf548b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp311-cp311-win_arm64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: ryaml-0.5.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 273.1 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ryaml-0.5.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 eb30c751315df44346a5f8dc0f362e039a5994065263260610982708d05c6946
MD5 d7042727601fbcb3677a1476b785c03d
BLAKE2b-256 e80304f13a072a97804df7b0b11297ecb07e769f7131b119da1ed7b9364a6c02

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp311-cp311-win_amd64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ryaml-0.5.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fe9cf141d7d8cff3824911b4a38e631536f7111a47fef10194b837daacc739e8
MD5 6b5fca967846d46de5ca2c3522f645a4
BLAKE2b-256 7ff8b36dc366bf553cd6805e0539c1c535ae9782d4cc961c35014f9ca459ef9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ryaml-0.5.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b17fa1514f94967526f7d7555fdb75f804964babc7b31c083e6127abf6a1e336
MD5 c37acf959dbcb760617a028c1d83bd91
BLAKE2b-256 94c8b5379c2a68dd1f0d3bcba91caccfe6c67bc870b8209c45ec599e7c5321fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp311-cp311-manylinux_2_28_aarch64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ryaml-0.5.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 64de038053b0bf204efaca09aa0ae4119a5a23fe0573d7938023d8dd78a0edc2
MD5 4bceb621b7febd1c9a1bb55324090acf
BLAKE2b-256 2fa9978772e122fcd869a8fe21f431547a4f67500130027dfc84eaaae9a340e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ryaml-0.5.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 12cd8fc4c486478c0374b40420491d8ca15b4f156e6521ea56824cd5dceb9bfb
MD5 871f41a12ddb59759cb093c017317053
BLAKE2b-256 6bc4864a040ebd5353dfb59357c40dc2b89749a58503e83c07886a8b25235c94

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp311-cp311-macosx_10_12_x86_64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp310-cp310-win_arm64.whl.

File metadata

  • Download URL: ryaml-0.5.0-cp310-cp310-win_arm64.whl
  • Upload date:
  • Size: 265.0 kB
  • Tags: CPython 3.10, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ryaml-0.5.0-cp310-cp310-win_arm64.whl
Algorithm Hash digest
SHA256 58333a5599bab7d067c34d3fadf6ad565c8553ec47b4434644400757ced65f56
MD5 3ce484e821267d99edc1ca965b697d8b
BLAKE2b-256 8511a3319b03e4b1264b29371a618896de440ba47edea4da98f871065a528895

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp310-cp310-win_arm64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: ryaml-0.5.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 273.1 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ryaml-0.5.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 09eb3a65e3270803cd4b674f15dbae95e9797b9a3143c9907d26fd1f25693031
MD5 54910142c42bf58a5d3c8bfbd11283fe
BLAKE2b-256 34bc1a61ec678e097021184f449e6855f531a8d37e57566ec674da641490206f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp310-cp310-win_amd64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ryaml-0.5.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8cfe9d3370c61c0ff681e6b90e5e267516d1c41dc456f57853a89faabdf26df9
MD5 36d0b19767ab7e1279abab02c700f9eb
BLAKE2b-256 8ea5aaa857aa43eaab6a9b21455d190eae9a87f696f133cb784669974928d333

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ryaml-0.5.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2c3c92955ebe1b8129e0b2ae28d60ec35ffc3e040ed5d52b7a31adf52251215f
MD5 ee6a7f091e93fc4b3bb88bb0ee478a0d
BLAKE2b-256 f9349cca2709138b98191a3948c4dfda7ac59c4a56720c9771ed1d5342331fb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp310-cp310-manylinux_2_28_aarch64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ryaml-0.5.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a5d211cc5f5772b0ddd145f019b3ad893d780297be31c679060aa962f3741e3e
MD5 6c863c29e8b02d3c1f48ee80ecf5d915
BLAKE2b-256 0907094b779f5f4e3b51ebc3b1e4eb87f9e9e834ff6d02a7fb44872e5cad36a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryaml-0.5.0-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ryaml-0.5.0-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0f7a63025a0ae44abd8672f18882809f41e5d5e08f39b8dd4ac4e8a663ce0456
MD5 5669f5553525a3d3074ee041fded3dbe
BLAKE2b-256 640a7aff4fe4e81f2effe9343655e23add4443efd154439e2c381a0b4926a150

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryaml-0.5.0-cp310-cp310-macosx_10_12_x86_64.whl:

Publisher: main.yaml on emmatyping/ryaml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page