Name | codemodimportfrom JSON |
Version |
0.10.0
JSON |
| download |
home_page | |
Summary | |
upload_time | 2023-10-18 05:37:36 |
maintainer | |
docs_url | None |
author | Your Name |
requires_python | >=3.10,<4.0 |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# codemodimportfrom
[![CI](https://github.com/Peter554/codemodimportfrom/actions/workflows/ci.yml/badge.svg)](https://github.com/Peter554/codemodimportfrom/actions/workflows/ci.yml)
Automatically update ImportFrom statements to "import modules, not objects".
## Install
From within your project's virtual environment, install `codemodimportfrom` (as a dev dependency). e.g.
```sh
pip install codemodimportfrom
```
## Usage
```sh
# Transform all ImportFrom statements in the file path/to/file.py
codemodimportfrom path/to/file.py
# Overwrite the file
codemodimportfrom path/to/file.py --write
# Transform ImportFrom statements for modules foo and bar only
codemodimportfrom path/to/file.py --module foo --module bar
# Allow object imports for typing.Optional and typing.Union
codemodimportfrom path/to/file.py --allow typing.Optional --allow typing.Union
# Allow all object imports from typing
codemodimportfrom path/to/file.py --allow "typing.*"
# Parse allow list from a .txt file (one line per allowed object import)
codemodimportfrom path/to/file.py --allow allow.txt
# Also transform module imports
# e.g. `from pydantic import dataclasses` becomes `import pydantic.dataclasses`
codemodimportfrom path/to/file.py --transform-module-imports
```
## Caveats
* Not tested with much real world code, yet.
* Relative imports (`from . import foo`) not implemented yet.
Raw data
{
"_id": null,
"home_page": "",
"name": "codemodimportfrom",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Your Name",
"author_email": "you@example.com",
"download_url": "https://files.pythonhosted.org/packages/33/65/20e1e69a25d301b972eb66bc76a2106f0af0758972e5b8c5d0bf500c414d/codemodimportfrom-0.10.0.tar.gz",
"platform": null,
"description": "# codemodimportfrom\n\n[![CI](https://github.com/Peter554/codemodimportfrom/actions/workflows/ci.yml/badge.svg)](https://github.com/Peter554/codemodimportfrom/actions/workflows/ci.yml)\n\nAutomatically update ImportFrom statements to \"import modules, not objects\".\n\n## Install\n\nFrom within your project's virtual environment, install `codemodimportfrom` (as a dev dependency). e.g.\n\n```sh\npip install codemodimportfrom\n```\n\n## Usage\n\n```sh\n# Transform all ImportFrom statements in the file path/to/file.py\ncodemodimportfrom path/to/file.py\n\n# Overwrite the file\ncodemodimportfrom path/to/file.py --write\n\n# Transform ImportFrom statements for modules foo and bar only\ncodemodimportfrom path/to/file.py --module foo --module bar\n\n# Allow object imports for typing.Optional and typing.Union\ncodemodimportfrom path/to/file.py --allow typing.Optional --allow typing.Union\n\n# Allow all object imports from typing\ncodemodimportfrom path/to/file.py --allow \"typing.*\"\n\n# Parse allow list from a .txt file (one line per allowed object import)\ncodemodimportfrom path/to/file.py --allow allow.txt\n\n# Also transform module imports \n# e.g. `from pydantic import dataclasses` becomes `import pydantic.dataclasses`\ncodemodimportfrom path/to/file.py --transform-module-imports\n```\n\n## Caveats\n\n* Not tested with much real world code, yet.\n* Relative imports (`from . import foo`) not implemented yet.\n",
"bugtrack_url": null,
"license": "",
"summary": "",
"version": "0.10.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ee16ed23134dcaf1ef2fc2bf32d3da6d2b5ba14ca180ce1111e5c573d134c3a4",
"md5": "b2829f4eecb8d6b6d01d8d79fe5eccca",
"sha256": "a7cebe740f692fc016297546af0d7dfd91ce25058079d5d90e892da75452ad10"
},
"downloads": -1,
"filename": "codemodimportfrom-0.10.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b2829f4eecb8d6b6d01d8d79fe5eccca",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 4212,
"upload_time": "2023-10-18T05:37:34",
"upload_time_iso_8601": "2023-10-18T05:37:34.551594Z",
"url": "https://files.pythonhosted.org/packages/ee/16/ed23134dcaf1ef2fc2bf32d3da6d2b5ba14ca180ce1111e5c573d134c3a4/codemodimportfrom-0.10.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "336520e1e69a25d301b972eb66bc76a2106f0af0758972e5b8c5d0bf500c414d",
"md5": "499b3d24830f33f2db0dbb23a991e3b4",
"sha256": "2b1b94d6137054af2d9a6dc1d1f51b37ef891da666588894bc5b99f6a6f8d40d"
},
"downloads": -1,
"filename": "codemodimportfrom-0.10.0.tar.gz",
"has_sig": false,
"md5_digest": "499b3d24830f33f2db0dbb23a991e3b4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 3237,
"upload_time": "2023-10-18T05:37:36",
"upload_time_iso_8601": "2023-10-18T05:37:36.355465Z",
"url": "https://files.pythonhosted.org/packages/33/65/20e1e69a25d301b972eb66bc76a2106f0af0758972e5b8c5d0bf500c414d/codemodimportfrom-0.10.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-18 05:37:36",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "codemodimportfrom"
}