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.
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
Noneand exact instances ofbool,int,float,str,list,tuple, anddict. Other types raiseTypeError. - I/O errors. Exceptions from the file's
readorwritemethod propagate to the caller.
Metadata
Release files for astral-yaml 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| astral_yaml-0.0.4.tar.gz | 879.4 kB | Without provenance | Details for astral_yaml-0.0.4.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| astral_yaml-0.0.4-cp311-abi3-win_arm64.whl | CPython 3.11 | abi3 | Windows ARM64 | Details for astral_yaml-0.0.4-cp311-abi3-win_arm64.whl |
| astral_yaml-0.0.4-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for astral_yaml-0.0.4-cp311-abi3-win_amd64.whl |
| astral_yaml-0.0.4-cp311-abi3-manylinux_2_34_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.34+ x86-64 | Details for astral_yaml-0.0.4-cp311-abi3-manylinux_2_34_x86_64.whl |
| astral_yaml-0.0.4-cp311-abi3-manylinux_2_34_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.34+ ARM64 | Details for astral_yaml-0.0.4-cp311-abi3-manylinux_2_34_aarch64.whl |
| astral_yaml-0.0.4-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for astral_yaml-0.0.4-cp311-abi3-macosx_11_0_arm64.whl |
| astral_yaml-0.0.4-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details for astral_yaml-0.0.4-cp311-abi3-macosx_10_12_x86_64.whl |
Total release size: 2.9 MB
Release files / astral_yaml-0.0.4.tar.gz
| Download URL | astral_yaml-0.0.4.tar.gz |
|---|---|
| Size | 879.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ded08869e51486a668c5360a4c234d250fc0a730df08a720b060e194b861e965
|
|
BLAKE2b-256 checksum How to use checksums |
11853caee64baab315f7bb83cc337abd45e08e1382f7a56bf4f1c07c86681325
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","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}
|
Release files / astral_yaml-0.0.4-cp311-abi3-win_arm64.whl
| Download URL | astral_yaml-0.0.4-cp311-abi3-win_arm64.whl |
|---|---|
| Size | 254.3 kB |
| Tags | CPython 3.11 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
2690392095c54cddaae822bec9b7f07e5922004e1516a1ba90863f1e8aabe963
|
|
BLAKE2b-256 checksum How to use checksums |
4d70bec0039797d7b5fd608c6ce8b033909590344f98ec9f8fce8968c57c7eb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","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}
|
Release files / astral_yaml-0.0.4-cp311-abi3-win_amd64.whl
| Download URL | astral_yaml-0.0.4-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 261.3 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b439b04b15bba508065023b21207a218dde643b60cb5667826da4a779c430797
|
|
BLAKE2b-256 checksum How to use checksums |
1494175fdd5848b60b182d825f1f4e42d1f414ee9c520e0e94ee1aeafbbe8475
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","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}
|
Release files / astral_yaml-0.0.4-cp311-abi3-manylinux_2_34_x86_64.whl
| Download URL | astral_yaml-0.0.4-cp311-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 380.0 kB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
34b575d7801e2d866f1a7731735fa047c1faa879571781f8ca85ea5618c84e3d
|
|
BLAKE2b-256 checksum How to use checksums |
24fe9f18dc50d45a181347b22c72abc8138c5f08c0849009f20b837274aeee95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","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}
|
Release files / astral_yaml-0.0.4-cp311-abi3-manylinux_2_34_aarch64.whl
| Download URL | astral_yaml-0.0.4-cp311-abi3-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 375.5 kB |
| Tags | CPython 3.11 Linux glibc 2.34+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
ea89fc183bee50ec0e3ab26c81dafaf1a87d8e3818dfec1e6df5b08423224c0d
|
|
BLAKE2b-256 checksum How to use checksums |
0ff9dc2685e86a4d0cbf1147589b1198a6d166fa87c9b48113e5f0f151e3beda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","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}
|
Release files / astral_yaml-0.0.4-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | astral_yaml-0.0.4-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 352.1 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ee72be5413c1134d6226d88946f92abb95f4ef86e6823a6ce7ed79c98cc59dec
|
|
BLAKE2b-256 checksum How to use checksums |
fde880ac8a0c01a2571b69706544bdc1d3f5eb5ed702e8d056a8792ab5cfe998
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","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}
|
Release files / astral_yaml-0.0.4-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | astral_yaml-0.0.4-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 357.6 kB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
45dc121908fd9475e19e6cf09b32fcd3a470dc29114d4dd3d85bc9b07b37598d
|
|
BLAKE2b-256 checksum How to use checksums |
0236f08ea073a5a7cee19c1b163b30554ca91061c2217919a31e0e70b9e0292c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","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}
|
Security for astral-yaml 0.0.4
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.