codemod-yaml
Lib to modify yaml inplace
Decision gist · record as of 2026-08-14
Yes. The package solves a real problem—format-preserving YAML edits—with low install friction, active maintenance, permissive licensing, and no known vulnerabilities. It is well-suited for automation and codemod tools where minimal diffs matter. The narrow Python version window for development is not a blocker for runtime use.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9+; tree-sitter and tree-sitter-yaml must be installed and available.
- Low friction installation with only two runtime dependencies (tree-sitter and tree-sitter-yaml).
- Actively maintained with recent releases; last commit 2026-05-12.
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; you must include a copy of the license and copyright notice.
last release 2025-03-25 (507 days) · last repo commit 2026-05-12 · 2 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 183,143 downloads/mo, #10,072 on PyPI
Alternatives
Verify before relying
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)- Whether tree-sitter-yaml is automatically installed or must be installed separately as a system dependency.
- Performance characteristics and scalability limits for large or deeply nested YAML documents.
What it is and what it does
codemod-yaml is a library for making targeted edits to YAML files while preserving formatting. It uses tree-sitter to parse YAML and allows you to modify document structure programmatically, then write the result back with minimal changes to whitespace and layout on unmodified lines. This makes it suitable for automation tools and codemods that need to update YAML configuration files without introducing unnecessary formatting noise into version control diffs.
The library is inspired by tomlkit and pyupgrade, adopting their philosophy of format-preserving edits. It exposes a simple API where you parse a YAML file into a stream object, modify its contents like a Python dict, and serialize it back to bytes. The main constraint is Python version support: runtime usage works back to 3.9, but development and full mypy compatibility require 3.10-3.12.
Use it for
- Update version strings in CI/CD configuration files while keeping formatting intact for minimal git diffs.
- Automate bulk changes to Kubernetes manifests or Helm values without reformatting the entire document.
- Build codemods that modify application configuration YAML files as part of refactoring or migration workflows.
- Programmatically edit Docker Compose or other YAML-based infrastructure-as-code files with surgical precision.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package solves a real problem—format-preserving YAML edits—with low install friction, active maintenance, permissive licensing, and no known vulnerabilities. It is well-suited for automation and codemod tools where minimal diffs matter. The narrow Python version window for development is not a blocker for runtime use.
Install
codemod-yaml on PyPI
Before you install
Low friction installation with only two runtime dependencies (tree-sitter and tree-sitter-yaml). Actively maintained with recent releases; last commit 2026-05-12. Requires Python 3.9+, though development and full linting support is limited to 3.10-3.12.
Requires Python 3.9+; tree-sitter and tree-sitter-yaml must be installed and available.
License in practice
MIT license permits commercial and private use with minimal restrictions; you must include a copy of the license and copyright notice.
Quickstart
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)
Verify before relying
- Whether tree-sitter-yaml is automatically installed or must be installed separately as a system dependency.
- Performance characteristics and scalability limits for large or deeply nested YAML documents.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagestree-sittertree-sitter-yaml |
| Maintenance | Actively maintained 507 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 183,143 / month, #10,072 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: codemod_yaml-0.7.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “yaml editing library”
- codemod-yamlModifies YAML documents in place with surgical precision, preserving…
- yamlpathQuery, retrieve, update, merge, validate, and diff YAML, JSON, and…
- ruyamlruyaml is a YAML parser and serializer that preserves comments,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Markup packages
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
A Python markdown parser that converts markdown to HTML following the CommonMark specification, with support for plugins and custom syntax rules.
Install it if you need reliable markdown-to-HTML conversion.
Beautiful Soup parses HTML and XML documents into a navigable tree, providing Pythonic methods to search, iterate, and modify the parsed content.
Install it if you need to parse or extract data from markup documents.
et_xmlfile writes large XML files with minimal memory overhead by serializing elements to disk as they are created, rather than holding the entire tree in memory.
Install it if incremental XML writing fits your use case; skip it if your XML documents are small or you already use lxml.
Parses and edits TOML files while preserving formatting, comments, and structure, then serializes them back with layout intact.
Install it if you're building tools that touch TOML files and user readability of the source matters.
Parses Python docstrings in ReST, Google, Numpydoc, and Epydoc formats, extracting structured information like descriptions, parameters, return types, and exceptions.
Install it if you need to programmatically read and extract structured data from Python docstrings.
See also codemod-tox · imperfect · tree-sitter-yaml · in-place · htmlmin · patch · libcst · yq · yamlfix