[![Build Status](https://dev.azure.com/asottile/asottile/_apis/build/status/asottile.seed-isort-config?branchName=master)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=20&branchName=master)
[![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/asottile/asottile/20/master.svg)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=20&branchName=master)
seed-isort-config
=================
Statically populate the `known_third_party` `isort` setting.
[`isort`][isort] when run in isolation is not the best at determining what
dependencies are third party.
[`aspy.refactor_imports`][aspy.refactor_imports] is fortunately much better at
this static analysis.
Why not just use [`reorder-python-imports`][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`][pre-commit].
```yaml
- 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]`.
[isort]: https://github.com/timothycrosley/isort
[aspy.refactor_imports]: https://github.com/asottile/aspy.refactor_imports
[reorder_python_imports]: https://github.com/asottile/reorder_python_imports
[pre-commit]: https://github.com/pre-commit/pre-commit
Raw data
{
"_id": null,
"home_page": "https://github.com/asottile/seed-isort-config",
"name": "seed-isort-config",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6.1",
"maintainer_email": "",
"keywords": "",
"author": "Anthony Sottile",
"author_email": "asottile@umich.edu",
"download_url": "https://files.pythonhosted.org/packages/e1/b2/bda7e27d9b42e7fae4d78f47709f2c21f9cf0f3f927f701d9e6a8bd533a6/seed_isort_config-2.2.0.tar.gz",
"platform": "",
"description": "[![Build Status](https://dev.azure.com/asottile/asottile/_apis/build/status/asottile.seed-isort-config?branchName=master)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=20&branchName=master)\n[![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/asottile/asottile/20/master.svg)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=20&branchName=master)\n\nseed-isort-config\n=================\n\nStatically populate the `known_third_party` `isort` setting.\n\n[`isort`][isort] when run in isolation is not the best at determining what\ndependencies are third party.\n\n[`aspy.refactor_imports`][aspy.refactor_imports] is fortunately much better at\nthis static analysis.\n\nWhy not just use [`reorder-python-imports`][reorder_python_imports]? Well, it\nlacks a few features provided by `isort` (intentionally).\n\nWhat this script does is seeds the `known_third_party` isort configuration\nautomatically.\n\n## install\n\n`pip install seed-isort-config`\n\n## usage\n\n`seed-isort-config` provides a single executable by the same name. Run it\ninside a `git` repository.\n\nTo specify custom application roots (such as with the `src` pattern) pass a\ncolon-separated `--application-directories` parameter.\n\nFiles may be excluded from the process using the `--exclude` flag.\nThis argument takes a python regular expression.\n\nFor a full list of arguments, see `seed-isort-config --help`.\n\n## getting started\n\n`seed-isort-config` looks for an existing `known_third_party` setting in an\nisort configuration file. It will modify that if it exists, otherwise it'll\ncreate a brand new `.isort.cfg` file.\n\nThe easiest way to get started is to just add a blank `known_third_party =`\nsection to your isort configuration (or `known_third_party = []` if you are\nusing `pyproject.toml`).\n\n## usage with pre-commit\n\nThis works especially well when integrated with [`pre-commit`][pre-commit].\n\n\n```yaml\n- repo: https://github.com/asottile/seed-isort-config\n rev: v2.2.0\n hooks:\n - id: seed-isort-config\n- repo: https://github.com/timothycrosley/isort\n rev: 4.3.21 # pick the isort version you'd like to use from https://github.com/timothycrosley/isort/releases\n hooks:\n - id: isort\n```\n\nIn this configuration, `seed-isort-config` will adjust the `known_third_party`\nsection of the `isort` configuration before `isort` runs!\n\nNote that `seed-isort-config` doesn't act like a normal pre-commit linter so\nfile exclusion must be configured through `args: [--exclude=...]` instead.\nFor example: `args: [--exclude=tests/.*\\.py]`.\n\n[isort]: https://github.com/timothycrosley/isort\n[aspy.refactor_imports]: https://github.com/asottile/aspy.refactor_imports\n[reorder_python_imports]: https://github.com/asottile/reorder_python_imports\n[pre-commit]: https://github.com/pre-commit/pre-commit\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Statically populate the `known_third_party` `isort` setting.",
"version": "2.2.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d37593d959a7c2837b0a12f658261b31",
"sha256": "8601fb715a5a4aac39256bbf73c2da6a81f964da9c9d9897ab9074db3663526f"
},
"downloads": -1,
"filename": "seed_isort_config-2.2.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "d37593d959a7c2837b0a12f658261b31",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6.1",
"size": 5548,
"upload_time": "2020-06-06T20:31:05",
"upload_time_iso_8601": "2020-06-06T20:31:05.765054Z",
"url": "https://files.pythonhosted.org/packages/6b/85/78c654684181ecab22c279d425479a5265f9c1fa144939b35bdf1ac7cc35/seed_isort_config-2.2.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "e1036cf42fef58eaf11d73a4ce828c33",
"sha256": "be4cfef8f9a3fe8ea1817069c6b624538ac0b429636ec746edeb27e98ed628c8"
},
"downloads": -1,
"filename": "seed_isort_config-2.2.0.tar.gz",
"has_sig": false,
"md5_digest": "e1036cf42fef58eaf11d73a4ce828c33",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.1",
"size": 5362,
"upload_time": "2020-06-06T20:31:06",
"upload_time_iso_8601": "2020-06-06T20:31:06.852978Z",
"url": "https://files.pythonhosted.org/packages/e1/b2/bda7e27d9b42e7fae4d78f47709f2c21f9cf0f3f927f701d9e6a8bd533a6/seed_isort_config-2.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-06-06 20:31:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "asottile",
"github_project": "seed-isort-config",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "seed-isort-config"
}