A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pycqa.github.io/isort/docs/configuration/pre-commit.html below:

Pre Commit - isort

Using isort with pre-commit

isort provides official support for pre-commit.

isort pre-commit step

To use isort's official pre-commit integration add the following config:

  - repo: https://github.com/pycqa/isort
    rev: 5.11.2
    hooks:
      - id: isort
        name: isort (python)

under the repos section of your projects .pre-commit-config.yaml file. Optionally if you want to have different hooks over different file types (ex: python vs cython vs pyi) you can do so with the following config:

  - repo: https://github.com/pycqa/isort
    rev: 5.11.2
    hooks:
      - id: isort
        name: isort (python)
      - id: isort
        name: isort (cython)
        types: [cython]
      - id: isort
        name: isort (pyi)
        types: [pyi]
seed-isort-config

Older versions of isort used a lot of magic to determine import placement, that could easily break when running on CI/CD. To fix this, a utility called seed-isort-config was created. Since isort 5 however, the project has drastically improved its placement logic and ensured a good level of consistency across environments. If you have a step in your pre-commit config called seed-isort-config or similar, it is highly recommend that you remove this. It is guaranteed to slow things down, and can conflict with isort's own module placement logic.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4