codemod-json


Namecodemod-json JSON
Version 0.5.1 PyPI version JSON
download
home_pagehttps://github.com/advice-animal/codemod-json/
SummaryLib to modify json inplace
upload_time2024-12-04 21:54:40
maintainerNone
docs_urlNone
authorTim Hatch
requires_python>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # codemod-json

This library makes surgical edits to JSON 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

```json
{
    // some comment
    "version": ["foo"],
    "commands": [], // another comment
}
```

```py
from codemod_json import parse
stream = parse(somepath.read_bytes())
if stream["version"] == ["2.7"]:
    stream["version"][:] = ["3.6", "3.13"]
somepath.write_bytes(stream.text)
```

```json
{
    // some comment
    "version": ["3.6", "3.13"],
    "commands": [], // another comment
}
```

# 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-json 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-json/",
    "name": "codemod-json",
    "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/07/53/3d2ee6d101401278a197d3535236eabd1d24106c2f447ef927b111c7c794/codemod_json-0.5.1.tar.gz",
    "platform": null,
    "description": "# codemod-json\n\nThis library makes surgical edits to JSON 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```json\n{\n    // some comment\n    \"version\": [\"foo\"],\n    \"commands\": [], // another comment\n}\n```\n\n```py\nfrom codemod_json 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```json\n{\n    // some comment\n    \"version\": [\"3.6\", \"3.13\"],\n    \"commands\": [], // another comment\n}\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-json 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 json inplace",
    "version": "0.5.1",
    "project_urls": {
        "Homepage": "https://github.com/advice-animal/codemod-json/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d4cd1151c59d8bd573ad8ffd80e6141d6081e6c3f2ab541650a11224df43cb69",
                "md5": "cca37a6007b9433a735d3611e68f3bd6",
                "sha256": "97cbadf235a445c80c8687f9f4f3a4da584073620c2bc1394514795ff9b25e9d"
            },
            "downloads": -1,
            "filename": "codemod_json-0.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cca37a6007b9433a735d3611e68f3bd6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 12249,
            "upload_time": "2024-12-04T21:54:38",
            "upload_time_iso_8601": "2024-12-04T21:54:38.263074Z",
            "url": "https://files.pythonhosted.org/packages/d4/cd/1151c59d8bd573ad8ffd80e6141d6081e6c3f2ab541650a11224df43cb69/codemod_json-0.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "07533d2ee6d101401278a197d3535236eabd1d24106c2f447ef927b111c7c794",
                "md5": "73cad8ae12e73f91359e29cc35924810",
                "sha256": "c65ec3e4deb55c73a0c68f99a9625597c57a688b71aba03ca97f35c61469ed3b"
            },
            "downloads": -1,
            "filename": "codemod_json-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "73cad8ae12e73f91359e29cc35924810",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 14637,
            "upload_time": "2024-12-04T21:54:40",
            "upload_time_iso_8601": "2024-12-04T21:54:40.431043Z",
            "url": "https://files.pythonhosted.org/packages/07/53/3d2ee6d101401278a197d3535236eabd1d24106c2f447ef927b111c7c794/codemod_json-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-04 21:54:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "advice-animal",
    "github_project": "codemod-json",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "codemod-json"
}
        
Elapsed time: 2.04223s