From d12cc8edaa1e7e8efe69757ee5778ab36c2ce4f4 Mon Sep 17 00:00:00 2001
From: Bryan Brancotte <bryan.brancotte@pasteur.fr>
Date: Thu, 17 Apr 2025 10:39:01 +0200
Subject: [PATCH] add pre-commit config

---
 .pre-commit-config.yaml |  8 ++++++++
 README.md               | 10 +++++++++-
 requirements-dev.txt    |  1 +
 3 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 .pre-commit-config.yaml

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..9690ac7
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,8 @@
+repos:
+  # Using this mirror lets us use mypyc-compiled black, which is about 2x faster
+  - repo: https://github.com/psf/black-pre-commit-mirror
+    rev: 24.10.0
+    hooks:
+      - id: black
+        args: [--config=./pyproject.toml]
+        language_version: python3.10
\ No newline at end of file
diff --git a/README.md b/README.md
index 0e741bd..d0b4898 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,12 @@
 # InSillyClo
 
 * dev https://insillyclo-main.dev.pasteur.cloud/
-* prod https://insillyclo-main.pasteur.cloud/
\ No newline at end of file
+* prod https://insillyclo-main.pasteur.cloud/
+
+# Contributing
+
+Install Black to format sources, use pre-commit to prevent unformatted commit (which will be rejected by ci anyway)
+```shell
+pip install -r requirements-dev.txt
+pre-commit install
+```
\ No newline at end of file
diff --git a/requirements-dev.txt b/requirements-dev.txt
index e0cea11..93b46a0 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1 +1,2 @@
 black~=24.10.0
+pre-commit
\ No newline at end of file
-- 
GitLab