From 2063831bb6ff59701b7eca8c459ddb7b774b9e6a Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Wed, 12 May 2021 18:37:13 +0200
Subject: [PATCH] [enh] #162: Introduce isort dep and pre-commit hook

Use black profile:
https://github.com/PyCQA/isort/issues/1518#issuecomment-703056188
https://pycqa.github.io/isort/docs/configuration/config_files/
https://pycqa.github.io/isort/docs/configuration/profiles/
---
 .pre-commit-config.yaml | 5 +++++
 pyproject.toml          | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 417c2ff4..04fb895f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -3,6 +3,11 @@ repos:
     rev: 21.5b0
     hooks:
     - id: black
+-   repo: https://github.com/PyCQA/isort
+    rev: 5.8.0
+    hooks:
+    - id: isort
+      args: ["--profile", "black"]
 -   repo: https://github.com/pre-commit/mirrors-mypy
     rev: v0.812
     hooks:
diff --git a/pyproject.toml b/pyproject.toml
index 3c4e5491..d5fceba7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -37,7 +37,12 @@ websocket-client = "^0.57"
 [tool.poetry.dev-dependencies]
 black = {version = "^21.4b2", allow-prereleases = true}
 mypy = "^0.790"
+isort = "^5.8.0"
 pylint = "^2.7.2"
 pre-commit = "^2.12.1"
 sphinx = "^3.2.1"
 sphinx_rtd_theme = "^0.5.0"
+
+[tool.isort]
+profile = "black"
+src_paths = ["duniterpy", "tests", "examples"]
-- 
GitLab