# 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/cf/1b/c6a9fea33bdf3f54b8962b51de743f39fe317c049684b4af7d761d7acad3/codemod_yaml-0.6.3.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.6.3",
"project_urls": {
"Homepage": "https://github.com/advice-animal/codemod-yaml/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f4f243f6e1c9a8516c0bce824e0171b262d650d565214b7af843675a39d0b249",
"md5": "a9c2975f7f1ac32569a5a4ec6bc43a7e",
"sha256": "708e680ba28396c426af8f552515894dd0144a8197ab1286e0afc713b2c3388e"
},
"downloads": -1,
"filename": "codemod_yaml-0.6.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a9c2975f7f1ac32569a5a4ec6bc43a7e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 14067,
"upload_time": "2024-12-10T18:40:55",
"upload_time_iso_8601": "2024-12-10T18:40:55.538241Z",
"url": "https://files.pythonhosted.org/packages/f4/f2/43f6e1c9a8516c0bce824e0171b262d650d565214b7af843675a39d0b249/codemod_yaml-0.6.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cf1bc6a9fea33bdf3f54b8962b51de743f39fe317c049684b4af7d761d7acad3",
"md5": "9b607f1d6ae8c7cc72b53be89736fc2b",
"sha256": "1f963530fcba92a131e153244dcd8a5335ee9df21ccd2b9ce6ef5baeb9332b97"
},
"downloads": -1,
"filename": "codemod_yaml-0.6.3.tar.gz",
"has_sig": false,
"md5_digest": "9b607f1d6ae8c7cc72b53be89736fc2b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 19702,
"upload_time": "2024-12-10T18:40:57",
"upload_time_iso_8601": "2024-12-10T18:40:57.008803Z",
"url": "https://files.pythonhosted.org/packages/cf/1b/c6a9fea33bdf3f54b8962b51de743f39fe317c049684b4af7d761d7acad3/codemod_yaml-0.6.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-10 18:40:57",
"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"
}