tests: upgrade pre-commit hooks

This commit is contained in:
Casper da Costa-Luis 2021-01-09 16:20:22 +00:00
parent 9d19cad25f
commit 4a61327214
No known key found for this signature in database
GPG Key ID: 986B408043AE090D
7 changed files with 134 additions and 92 deletions

View File

@ -7,14 +7,33 @@ on:
jobs:
check:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
name: install
runs-on: ubuntu-latest
name: check
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
- run: pip install .
- name: set PYSHA
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: dependencies
run: pip install -U pre-commit
- uses: reviewdog/action-setup@v1
- if: github.event_name != 'schedule'
name: comment
run: |
if [[ $EVENT == pull_request ]]; then
REPORTER=github-pr-review
else
REPORTER=github-check
fi
pre-commit run -a flake8 | reviewdog -f=pep8 -name=flake8 -tee -reporter=$REPORTER -filter-mode nofilter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EVENT: ${{ github.event_name }}
- run: pre-commit run -a --show-diff-on-failure
test-os:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
strategy:

36
.gitignore vendored
View File

@ -1,42 +1,24 @@
*.py[cod]
# C extensions
*.so
__pycache__/
.ipynb_checkpoints/
# Packages
/tqdm/_dist_ver.py
/.eggs/
/tqdm.egg-info
/*.egg*/
/build/
/dist/
/snapcraft.yaml
/tqdm_*_amd64.snap
/tqdm_*.snap
/.dockerignore
# Unit test / coverage reports
.tox/
.coverage
.coverage.*
__pycache__/
.pytest_cache/
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# PyCharm
.idea
# IPython
.ipynb_checkpoints
# asv
.asv/
benchmarks/*.py[co]
/.tox/
/.coverage*
/coverage.xml
/.pytest_cache/
/.asv/
# Sumbodules
/wiki/

42
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,42 @@
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-toml
- id: check-merge-conflict
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: sort-simple-yaml
- id: trailing-whitespace
exclude: ^README.rst$
- repo: local
hooks:
- id: metadata
name: Check metadata
language: system
entry: make testsetup
pass_filenames: false
- id: pytest
name: pytest quick
entry: pytest
args: ['-qq', '--durations=1', '-k=not slow']
pass_filenames: false
types: [python]
language: python
additional_dependencies:
- numpy
- pandas
- pytest-timeout
- pytest-asyncio
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8

View File

@ -123,8 +123,8 @@ Also consider `pip install`ing development utilities:
## Pre-commit Hook
It's probably a good idea to add `[python setup.py] make pre-commit` to
`.git/hooks/pre-commit` for convenient local sanity-checking.
It's probably a good idea to run `pre-commit install` for convenient local
sanity-checking.
## Semantic Versioning

View File

@ -15,7 +15,6 @@
testtimer
distclean
coverclean
pre-commit
prebuildclean
clean
toxclean
@ -112,11 +111,6 @@ distclean:
@+make coverclean
@+make prebuildclean
@+make clean
pre-commit:
# quick sanity checks
@make --no-print-directory testsetup
flake8 -j 8 --count --statistics setup.py .meta/ tqdm/ tests/ examples/
pytest -qq --durations=1 -k "not slow"
prebuildclean:
@+python -c "import shutil; shutil.rmtree('build', True)"
@+python -c "import shutil; shutil.rmtree('dist', True)"

View File

@ -12,6 +12,7 @@ dependencies:
- setuptools_scm
- toml
# test env managers
- pre-commit
- tox
- asv
# tests (native)

110
setup.cfg
View File

@ -1,50 +1,23 @@
[bdist_wheel]
universal = 1
[flake8]
ignore = W503,W504,E722
max_line_length = 88
exclude = .asv,.eggs,.tox,.ipynb_checkpoints,build,dist,.git,__pycache__
[yapf]
coalesce_brackets=True
column_limit=88
each_dict_entry_on_separate_line=False
i18n_comment=NOQA
space_between_ending_comma_and_closing_bracket=False
split_before_named_assigns=False
split_before_closing_bracket=False
[tool:pytest]
timeout=30
log_level=INFO
markers=
asyncio
slow
python_files=tests_*.py
testpaths=tests
addopts=-v --tb=short -rxs -W=error --durations=0 --durations-min=0.1
[metadata]
name = tqdm
url = https://github.com/tqdm/tqdm
project_urls =
Changelog = https://tqdm.github.io/releases
Documentation = https://github.com/tqdm/tqdm#tqdm
Documentation (dev) = https://tqdm.github.io/docs/tqdm
Wiki = https://github.com/tqdm/tqdm/wiki
maintainer = tqdm developers
maintainer_email = python.tqdm@gmail.com
license = MPLv2.0, MIT Licences
license_file = LICENCE
description = Fast, Extensible Progress Meter
long_description = file: README.rst
long_description_content_type = text/x-rst
keywords = progressbar, progressmeter, progress, bar, meter, rate, eta, console, terminal, time
platforms = any
provides = tqdm
name=tqdm
url=https://github.com/tqdm/tqdm
project_urls=
Changelog=https://tqdm.github.io/releases
Documentation=https://github.com/tqdm/tqdm#tqdm
Documentation (dev)=https://tqdm.github.io/docs/tqdm
Wiki=https://github.com/tqdm/tqdm/wiki
maintainer=tqdm developers
maintainer_email=python.tqdm@gmail.com
license=MPLv2.0, MIT Licences
license_file=LICENCE
description=Fast, Extensible Progress Meter
long_description=file: README.rst
long_description_content_type=text/x-rst
keywords=progressbar, progressmeter, progress, bar, meter, rate, eta, console, terminal, time
platforms=any
provides=tqdm
# Trove classifiers (https://pypi.org/pypi?%3Aaction=list_classifiers)
classifiers =
classifiers=
Development Status :: 5 - Production/Stable
Environment :: Console
Environment :: MacOS X
@ -101,16 +74,47 @@ classifiers =
Topic :: Terminals
Topic :: Utilities
[options]
setup_requires = setuptools>=42; setuptools_scm[toml]>=3.4
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
tests_require = pytest; flake8; coverage
include_package_data = True
packages = find:
setup_requires=setuptools>=42; setuptools_scm[toml]>=3.4
python_requires=>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
tests_require=pytest; flake8; coverage
include_package_data=True
packages=find:
[options.extras_require]
dev=py-make>=0.1.0; twine; wheel
telegram=requests
[options.entry_points]
console_scripts =
tqdm = tqdm.cli:main
console_scripts=
tqdm=tqdm.cli:main
[options.packages.find]
exclude = benchmarks, tests
exclude=benchmarks, tests
[bdist_wheel]
universal=1
[flake8]
ignore=W503,W504,E722
max_line_length=88
exclude=.asv,.eggs,.tox,.ipynb_checkpoints,build,dist,.git,__pycache__
[yapf]
coalesce_brackets=True
column_limit=88
each_dict_entry_on_separate_line=False
i18n_comment=NOQA
space_between_ending_comma_and_closing_bracket=False
split_before_named_assigns=False
split_before_closing_bracket=False
[isort]
multi_line_output=4
known_first_party=tqdm,tests
[tool:pytest]
timeout=30
log_level=INFO
markers=
asyncio
slow
python_files=tests_*.py
testpaths=tests
addopts=-v --tb=short -rxs -W=error --durations=0 --durations-min=0.1