From 2358c714d8b8cd6dc16559a6418b56c245ac8eac Mon Sep 17 00:00:00 2001 From: francisco souza <108725+fsouza@users.noreply.github.com> Date: Sat, 27 Aug 2022 19:27:08 -0400 Subject: [PATCH] Update docs, package metadata and bump version to 1.5.0 Also move metadata to setup.cfg. --- .pre-commit-config.yaml | 5 +++++ README.md | 33 ++++++++++++++----------------- autoflake.py | 2 +- setup.cfg | 28 +++++++++++++++++++++++++++ setup.py | 43 +---------------------------------------- 5 files changed, 50 insertions(+), 61 deletions(-) create mode 100644 setup.cfg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9ac1601..a3a5b8a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,3 +41,8 @@ repos: - id: add-trailing-comma args: - --py36-plus + + - repo: https://github.com/asottile/setup-cfg-fmt + rev: v2.0.0 + hooks: + - id: setup-cfg-fmt diff --git a/README.md b/README.md index 6b5e9b9..b77b65f 100644 --- a/README.md +++ b/README.md @@ -84,10 +84,8 @@ To remove unused variables, use the ``--remove-unused-variables`` option. Below is the full listing of options: ``` -usage: autoflake [-h] [-i] [-r] [--exclude globs] [--imports IMPORTS] - [--expand-star-imports] [--remove-all-unused-imports] - [--remove-duplicate-keys] [--remove-unused-variables] - [--version] +usage: autoflake [-h] [-c] [-r] [-j n] [--exclude globs] [--imports IMPORTS] [--expand-star-imports] [--remove-all-unused-imports] [--ignore-init-module-imports] [--remove-duplicate-keys] + [--remove-unused-variables] [--version] [--quiet] [-v] [--stdin-display-name STDIN_DISPLAY_NAME] [-i | -s] files [files ...] Removes unused imports and unused variables as reported by pyflakes. @@ -95,24 +93,17 @@ Removes unused imports and unused variables as reported by pyflakes. positional arguments: files files to format -optional arguments: +options: -h, --help show this help message and exit -c, --check return error code if changes are needed - -i, --in-place make changes to files instead of printing diffs -r, --recursive drill down directories recursively - --exclude globs exclude file/directory names that match these comma- - separated globs - --imports IMPORTS by default, only unused standard library imports are - removed; specify a comma-separated list of additional - modules/packages + -j n, --jobs n number of parallel jobs; match CPU count if value is 0 (default: 0) + --exclude globs exclude file/directory names that match these comma-separated globs + --imports IMPORTS by default, only unused standard library imports are removed; specify a comma-separated list of additional modules/packages --expand-star-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 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 --remove-all-unused-imports - remove all unused imports (not just those from the - standard library) + remove all unused imports (not just those from the standard library) --ignore-init-module-imports exclude __init__.py when removing unused imports --remove-duplicate-keys @@ -120,6 +111,12 @@ optional arguments: --remove-unused-variables remove unused variables --version show program's version number and exit + --quiet Suppress output if there are no issues + -v, --verbose print more verbose logs (you can repeat `-v` to make it more verbose) + --stdin-display-name STDIN_DISPLAY_NAME + the name used when processing input from stdin + -i, --in-place make changes to files instead of printing diffs + -s, --stdout print changed text to stdout. defaults to true when formatting stdin, or to false otherwise ``` @@ -196,7 +193,7 @@ Add the following to your `.pre-commit-config.yaml` ```yaml - repo: https://github.com/PyCQA/autoflake - rev: v1.4 + rev: v1.5.0 hooks: - id: autoflake ``` diff --git a/autoflake.py b/autoflake.py index 422f5e0..209f49a 100755 --- a/autoflake.py +++ b/autoflake.py @@ -39,7 +39,7 @@ import pyflakes.reporter -__version__ = '1.4' +__version__ = '1.5.0' _LOGGER = logging.getLogger('autoflake') diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..9f6174c --- /dev/null +++ b/setup.cfg @@ -0,0 +1,28 @@ +[metadata] +name = autoflake +version = attr:autoflake.__version__ +description = Removes unused imports and unused variables +long_description = file: README.md +long_description_content_type = text/markdown +url = https://www.github.com/PyCQA/autoflake +license = MIT +license_file = LICENSE +classifiers = + Environment :: Console + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Topic :: Software Development :: Quality Assurance +kewords = clean, fix, automatic, unused, import + +[options] +packages = find: +install_requires = + pyflakes>=1.1.0 + toml>=0.10.2 +python_requires = >=3.7 +test_suite = test_autoflake + +[bdist_wheel] +universal = 1 diff --git a/setup.py b/setup.py index 7f213fa..61cc244 100755 --- a/setup.py +++ b/setup.py @@ -1,45 +1,4 @@ #!/usr/bin/env python -"""Setup for autoflake.""" -import ast - import setuptools - -def version(): - """Return version string.""" - with open('autoflake.py') as input_file: - for line in input_file: - if line.startswith('__version__'): - return ast.parse(line).body[0].value.s - - -with open('README.md') as readme: - setuptools.setup( - name='autoflake', - version=version(), - description='Removes unused imports and unused variables', - long_description=readme.read(), - long_description_content_type='text/markdown', - license='Expat License', - author='Steven Myint', - url='https://github.com/myint/autoflake', - python_requires='>=3.7', - classifiers=[ - 'Environment :: Console', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Topic :: Software Development :: Quality Assurance', - ], - keywords='clean,fix,automatic,unused,import', - py_modules=['autoflake'], - entry_points={ - 'console_scripts': ['autoflake = autoflake:main'], - }, - install_requires=['pyflakes>=1.1.0', 'toml>=0.10.2'], - test_suite='test_autoflake', - ) +setuptools.setup()