A YAML round-trip library that preserves comments and insertion order
Project description
yarutsk
⚠ AI-authored. This library — design, implementation, tests, and documentation — was written by Claude Code (Anthropic) under human direction.
A Python YAML library that round-trips documents while preserving comments, insertion order, scalar styles, tags, anchors and aliases, blank lines, and explicit document markers.
Full documentation: https://theyugin.github.io/yarutsk/
Quick start
pip install yarutsk
import io
import yarutsk
doc = yarutsk.load(io.StringIO("""
# database config
host: localhost # primary
port: 5432
"""))
doc["port"] = 5433
out = io.StringIO()
yarutsk.dump(doc, out)
print(out.getvalue())
# # database config
# host: localhost # primary
# port: 5433
YamlMapping subclasses dict and YamlSequence subclasses list, so they work everywhere a dict or list is expected — isinstance(doc, dict), json.dumps(doc), and any library accepting plain mappings or sequences.
Python 3.12+ required. Pre-built wheels for Linux / macOS / Windows on x86_64 and aarch64.
What's preserved
- Scalar styles — plain,
'single',"double", literal|, folded> - Non-canonical scalars —
yes/no/on/off,~,0xFF,0o77reproduced as written - YAML tags —
!!str,!!binary,!!timestamp, and any custom tag - Anchors and aliases —
&name/*nameround-trip intact - Blank lines between entries and explicit document markers (
---,...)
Comparison
| Feature | yarutsk | ruamel.yaml | PyYAML |
|---|---|---|---|
| Comments preserved | Yes | Yes | No |
| Scalar styles preserved | Yes | Partial | No |
| Insertion order preserved | Yes | Yes | No |
| Blank lines preserved | Yes | Partial | No |
| Tags preserved | Yes | Yes | No |
| Anchors/aliases preserved | Yes | Yes | No |
dict / list subclasses |
Yes | No | No |
| Rust speed | Yes | No | No |
yarutsk focuses on round-trip fidelity: edit a config file and emit it back without touching the formatting. ruamel.yaml offers similar fidelity in pure Python. PyYAML is faster for load-only workloads where output formatting doesn't matter.
Documentation
Everything — the full API, type conversions, Schema and library integrations (pydantic / msgspec / cattrs), error handling, thread safety, and limitations — lives at https://theyugin.github.io/yarutsk/.
Direct links:
- Installation
- API reference
- Library integrations
- Round-trip fidelity
- Error handling
- Thread safety
- Limitations
- Changelog
- Contributing
Benchmarks
Compare load, dump, and round-trip performance against PyYAML and ruamel.yaml:
make bench
License
MIT. The scanner and parser are vendored from yaml-rust2 (also MIT) with one targeted modification: the comment-skipping loop now emits Comment tokens instead of discarding them.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yarutsk-0.7.1.tar.gz.
File metadata
- Download URL: yarutsk-0.7.1.tar.gz
- Upload date:
- Size: 226.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc2ea3aa829669ab1db6cd43042c26e38e21c8e42213ebe8905a4e55bdfc5c85
|
|
| MD5 |
ef0ac9504d36b9ffa83fa246038070aa
|
|
| BLAKE2b-256 |
30250006635b97c972adee30a366f9f9d21ec1e945b463098f1c147d0f0a4ffa
|
Provenance
The following attestation bundles were made for yarutsk-0.7.1.tar.gz:
Publisher:
ci.yml on theyugin/yarutsk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yarutsk-0.7.1.tar.gz -
Subject digest:
dc2ea3aa829669ab1db6cd43042c26e38e21c8e42213ebe8905a4e55bdfc5c85 - Sigstore transparency entry: 1355742806
- Sigstore integration time:
-
Permalink:
theyugin/yarutsk@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Branch / Tag:
refs/tags/v0.7.1 - Owner: https://github.com/theyugin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yarutsk-0.7.1-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: yarutsk-0.7.1-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 549.1 kB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb2b556b91c90dd0c50f3ae3007302bc0e53f4133668ce7d531f16f3aba669e4
|
|
| MD5 |
7b019fd00f414ca1a4a62664d959d5f8
|
|
| BLAKE2b-256 |
40a0407499ddae582e76fe2860acaf3f17a71e2206552e875d180f0260f1ec58
|
Provenance
The following attestation bundles were made for yarutsk-0.7.1-cp314-cp314-win_amd64.whl:
Publisher:
ci.yml on theyugin/yarutsk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yarutsk-0.7.1-cp314-cp314-win_amd64.whl -
Subject digest:
eb2b556b91c90dd0c50f3ae3007302bc0e53f4133668ce7d531f16f3aba669e4 - Sigstore transparency entry: 1355742915
- Sigstore integration time:
-
Permalink:
theyugin/yarutsk@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Branch / Tag:
refs/tags/v0.7.1 - Owner: https://github.com/theyugin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yarutsk-0.7.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: yarutsk-0.7.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 672.1 kB
- Tags: CPython 3.14, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d137ecc50d73498be16dffe9d7374c3d42f2e60dcea30788aa807246fc3facfe
|
|
| MD5 |
c31f56a23f918618ebd9bdfde24aeea2
|
|
| BLAKE2b-256 |
cfbb12b3a293f6d11ed8b9aa8cc3fc2e47583dad0cd501fe1f66beb54b4abb44
|
Provenance
The following attestation bundles were made for yarutsk-0.7.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
ci.yml on theyugin/yarutsk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yarutsk-0.7.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
d137ecc50d73498be16dffe9d7374c3d42f2e60dcea30788aa807246fc3facfe - Sigstore transparency entry: 1355742896
- Sigstore integration time:
-
Permalink:
theyugin/yarutsk@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Branch / Tag:
refs/tags/v0.7.1 - Owner: https://github.com/theyugin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yarutsk-0.7.1-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: yarutsk-0.7.1-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.14, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e58e42f19292d436554aabcd06fe46bb1d06afcd66bf3d2c0cbe524411982a6c
|
|
| MD5 |
a1ce4791108c4883e719d45e5ba12aeb
|
|
| BLAKE2b-256 |
906af3afa0670a81f2f914a7c02db5e685d58282847d1d76e5350d520a776cec
|
Provenance
The following attestation bundles were made for yarutsk-0.7.1-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:
Publisher:
ci.yml on theyugin/yarutsk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yarutsk-0.7.1-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl -
Subject digest:
e58e42f19292d436554aabcd06fe46bb1d06afcd66bf3d2c0cbe524411982a6c - Sigstore transparency entry: 1355742876
- Sigstore integration time:
-
Permalink:
theyugin/yarutsk@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Branch / Tag:
refs/tags/v0.7.1 - Owner: https://github.com/theyugin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yarutsk-0.7.1-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: yarutsk-0.7.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 552.1 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63f44d5ab219777f951bbbc62dfbe69f8d43783507348804a9d4a963917aa3e7
|
|
| MD5 |
b015f0e2c760531b9d911245afa0a4bc
|
|
| BLAKE2b-256 |
a209255a12eb489653a01c45c6d1a5ed6abcf71bf46ef691718cbc1ae34bde47
|
Provenance
The following attestation bundles were made for yarutsk-0.7.1-cp313-cp313-win_amd64.whl:
Publisher:
ci.yml on theyugin/yarutsk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yarutsk-0.7.1-cp313-cp313-win_amd64.whl -
Subject digest:
63f44d5ab219777f951bbbc62dfbe69f8d43783507348804a9d4a963917aa3e7 - Sigstore transparency entry: 1355742827
- Sigstore integration time:
-
Permalink:
theyugin/yarutsk@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Branch / Tag:
refs/tags/v0.7.1 - Owner: https://github.com/theyugin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yarutsk-0.7.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: yarutsk-0.7.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 675.0 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81fa857336efb592fce9e527590c1d046998ab50c1531e0bbf99608023d934b3
|
|
| MD5 |
05027d7688b60ef4c01bed0a802f6b73
|
|
| BLAKE2b-256 |
39e8f536f9ff5af2be863795e4e73a6873432a3f9c23346a1ec0c75c532d4edb
|
Provenance
The following attestation bundles were made for yarutsk-0.7.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
ci.yml on theyugin/yarutsk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yarutsk-0.7.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
81fa857336efb592fce9e527590c1d046998ab50c1531e0bbf99608023d934b3 - Sigstore transparency entry: 1355742815
- Sigstore integration time:
-
Permalink:
theyugin/yarutsk@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Branch / Tag:
refs/tags/v0.7.1 - Owner: https://github.com/theyugin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yarutsk-0.7.1-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: yarutsk-0.7.1-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.13, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
095bdf3d5f83e84fcb46559344195c7bad1d35cdeb803b715b67dea6e9b8f083
|
|
| MD5 |
d84679116d33c9eec2c1c51967a85dd7
|
|
| BLAKE2b-256 |
66602edfa142215a3099283e83941baa2f21d88f9c287f5200eb1e0e3a1efdf5
|
Provenance
The following attestation bundles were made for yarutsk-0.7.1-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:
Publisher:
ci.yml on theyugin/yarutsk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yarutsk-0.7.1-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl -
Subject digest:
095bdf3d5f83e84fcb46559344195c7bad1d35cdeb803b715b67dea6e9b8f083 - Sigstore transparency entry: 1355742857
- Sigstore integration time:
-
Permalink:
theyugin/yarutsk@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Branch / Tag:
refs/tags/v0.7.1 - Owner: https://github.com/theyugin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yarutsk-0.7.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: yarutsk-0.7.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 552.7 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16aa674be77f1883ab742cdb9dc5851e85ee5a9b5f5f5bf20c72d7f849d66cca
|
|
| MD5 |
29f0cee022b78aa562a21788b67b3e97
|
|
| BLAKE2b-256 |
9dd189a13fd5309f81da4de767bfb8611f4d42eb0d43ca03c321a41c59bdeca4
|
Provenance
The following attestation bundles were made for yarutsk-0.7.1-cp312-cp312-win_amd64.whl:
Publisher:
ci.yml on theyugin/yarutsk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yarutsk-0.7.1-cp312-cp312-win_amd64.whl -
Subject digest:
16aa674be77f1883ab742cdb9dc5851e85ee5a9b5f5f5bf20c72d7f849d66cca - Sigstore transparency entry: 1355742888
- Sigstore integration time:
-
Permalink:
theyugin/yarutsk@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Branch / Tag:
refs/tags/v0.7.1 - Owner: https://github.com/theyugin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yarutsk-0.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: yarutsk-0.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 675.8 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aca36f803f9de59c60978a992e449e78c8c4e78272b6c6db918e4f045c29caa6
|
|
| MD5 |
0c26c83ff9871da8710384e09ff853a6
|
|
| BLAKE2b-256 |
d99783459ced3d8676615acf837858513b756f4a0e3db426b489ab4438bbc86d
|
Provenance
The following attestation bundles were made for yarutsk-0.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
ci.yml on theyugin/yarutsk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yarutsk-0.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
aca36f803f9de59c60978a992e449e78c8c4e78272b6c6db918e4f045c29caa6 - Sigstore transparency entry: 1355742838
- Sigstore integration time:
-
Permalink:
theyugin/yarutsk@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Branch / Tag:
refs/tags/v0.7.1 - Owner: https://github.com/theyugin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file yarutsk-0.7.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: yarutsk-0.7.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.12, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b498f4d2e348fa6297789893f18d65dff2c0087aedf16ac843ca299f1a9612f2
|
|
| MD5 |
d38e8d0fcf2f31cdb4eef74dcad2235d
|
|
| BLAKE2b-256 |
1e402895e4e2d326e65b6b3ead3390b1edf725832a468bb29a911aff029e458b
|
Provenance
The following attestation bundles were made for yarutsk-0.7.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:
Publisher:
ci.yml on theyugin/yarutsk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yarutsk-0.7.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl -
Subject digest:
b498f4d2e348fa6297789893f18d65dff2c0087aedf16ac843ca299f1a9612f2 - Sigstore transparency entry: 1355742903
- Sigstore integration time:
-
Permalink:
theyugin/yarutsk@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Branch / Tag:
refs/tags/v0.7.1 - Owner: https://github.com/theyugin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7e07f0b1c438125619b7e665b7134e9989420cc4 -
Trigger Event:
push
-
Statement type: