Metadata-Version: 2.1
Name: gadd
Version: 0.1.3
Summary: Sort imports, remove unused imports, run Black, flake8, pylint, vulture in one go for al staged .py files
Home-page: https://github.com/almazkun/gadd
License: MIT
Keywords: Black,Sort imports,analysis,automation,autopep8,code,flake8,formatter,gofmt,lint,linter,pyfmt,pylint,python,remove unused imports,rustfmt,static,vulture,yapf
Author: Almaz Kunpeissov
Author-email: hello@akun.dev
Requires-Python: >=3.6,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Dist: autoflake (>=1.4.0,<1.5.0)
Requires-Dist: black (==21.10b0)
Requires-Dist: flake8 (>=4.0.0,<4.1.0)
Requires-Dist: gitpython (>=3.1.0,<3.2.0)
Requires-Dist: isort (>=5.10.0,<5.11.0)
Requires-Dist: pylint (>=2.11.0,<2.12.0)
Requires-Dist: vulture (>=2.3.0,<2.4.0)
Project-URL: Documentation, https://github.com/almazkun/gadd
Project-URL: Repository, https://github.com/almazkun/gadd
Description-Content-Type: text/markdown

# gadd
Very opinionated formatting python files after git add

# Intent
I needed a small tool to reformat and lint all the staged `.py` files according to the specific rules. I wanted it to be able to `pip` install it and available in the `PATH`. It is called `gadd` because you run it after `git add` command.
It will do:
* Remove unused imports
* Sort imports
* Reformat with [`Black`](https://github.com/psf/black)
* Run [`flake8`](https://github.com/PyCQA/pylint) and [`pylint`](https://github.com/PyCQA/flake8) linters
* Search for deadcode with [`vulture`](https://github.com/jendrikseipp/vulture)

Obeys `.flake8`, `.pylintrc` and `whitelist.py` config files in the current directory.

# Tutorial
This is quick tutorial on hoe to create `pip` installable Python CLI tool.

* create a repository with the following file structure: 
```bash
user@computer gadd % exa -T .
.
├── gadd
│  ├── __init__.py
│  └── gadd.py
├── LICENSE
├── README.md
└── test
   ├── __init__.py
   └── test_gadd.py
```

# Publish to `pip` with [`poetry`](https://python-poetry.org)
Make it pip installable with CLI command.

Make and publish `pip` package with `poetry`:

* Install `poetry`. I would highly recommend to install it with `pipx`

```
cd gadd
pipx install poetry
poetry init
```
* Modify `pyproject.toml` file:
```toml
 [tool.poetry]
name = "gadd"
version = "0.1.0"
description = "Sort imports, remove unused imports, run Black, flake8, pylint, vulture in one go for al staged .py files"
authors = ["Almaz Kunpeissov <hello@akun.dev>"]
keywords = ["Black", "Sort imports", "analysis", "automation", "autopep8", "code", "flake8", "formatter", "gofmt", "lint", "linter", "pyfmt", "pylint", "python", "remove unused imports", "rustfmt", "static", "vulture", "yapf"]
readme = "README.md"
license = "MIT"
homepage = "https://github.com/almazkun/gadd"
repository = "https://github.com/almazkun/gadd"
documentation = "https://github.com/almazkun/gadd"
include = [
    "LICENSE",
]
classifiers = [
    "Topic :: Software Development :: Libraries :: Python Modules",
    "Topic :: Software Development :: Quality Assurance",
    "Topic :: Software Development :: Debuggers",
]

[tool.poetry.dependencies]
python = "^3.6"
autoflake = "^1.4"
black = "^21"
flake8 =  "^4.0"
gitpython = "^3.1"
isort =  "^5.10"
pylint = "^2.11"
vulture = "^2.3"

[tool.poetry.dev-dependencies]

[tool.poetry.scripts]
cli_command_name = 'gadd:main'

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
```
* Poetry build wheels:
```bash 
poetry build
```
* Poetry publish:
```bash
poetry publish
```



# TODO
* [ ] load from `.conf` file
* [ ] publish to pip
* [ ] make it `async`
* [ ] 
