# 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
```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)
```
# 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](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.
Raw data
{
"_id": null,
"home_page": "https://github.com/advice-animal/codemod-yaml/",
"name": "codemod-yaml",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Tim Hatch",
"author_email": "tim@timhatch.com",
"download_url": "https://files.pythonhosted.org/packages/37/db/b8a6a0f77582ad7dafc29b2b30ea2699ca7fa85f2df9d7f5b58cce6512d7/codemod_yaml-0.5.0.tar.gz",
"platform": null,
"description": "# codemod-yaml\n\nThis library makes surgical edits to YAML documents, based on tree-sitter and\ninspired by tomlkit and pyupgrade. Preserves _all_ whitespace and formatting\non lines that don't require changes, and generally within a line as well, so\nyou can make minimal diffs in your codemod tools.\n\n# Basic Usage\n\n```py\nfrom codemod_yaml import parse\nstream = parse(somepath.read_bytes())\nif stream[\"version\"] == [\"2.7\"]:\n stream[\"version\"][:] = [\"3.6\", \"3.13\"]\nsomepath.write_bytes(stream.text)\n```\n\n# Version Compat\n\nUsage of this library should work back to 3.9 (because of the tree-sitter dep),\nbut development (and mypy compatibility) only on 3.10-3.12. Linting requires\n3.12+ for full fidelity.\n\n# Versioning\n\nThis library follows [meanver](https://meanver.org/) which basically means\n[semver](https://semver.org/) along with a promise to rename when the major\nversion changes.\n\n# License\n\ncodemod-yaml is copyright [Tim Hatch](https://timhatch.com/), and licensed under\nthe MIT license. See the `LICENSE` file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Lib to modify yaml inplace",
"version": "0.5.0",
"project_urls": {
"Homepage": "https://github.com/advice-animal/codemod-yaml/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9dd1120953afd72ae7a5374a612daaede0bbb879f8021ec34c175c5ecdb41fc5",
"md5": "d38637349040f1ee2d88c58fc00f521b",
"sha256": "d5de5f462958254a3208096e701173a259a8dfd916f22177c4dff2725f74ab2a"
},
"downloads": -1,
"filename": "codemod_yaml-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d38637349040f1ee2d88c58fc00f521b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 13005,
"upload_time": "2024-11-24T05:15:00",
"upload_time_iso_8601": "2024-11-24T05:15:00.332985Z",
"url": "https://files.pythonhosted.org/packages/9d/d1/120953afd72ae7a5374a612daaede0bbb879f8021ec34c175c5ecdb41fc5/codemod_yaml-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "37dbb8a6a0f77582ad7dafc29b2b30ea2699ca7fa85f2df9d7f5b58cce6512d7",
"md5": "8022aea4cbae35f6acfda61ba695a31f",
"sha256": "d01a1c02561eb98db6dff03e4918bbde15663a095d4304a947bac05c75323087"
},
"downloads": -1,
"filename": "codemod_yaml-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "8022aea4cbae35f6acfda61ba695a31f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 17002,
"upload_time": "2024-11-24T05:15:01",
"upload_time_iso_8601": "2024-11-24T05:15:01.977940Z",
"url": "https://files.pythonhosted.org/packages/37/db/b8a6a0f77582ad7dafc29b2b30ea2699ca7fa85f2df9d7f5b58cce6512d7/codemod_yaml-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-24 05:15:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "advice-animal",
"github_project": "codemod-yaml",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "codemod-yaml"
}