diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b656304c..6cadba05 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,28 +11,9 @@ on: branches: [ master ] jobs: - - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html - make install_dev - - name: Run Flake8 - run: make flake8 - - name: Run Black - run: make black test: runs-on: ubuntu-latest - needs: [lint] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} @@ -44,7 +25,3 @@ jobs: python -m pip install --upgrade pip pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html make install_dev - - name: Run Flake8 - run: make flake8 - - name: Run Tests - run: make test diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 799eaa52..9bce783f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,23 @@ +default_language_version: + python: python3 + +ci: + autofix_prs: true + autoupdate_commit_msg: "[pre-commit.ci] pre-commit suggestions" + autoupdate_schedule: quarterly + # submodules: true + repos: - repo: https://github.com/psf/black rev: 22.3.0 hooks: - id: black - args: [ --config=pyproject.toml ] + args: ["--config=pyproject.toml"] + - repo: https://github.com/pycqa/flake8.git rev: 4.0.1 hooks: - id: flake8 - args: [ --config=.flake8 ] - additional_dependencies: [ flake8-docstrings==1.6.0 ] \ No newline at end of file + args: ["--config=.flake8"] + additional_dependencies: + - "flake8-docstrings==1.6.0" \ No newline at end of file diff --git a/Makefile b/Makefile index 2e9d1294..2331acd1 100644 --- a/Makefile +++ b/Makefile @@ -16,10 +16,7 @@ table: table_timm: .venv/bin/python misc/generate_table_timm.py -black: .venv - .venv/bin/black ./segmentation_models_pytorch --config=pyproject.toml --check +precommit: install_dev + .venv/bin/pre-commit run --all-files -flake8: .venv - .venv/bin/flake8 ./segmentation_models_pytorch --config=.flake8 - -all: black flake8 test +all: precommit test diff --git a/README.md b/README.md index 95d24ee2..3d18bc11 100644 --- a/README.md +++ b/README.md @@ -475,10 +475,10 @@ $ pip install git+https://github.com/qubvel/segmentation_models.pytorch make install_dev # create .venv, install SMP in dev mode ``` -#### Run tests and code checks +#### Run tests and code checks ```bash -make all # run flake8, black, tests +make all # run precommit, tests ``` #### Update table with encoders diff --git a/setup.py b/setup.py index ae50ef0d..1f202d24 100644 --- a/setup.py +++ b/setup.py @@ -40,9 +40,6 @@ "pytest", "mock", "pre-commit", - "black==22.3.0", - "flake8==4.0.1", - "flake8-docstrings==1.6.0", ], }