# pyproject-autoflake
[![PyPI version](https://badge.fury.io/py/pyproject-autoflake.svg)](https://badge.fury.io/py/pyproject-autoflake) [![Python Versions](https://img.shields.io/pypi/pyversions/pyproject-autoflake.svg)](https://pypi.org/project/pyproject-autoflake/)
**pyproject-autoflake** (**pautoflake**), a monkey patching wrapper to connect [autoflake](https://github.com/myint/autoflake) with pyproject.toml configuration.
## Motivation
The original autoflake does not support configuration files such as pyproject.toml.
This is slightly inconvenient for modern Python development.
pautoflake is a thin wrapper library that calls autoflake with a configuration read from pyproject.toml.
pyproject-autoflake is inspired by [pyproject-flake8](https://github.com/csachs/pyproject-flake8). Many thanks! 😉
## Installation
### pip
```sh
pip install pyproject-autoflake
```
### poetry
```sh
poetry add -D pyproject-autoflake
```
## Usage
At first, you add `[tool.autoflake]` in your pyproject.toml.
```toml
# pyproject.toml
...
[tool.autoflake]
# return error code if changes are needed
check = false
# make changes to files instead of printing diffs
in-place = true
# drill down directories recursively
recursive = true
# exclude file/directory names that match these comma-separated globs
exclude = "<GLOBS>"
# by default, only unused standard library imports are removed; specify a comma-separated list of additional
# modules/packages
imports = "<IMPORTS>"
# expand wildcard star imports with undefined names; this only triggers if there is only one star import in
# the file; this is skipped if there are any uses of `__all__` or `del` in the file
expand-star-imports = true
# remove all unused imports (not just those from the standard library)
remove-all-unused-imports = true
# exclude __init__.py when removing unused imports
ignore-init-module-imports = true
# remove all duplicate keys in objects
remove-duplicate-keys = true
# remove unused variables
remove-unused-variables = true
# print more verbose logs (larger numbers are more verbose)
verbose = 0
...
```
Second, you call **p**autoflake.
```bash
pautoflake sample.py
```
## License
[MIT License](./LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/quwac/pyproject-autoflake",
"name": "pyproject-autoflake",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6.2,<4.0.0",
"maintainer_email": "",
"keywords": "formatter,autoflake,pyproject.toml",
"author": "quwac",
"author_email": "53551867+quwac@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/89/ce/85563b11e0ee67bd2ab7f374e6dd5a53aca6a039e0b5449b7dfddd779a13/pyproject-autoflake-1.0.2.tar.gz",
"platform": null,
"description": "# pyproject-autoflake\n\n[![PyPI version](https://badge.fury.io/py/pyproject-autoflake.svg)](https://badge.fury.io/py/pyproject-autoflake) [![Python Versions](https://img.shields.io/pypi/pyversions/pyproject-autoflake.svg)](https://pypi.org/project/pyproject-autoflake/)\n\n**pyproject-autoflake** (**pautoflake**), a monkey patching wrapper to connect [autoflake](https://github.com/myint/autoflake) with pyproject.toml configuration.\n\n## Motivation\n\nThe original autoflake does not support configuration files such as pyproject.toml.\nThis is slightly inconvenient for modern Python development.\n\npautoflake is a thin wrapper library that calls autoflake with a configuration read from pyproject.toml.\n\npyproject-autoflake is inspired by [pyproject-flake8](https://github.com/csachs/pyproject-flake8). Many thanks! \ud83d\ude09\n\n## Installation\n\n### pip\n\n```sh\npip install pyproject-autoflake\n```\n\n### poetry\n\n```sh\npoetry add -D pyproject-autoflake\n```\n\n## Usage\n\nAt first, you add `[tool.autoflake]` in your pyproject.toml.\n\n```toml\n# pyproject.toml\n\n...\n\n[tool.autoflake]\n# return error code if changes are needed\ncheck = false\n# make changes to files instead of printing diffs\nin-place = true\n# drill down directories recursively\nrecursive = true\n# exclude file/directory names that match these comma-separated globs\nexclude = \"<GLOBS>\"\n# by default, only unused standard library imports are removed; specify a comma-separated list of additional\n# modules/packages\nimports = \"<IMPORTS>\"\n# expand wildcard star imports with undefined names; this only triggers if there is only one star import in\n# the file; this is skipped if there are any uses of `__all__` or `del` in the file\nexpand-star-imports = true\n# remove all unused imports (not just those from the standard library)\nremove-all-unused-imports = true\n# exclude __init__.py when removing unused imports\nignore-init-module-imports = true\n# remove all duplicate keys in objects\nremove-duplicate-keys = true\n# remove unused variables\nremove-unused-variables = true\n# print more verbose logs (larger numbers are more verbose)\nverbose = 0\n\n...\n\n```\n\nSecond, you call **p**autoflake.\n\n```bash\npautoflake sample.py\n```\n\n## License\n\n[MIT License](./LICENSE)\n",
"bugtrack_url": null,
"license": "",
"summary": "pyproject-autoflake (pautoflake), a monkey patching wrapper to connect autoflake with pyproject.toml configuration.",
"version": "1.0.2",
"project_urls": {
"Homepage": "https://github.com/quwac/pyproject-autoflake",
"Repository": "https://github.com/quwac/pyproject-autoflake"
},
"split_keywords": [
"formatter",
"autoflake",
"pyproject.toml"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b8d67494a533baef27a6b43227ea5a264c249bd654e271f9c95920bd04805385",
"md5": "6ccbaaced598358e63597d1ceca64fb6",
"sha256": "db7220bec762cbc8cfe93f1d23f3a564d0c076529bc1ebafc2dcb023c5ee265c"
},
"downloads": -1,
"filename": "pyproject_autoflake-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6ccbaaced598358e63597d1ceca64fb6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6.2,<4.0.0",
"size": 4995,
"upload_time": "2022-08-02T13:27:12",
"upload_time_iso_8601": "2022-08-02T13:27:12.460880Z",
"url": "https://files.pythonhosted.org/packages/b8/d6/7494a533baef27a6b43227ea5a264c249bd654e271f9c95920bd04805385/pyproject_autoflake-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "89ce85563b11e0ee67bd2ab7f374e6dd5a53aca6a039e0b5449b7dfddd779a13",
"md5": "7dbd0b7d6292a680a99110829ca55ad7",
"sha256": "7ad1ab8c8e522bd04f05728f2656935853288b7b974a47850174c6cf6cc378ad"
},
"downloads": -1,
"filename": "pyproject-autoflake-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "7dbd0b7d6292a680a99110829ca55ad7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.2,<4.0.0",
"size": 4482,
"upload_time": "2022-08-02T13:27:11",
"upload_time_iso_8601": "2022-08-02T13:27:11.123479Z",
"url": "https://files.pythonhosted.org/packages/89/ce/85563b11e0ee67bd2ab7f374e6dd5a53aca6a039e0b5449b7dfddd779a13/pyproject-autoflake-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-08-02 13:27:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "quwac",
"github_project": "pyproject-autoflake",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyproject-autoflake"
}