Skip to main content

astral-yaml for Python

astral_yaml reads and writes YAML 1.2 on CPython 3.11 and newer.

Reading YAML

The loader uses the YAML 1.2 core schema. In this configuration, the port numbers become Python integers and the unquoted word on stays a string.

import astral_yaml as yaml

config = yaml.loads("ports: [80, 443]\nmode: on")
assert config == {"ports": [80, 443], "mode": "on"}

load and loads accept at most one document per call. Empty or comment-only input returns None. A second document raises yaml.YAMLError.

Use load_all for an open text or binary file and loads_all for a string or encoded bytes. Both return a list in document order. An empty or comment-only stream gives [], and an explicit empty document contributes None. An error in any document raises during the call.

configs = yaml.loads_all("---\nmode: on\n---\nports: [80, 443]\n")
assert configs == [{"mode": "on"}, {"ports": [80, 443]}]

Mapping keys must be scalars and must stay unique when converted to Python. For example, {true: first, 1: second} raises yaml.YAMLError because True == 1 in Python.

Writing YAML

Add a port and save the configuration. dumps shows the same flow-style YAML that dump writes to the file.

config["ports"].append(8080)
assert yaml.dumps(config) == '{"ports": [80, 443, 8080], "mode": "on"}\n'

with open("config.yaml", "w", encoding="utf-8") as file:
    yaml.dump(config, file)

# In binary mode, load detects UTF-8, UTF-16, or UTF-32.
with open("config.yaml", "rb") as file:
    assert yaml.load(file) == config

Tuples serialize as sequences and load back as lists. If two dictionary entries share a list, the dumper uses a YAML alias so the entries still share a list when you read them back. Aliases also preserve cycles.

Errors

  • YAML errors. Invalid YAML, unsupported tags, and resource limits (including Python's digit limit for decimal integers) raise yaml.YAMLError. Parse errors report byte offsets in the original encoding for binary input and in UTF-8 for text.
  • Unsupported Python values. The dumper accepts None and exact instances of bool, int, float, str, list, tuple, and dict. Other types raise TypeError.
  • I/O errors. Exceptions from the file's read or write method propagate to the caller.

Metadata

Release files for astral-yaml 0.0.5

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

Source distribution (sdist)

Source distribution for astral-yaml 0.0.5
File Size Uploaded Provenance Actions
astral_yaml-0.0.5.tar.gz 889.5 kB With provenance Details for astral_yaml-0.0.5.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for astral-yaml 0.0.5
File Actions
astral_yaml-0.0.5-cp311-abi3-win_arm64.whl CPython 3.11 abi3 Windows ARM64 Details for astral_yaml-0.0.5-cp311-abi3-win_arm64.whl
astral_yaml-0.0.5-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for astral_yaml-0.0.5-cp311-abi3-win_amd64.whl
astral_yaml-0.0.5-cp311-abi3-manylinux_2_34_x86_64.whl CPython 3.11 abi3 Linux glibc 2.34+ x86-64 Details for astral_yaml-0.0.5-cp311-abi3-manylinux_2_34_x86_64.whl
astral_yaml-0.0.5-cp311-abi3-manylinux_2_34_aarch64.whl CPython 3.11 abi3 Linux glibc 2.34+ ARM64 Details for astral_yaml-0.0.5-cp311-abi3-manylinux_2_34_aarch64.whl
astral_yaml-0.0.5-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for astral_yaml-0.0.5-cp311-abi3-macosx_11_0_arm64.whl
astral_yaml-0.0.5-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for astral_yaml-0.0.5-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 2.9 MB

Release files / astral_yaml-0.0.5.tar.gz

Download URL astral_yaml-0.0.5.tar.gz
Size 889.5 kB
Tags Source
SHA-256 checksum
How to use checksums
36759bee21a5fa2cedc8017b767d4fceaa4b91247932de526afc9cb425c28692
BLAKE2b-256 checksum
How to use checksums
db1a4da1565aa85664c988fa81b09d7d08d34352c30f407ad294d12a2ba494fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Nov 17, 2026.

Transparency log

Release files / astral_yaml-0.0.5-cp311-abi3-win_arm64.whl

Download URL astral_yaml-0.0.5-cp311-abi3-win_arm64.whl
Size 254.1 kB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
951bd1f4235852d52a86f20e4627147432586a0fe048c1d74290cf9fb39896b1
BLAKE2b-256 checksum
How to use checksums
3ae4e0d9796c1a09177d7856313f705c9e0f30c70f8ea6d6e465b0f53ce7df22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Nov 17, 2026.

Transparency log

Release files / astral_yaml-0.0.5-cp311-abi3-win_amd64.whl

Download URL astral_yaml-0.0.5-cp311-abi3-win_amd64.whl
Size 264.4 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d0a6e34e87962efde5a7f9f538d4fc30938d831b1ccf3e3b86ba6f9815f77809
BLAKE2b-256 checksum
How to use checksums
026afebc0a79651a835944ab7c9092fb79e6c257fb04fe825b58f2e869faa5aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Nov 17, 2026.

Transparency log

Release files / astral_yaml-0.0.5-cp311-abi3-manylinux_2_34_x86_64.whl

Download URL astral_yaml-0.0.5-cp311-abi3-manylinux_2_34_x86_64.whl
Size 393.0 kB
Tags CPython 3.11 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
e1de2363bf36fc8e4a1f5d98f3d9ad4b70c09025abec77ff7967e9eeb1af0e12
BLAKE2b-256 checksum
How to use checksums
328fbda9d559c6242fa26e39fea9e6ae2d33fb01f478a6812b0bdf1d71c667bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Nov 17, 2026.

Transparency log

Release files / astral_yaml-0.0.5-cp311-abi3-manylinux_2_34_aarch64.whl

Download URL astral_yaml-0.0.5-cp311-abi3-manylinux_2_34_aarch64.whl
Size 374.9 kB
Tags CPython 3.11 Linux glibc 2.34+ ARM64 abi3
SHA-256 checksum
How to use checksums
13ebb515a6a8682c596181f7b82f56a16ff11efeb9f01b4d19a17dad6f8488fd
BLAKE2b-256 checksum
How to use checksums
be5000e0b3dc2d62ea632b30259656f60629238463be371ef33ef7b84dca29cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Nov 17, 2026.

Transparency log

Release files / astral_yaml-0.0.5-cp311-abi3-macosx_11_0_arm64.whl

Download URL astral_yaml-0.0.5-cp311-abi3-macosx_11_0_arm64.whl
Size 351.5 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a9de3269f5dbf315b33dc8e6ece575a6670a48443cbf1a90df6a9a7406153c28
BLAKE2b-256 checksum
How to use checksums
f0918a32ce80d267dd0af5575b61a3eb6613c5394b5161d81d9b2d8abc0895d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Nov 17, 2026.

Transparency log

Release files / astral_yaml-0.0.5-cp311-abi3-macosx_10_12_x86_64.whl

Download URL astral_yaml-0.0.5-cp311-abi3-macosx_10_12_x86_64.whl
Size 370.5 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3fb723ddb89965f5cd4208cc648259c40c001d9e9057c8ed9b02efb7e15e49dc
BLAKE2b-256 checksum
How to use checksums
d536cf270e70ad3c4833d9d67163818f7c3b48ca1b1ea2f2e6fe7c7ae6ae1ea7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 Nov 17, 2026.

Transparency log

Security for astral-yaml 0.0.5

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.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for astral_yaml-0.0.5.tar.gz

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 Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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