Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move black & flake8 to precommit #739

Merged
merged 3 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ 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
Expand All @@ -47,7 +46,7 @@ jobs:
strategy:
fail-fast: false
matrix:
toxenv: ["flake8", "black", "manifest", "docs", "binder"]
toxenv: ["manifest", "docs", "binder"]
env:
TOXENV: ${{ matrix.toxenv }}
steps:
Expand Down
28 changes: 19 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -38,21 +38,31 @@ 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:
- mdformat-gfm
- 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"
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

[tool.black]
line-length = 100
target-version = ['py312']
include = '\.pyi?$'
exclude = '''
/(
Expand Down
20 changes: 2 additions & 18 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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 =
Expand All @@ -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
Expand Down Expand Up @@ -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 =
Expand All @@ -69,15 +55,13 @@ 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
# 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}
File renamed without changes.