Skip to content

Commit

Permalink
Update docs, package metadata and bump version to 1.5.0
Browse files Browse the repository at this point in the history
Also move metadata to setup.cfg.
  • Loading branch information
fsouza committed Aug 27, 2022
1 parent 4f139dd commit 2358c71
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 61 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,42 +84,39 @@ 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.
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
remove all duplicate keys in objects
--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
```


Expand Down Expand Up @@ -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
```
2 changes: 1 addition & 1 deletion autoflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import pyflakes.reporter


__version__ = '1.4'
__version__ = '1.5.0'


_LOGGER = logging.getLogger('autoflake')
Expand Down
28 changes: 28 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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
43 changes: 1 addition & 42 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 2358c71

Please sign in to comment.