Metadata-Version: 2.1
Name: codemod-yaml
Version: 0.1.0
Summary: Lib to modify yaml inplace
Home-page: https://github.com/advice-animal/codemod-yaml/
Author: Tim Hatch
Author-email: tim@timhatch.com
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tree-sitter>=0.23.2
Requires-Dist: tree-sitter-yaml>=0.6.0
Requires-Dist: vmodule
Provides-Extra: dev
Requires-Dist: black==24.2.0; extra == "dev"
Requires-Dist: checkdeps==0.9.0; extra == "dev"
Requires-Dist: flake8==7.0.0; extra == "dev"
Requires-Dist: mypy==1.8.0; extra == "dev"
Requires-Dist: tox==4.12.1; extra == "dev"
Requires-Dist: twine==4.0.2; extra == "dev"
Requires-Dist: ufmt==2.5.1; extra == "dev"
Requires-Dist: usort==1.0.7; extra == "dev"
Requires-Dist: wheel==0.42.0; extra == "dev"
Provides-Extra: test
Requires-Dist: coverage>=6; extra == "test"
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: moreorless; extra == "test"

# codemod-yaml

This library is for making targeted edits to YAML documents.  The core design goal is:

1. Only change lines with *data* changes.

While you can't edit all YAML constructs, you can generally replace them and
roundtrip them thanks to tree-sitter-yaml.

This was roughly inspired by `pyupgrade` which combined AST-based parsing with
more low-level edits.

# Basic Usage

```py
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)
```

# Supported
[x] round-tripping unedited sections verbatim
[x] any valid yaml _after_ where you're editing
[x] block maps with string keys
[x] block sequences
[x] python str/float/list/dict

# Version Compat

Usage of this library should work back to 3.7, but development (and mypy
compatibility) only on 3.10-3.12.  Linting requires 3.12 for full fidelity.

# Versioning

This library follows [meanver](https://meanver.org/) which basically means
[semver](https://semver.org/) along with a promise to rename when the major
version changes.

# License

codemod-yaml is copyright [Tim Hatch](https://timhatch.com/), and licensed under
the MIT license.  See the `LICENSE` file for details.
