From 0a69a7abf80b225a1982ca8ca71678677a7b454b Mon Sep 17 00:00:00 2001 From: Jirka Date: Mon, 13 Nov 2023 06:14:31 +0100 Subject: [PATCH 1/3] move `black` & `flake8` to precommit --- .github/workflows/ci.yml | 6 +++--- .pre-commit-config.yaml | 28 +++++++++++++++++-------- pyproject.toml | 1 + tox.ini | 18 +--------------- tox_py_installer => tox_py_installer.sh | 0 5 files changed, 24 insertions(+), 29 deletions(-) rename tox_py_installer => tox_py_installer.sh (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b7d55aa..a30ad99c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,8 +29,8 @@ jobs: set -xe python -VV python -m site - python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions + python -m pip install --upgrade \ + pip setuptools wheel coverage[toml] virtualenv tox tox-gh-actions - name: "Run tox targets for ${{ matrix.python-version }}" run: python -m tox @@ -47,7 +47,7 @@ jobs: strategy: fail-fast: false matrix: - toxenv: ["flake8", "black", "manifest", "docs", "binder"] + toxenv: ["flake8", "manifest", "docs", "binder"] env: TOXENV: ${{ matrix.toxenv }} steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d374114..960e06cb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.5.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace @@ -21,7 +21,7 @@ repos: - id: detect-private-key - repo: https://github.com/asottile/pyupgrade - rev: v2.37.3 + rev: v3.15.0 hooks: - id: pyupgrade args: [--py37-plus] @@ -38,14 +38,15 @@ repos: # hooks: # - id: isort - #- repo: https://github.com/psf/black - # rev: 22.6.0 - # hooks: - # - id: black - # name: Black code + - repo: https://github.com/psf/black + rev: 23.11.0 + hooks: + - id: black + name: Black code + args: ["-S"] - repo: https://github.com/executablebooks/mdformat - rev: 0.7.15 + rev: 0.7.17 hooks: - id: mdformat additional_dependencies: @@ -53,6 +54,15 @@ repos: - mdformat_frontmatter - repo: https://github.com/asottile/yesqa - rev: v1.4.0 + rev: v1.5.0 hooks: - id: yesqa + + - repo: https://github.com/pycqa/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + arge: + - "--count" + - "--show-source" + - "--statistics" diff --git a/pyproject.toml b/pyproject.toml index 8bfffb83..79dfbcbf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,6 +7,7 @@ [tool.black] line-length = 100 +target-version = ['py312'] include = '\.pyi?$' exclude = ''' /( diff --git a/tox.ini b/tox.ini index e7993169..22f73305 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] skipsdist = true -envlist = py{38,39,310,311,312}, flake8, dist, manifest, docs, binder +envlist = py{38,39,310,311,312}, dist, manifest, docs, binder [gh-actions] python = @@ -10,12 +10,6 @@ python = 3.11: py311 3.12: py312, dist -# Linters -[testenv:flake8] -skip_install = true -deps = flake8 -commands = flake8 papermill --count --show-source --statistics - # Manifest [testenv:manifest] skip_install = true @@ -48,14 +42,6 @@ commands = python setup.py sdist --dist-dir={distdir} bdist_wheel --dist-dir={distdir} /bin/bash -c 'python -m pip install -U --force-reinstall {distdir}/papermill*.whl' -# Black -[testenv:black] -description = apply black linter with desired rules -basepython = python3.12 -deps = - black -commands = black -S -l 100 . - [testenv] # disable Python's hash randomization for tests that stringify dicts, etc setenv = @@ -69,12 +55,10 @@ basepython = py310: python3.10 py311: python3.11 py312: python3.12 - flake8: python3.12 manifest: python3.12 dist: python3.12 docs: python3.12 binder: python3.12 - black: python3.12 deps = .[dev] # Have to use /bin/bash or the `*` will cause that argument to get quoted by the tox command line... allowlist_externals = /bin/bash diff --git a/tox_py_installer b/tox_py_installer.sh similarity index 100% rename from tox_py_installer rename to tox_py_installer.sh From 465472da6bc825c206c256a3610a36247c890c92 Mon Sep 17 00:00:00 2001 From: Jirka Date: Mon, 13 Nov 2023 06:21:13 +0100 Subject: [PATCH 2/3] update name --- .github/workflows/ci.yml | 2 +- MANIFEST.in | 2 +- tox.ini | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a30ad99c..b87cdfda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: strategy: fail-fast: false matrix: - toxenv: ["flake8", "manifest", "docs", "binder"] + toxenv: ["manifest", "docs", "binder"] env: TOXENV: ${{ matrix.toxenv }} steps: diff --git a/MANIFEST.in b/MANIFEST.in index 48d3f063..f369aa73 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,7 +8,7 @@ recursive-include papermill *.txt include setup.py include requirements.txt -include tox_py_installer +include tox_py_installer.sh recursive-include requirements *.txt include docs/requirements.txt include tox.ini diff --git a/tox.ini b/tox.ini index 22f73305..3a51334d 100644 --- a/tox.ini +++ b/tox.ini @@ -63,5 +63,5 @@ deps = .[dev] # Have to use /bin/bash or the `*` will cause that argument to get quoted by the tox command line... allowlist_externals = /bin/bash # Python 3.12 breaks default pip/setuptools versions ... force an upgrade of these before anything else -install_command = /bin/bash ./tox_py_installer {opts} {packages} +install_command = /bin/bash ./tox_py_installer.sh {opts} {packages} commands = pytest -v --maxfail=2 --cov=papermill -W always {posargs} From 0963dab5fa3616b8878fddee5b215e76f7089f30 Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Tue, 14 Nov 2023 06:27:58 +0900 Subject: [PATCH 3/3] One line --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b87cdfda..964799d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,8 +29,7 @@ jobs: set -xe python -VV python -m site - python -m pip install --upgrade \ - pip setuptools wheel coverage[toml] virtualenv tox tox-gh-actions + python -m pip install --upgrade pip setuptools wheel coverage[toml] virtualenv tox tox-gh-actions - name: "Run tox targets for ${{ matrix.python-version }}" run: python -m tox