All Projects → asottile-archive → seed-isort-config

asottile-archive / seed-isort-config

Licence: MIT license
Statically populate the `known_third_party` `isort` setting.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to seed-isort-config

NextCommunity.github.io
Join FREE: Community of open-source programmers and software engineers.
Stars: ✭ 29 (-56.72%)
Mutual labels:  pre-commit
Pre Commit Hooks
Some out-of-the-box hooks for pre-commit
Stars: ✭ 2,605 (+3788.06%)
Mutual labels:  pre-commit
pre-commit
pre-commit hook terraform; pre-commit hook prometheus
Stars: ✭ 35 (-47.76%)
Mutual labels:  pre-commit
pre-commit-dbt
🎣 List of `pre-commit` hooks to ensure the quality of your `dbt` projects.
Stars: ✭ 149 (+122.39%)
Mutual labels:  pre-commit
Husky
Git hooks made easy 🐶 woof!
Stars: ✭ 25,056 (+37297.01%)
Mutual labels:  pre-commit
blackbricks
Black for Databricks notebooks
Stars: ✭ 40 (-40.3%)
Mutual labels:  pre-commit
template-python
Template repository for Python projects
Stars: ✭ 20 (-70.15%)
Mutual labels:  pre-commit
pre-commit-opa
Pre-commit git hooks for Open Policy Agent (OPA) and Rego development
Stars: ✭ 53 (-20.9%)
Mutual labels:  pre-commit
Pre Commit
A framework for managing and maintaining multi-language pre-commit hooks.
Stars: ✭ 7,024 (+10383.58%)
Mutual labels:  pre-commit
awesome-python-code-formatters
A curated list of awesome Python code formatters
Stars: ✭ 168 (+150.75%)
Mutual labels:  isort
hulks
Olist custom linting hooks 💚 👽
Stars: ✭ 25 (-62.69%)
Mutual labels:  pre-commit
create-react-redux-app
React boilerplate based on create-react-app
Stars: ✭ 49 (-26.87%)
Mutual labels:  pre-commit
Husky.Net
Git hooks made easy with Husky.Net internal task runner! 🐶 It brings the dev-dependency concept to the .NET world!
Stars: ✭ 394 (+488.06%)
Mutual labels:  pre-commit
detect-secrets
A developer-friendly secrets detection tool for CI and pre-commit hooks based on Yelp's detect-secrets
Stars: ✭ 43 (-35.82%)
Mutual labels:  pre-commit
pre-commit-mirror-maker
Scripts for creating mirror repositories that do not have .pre-commit-hooks.yaml
Stars: ✭ 19 (-71.64%)
Mutual labels:  pre-commit
conventional-pre-commit
A pre-commit hook that checks commit messages for Conventional Commits formatting
Stars: ✭ 66 (-1.49%)
Mutual labels:  pre-commit
ready
A program to run tasks before a commit.
Stars: ✭ 16 (-76.12%)
Mutual labels:  pre-commit
check-jsonschema
A CLI and set of pre-commit hooks for jsonschema validation with built-in support for GitHub Workflows, Renovate, Azure Pipelines, and more!
Stars: ✭ 51 (-23.88%)
Mutual labels:  pre-commit
ocflib
Python libraries for account and server management
Stars: ✭ 13 (-80.6%)
Mutual labels:  pre-commit
pre-commit-hooks-safety
A pre-commit hook to check your Python dependencies against safety-db
Stars: ✭ 69 (+2.99%)
Mutual labels:  pre-commit

DEPRECATED

this is no longer needed as of isort>=5


Build Status Azure DevOps coverage

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].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].