From c880c34563cdb58c076341a102466f382314a0ec Mon Sep 17 00:00:00 2001 From: Chris Moradi <37349208+chrismoradi@users.noreply.github.com> Date: Sat, 21 May 2022 12:26:38 -0700 Subject: [PATCH] Adds pre-commit hooks for black, flake8, isort (#198) * Adds pre-commit hooks for black, flake8, isort Closes: #194 * Address PR feedback * Config black to support 160 max line length --- .pre-commit-config.yaml | 15 +++++++++++++++ README.md | 8 ++++++-- dev-requirements.txt | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..a3de7a86b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +default_stages: [push] +repos: +- repo: https://github.com/psf/black + rev: 21.12b0 + hooks: + - id: black + args: [--line-length=160] +- repo: https://github.com/PyCQA/flake8 + rev: 4.0.1 + hooks: + - id: flake8 +- repo: https://github.com/PyCQA/isort + rev: 5.10.1 + hooks: + - id: isort diff --git a/README.md b/README.md index 7e47bc659..b8d912629 100644 --- a/README.md +++ b/README.md @@ -66,11 +66,15 @@ If you're feeling curious. You can take a look at a more detailed architecture [ ## ⚙️ To Develop Locally +1. Install the development dependencies: `pip install -r dev-requirements.txt` + +1. Install the pre-commit git hooks: `pre-commit install` + 1. Add more routes in the `integration_tests/base_routes.py` file(if you like). -2. Run `maturin develop` or `maturin develop --cargo-extra-args="--features=io-uring"` (if you want to run the experimental version). +1. Run `maturin develop` or `maturin develop --cargo-extra-args="--features=io-uring"` (if you want to run the experimental version). -3. Run `python3 integration_tests/base_routes.py` +1. Run `python3 integration_tests/base_routes.py` ## 🏃 To Run diff --git a/dev-requirements.txt b/dev-requirements.txt index e63e3ea70..2770e9125 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -3,3 +3,4 @@ black==21.12b0 websockets==10.1 maturin==0.12.11 isort==5.10.1 +pre-commit==2.19.0