seed-isort-config
Statically populate the known_third_party isort setting.
isort when run in isolation is not the best at determining what
dependencies are third party.
aspy.refactor_imports is fortunately much better at
this static analysis.
Why not just use reorder-python-imports? Well, it
lacks a few features provided by isort (intentionally).
What this script does is seeds the known_third_party isort configuration
automatically.
install
pip install seed-isort-config
usage
seed-isort-config provides a single executable by the same name. Run it
inside a git repository.
To specify custom application roots (such as with the src pattern) pass a
colon-separated --application-directories parameter.
Files may be excluded from the process using the --exclude flag.
This argument takes a python regular expression.
For a full list of arguments, see seed-isort-config --help.
getting started
seed-isort-config looks for an existing known_third_party setting in an
isort configuration file. It will modify that if it exists, otherwise it'll
create a brand new .isort.cfg file.
The easiest way to get started is to just add a blank known_third_party =
section to your isort configuration (or known_third_party = [] if you are
using pyproject.toml).
usage with pre-commit
This works especially well when integrated with pre-commit.
- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/timothycrosley/isort
rev: 4.3.21 # pick the isort version you'd like to use from https://github.com/timothycrosley/isort/releases
hooks:
- id: isort
In this configuration, seed-isort-config will adjust the known_third_party
section of the isort configuration before isort runs!
Note that seed-isort-config doesn't act like a normal pre-commit linter so
file exclusion must be configured through args: [--exclude=...] instead.
For example: args: [--exclude=tests/.*\.py].
Release files for seed-isort-config 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| seed_isort_config-2.2.0.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| seed_isort_config-2.2.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size:10.9 kB
Release files / seed_isort_config-2.2.0.tar.gz
| Download URL | seed_isort_config-2.2.0.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be4cfef8f9a3fe8ea1817069c6b624538ac0b429636ec746edeb27e98ed628c8
|
|
BLAKE2b-256 checksum How to use checksums |
e1b2bda7e27d9b42e7fae4d78f47709f2c21f9cf0f3f927f701d9e6a8bd533a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|
Release files / seed_isort_config-2.2.0-py2.py3-none-any.whl
| Download URL | seed_isort_config-2.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
8601fb715a5a4aac39256bbf73c2da6a81f964da9c9d9897ab9074db3663526f
|
|
BLAKE2b-256 checksum How to use checksums |
6b8578c654684181ecab22c279d425479a5265f9c1fa144939b35bdf1ac7cc35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|