Lib to modify yaml inplace
Project description
codemod-yaml
This library makes surgical edits to YAML documents, based on tree-sitter and inspired by tomlkit and pyupgrade. Preserves all whitespace and formatting on lines that don't require changes, and generally within a line as well, so you can make minimal diffs in your codemod tools.
Basic Usage
from codemod_yaml import parse
stream = parse(somepath.read_bytes())
if stream["version"] == ["2.7"]:
stream["version"][:] = ["3.6", "3.13"]
somepath.write_bytes(stream.text)
Version Compat
Usage of this library should work back to 3.9 (because of the tree-sitter dep), but development (and mypy compatibility) only on 3.10-3.12. Linting requires 3.12+ for full fidelity.
Versioning
This library follows meanver which basically means semver along with a promise to rename when the major version changes.
License
codemod-yaml is copyright Tim Hatch, and licensed under
the MIT license. See the LICENSE
file for details.
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 Distribution
File details
Details for the file codemod_yaml-0.5.0.tar.gz
.
File metadata
- Download URL: codemod_yaml-0.5.0.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d01a1c02561eb98db6dff03e4918bbde15663a095d4304a947bac05c75323087 |
|
MD5 | 8022aea4cbae35f6acfda61ba695a31f |
|
BLAKE2b-256 | 37dbb8a6a0f77582ad7dafc29b2b30ea2699ca7fa85f2df9d7f5b58cce6512d7 |
Provenance
The following attestation bundles were made for codemod_yaml-0.5.0.tar.gz
:
Publisher:
build.yml
on advice-animal/codemod-yaml
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
codemod_yaml-0.5.0.tar.gz
- Subject digest:
d01a1c02561eb98db6dff03e4918bbde15663a095d4304a947bac05c75323087
- Sigstore transparency entry: 151128843
- Sigstore integration time:
- Predicate type:
File details
Details for the file codemod_yaml-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: codemod_yaml-0.5.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5de5f462958254a3208096e701173a259a8dfd916f22177c4dff2725f74ab2a |
|
MD5 | d38637349040f1ee2d88c58fc00f521b |
|
BLAKE2b-256 | 9dd1120953afd72ae7a5374a612daaede0bbb879f8021ec34c175c5ecdb41fc5 |
Provenance
The following attestation bundles were made for codemod_yaml-0.5.0-py3-none-any.whl
:
Publisher:
build.yml
on advice-animal/codemod-yaml
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
codemod_yaml-0.5.0-py3-none-any.whl
- Subject digest:
d5de5f462958254a3208096e701173a259a8dfd916f22177c4dff2725f74ab2a
- Sigstore transparency entry: 151128844
- Sigstore integration time:
- Predicate type: