diff options
author | Tamas Szabo <szabtam@gmail.com> | 2020-10-14 10:16:45 +0300 |
---|---|---|
committer | Tamas Szabo <szabtam@gmail.com> | 2020-10-14 10:16:45 +0300 |
commit | 544e0ca283e3e171d1162946c24d8aefee8054b6 (patch) | |
tree | c73ea490c47af86b4e9521543946a2e8b3ac6b3b | |
parent | f9f5cc9314cc1be1e2f9c2b0270580c1351d8fe1 (diff) | |
parent | 718fe45817628f8033b2b47aa9ce5a2d8c890ca7 (diff) | |
download | isort-improve-test-coverage.tar.gz |
Merge branch 'develop' into improve-test-coverageimprove-test-coverage
-rw-r--r-- | docs/configuration/compatibility_black.md | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/docs/configuration/compatibility_black.md b/docs/configuration/compatibility_black.md new file mode 100644 index 00000000..4afa2459 --- /dev/null +++ b/docs/configuration/compatibility_black.md @@ -0,0 +1,57 @@ +Compatibility with black +======== + +black and isort sometimes don't agree on some rules. Although you can configure isort to behave nicely with black. + + +## Basic compatibility + +Use the profile option while using isort, `isort --profile black`. + +A demo of how this would look like in your _.travis.yml_ + +```yaml +language: python +python: + - "3.6" + - "3.7" + - "3.8" + +install: + - pip install -r requirements-dev.txt + - pip install isort black + - pip install coveralls +script: + - pytest my-package + - isort --profile black my-package + - black --check --diff my-package +after_success: + - coveralls + +``` + +See [built-in profiles](https://pycqa.github.io/isort/docs/configuration/profiles/) for more profiles. + +## Integration with pre-commit + +isort can be easily used with your pre-commit hooks. + +```yaml +- repo: https://github.com/pycqa/isort + rev: 5.6.4 + hooks: + - id: isort + args: ["--profile", "black"] +``` + +## Using a config file (.isort.cfg) + +The easiest way to configure black with isort is to use a config file. + +```ini +[tool.isort] +profile = "black" +multi_line_output = 3 +``` + +Read More about supported [config files](https://pycqa.github.io/isort/docs/configuration/config_files/).
\ No newline at end of file |