Skip to content

Commit 598ebf5

Browse files
committed
Make pre-commit-hooks more consistent across projects.
1 parent df8f825 commit 598ebf5

7 files changed

+56
-97
lines changed

.github/workflows/main.yml

+4-18
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,53 @@
1+
---
12
name: main
23
on:
34
push:
4-
branches:
5-
- main
5+
branches: [main]
66
pull_request:
77
branches:
8-
- '*'
9-
8+
- '*'
109
# Automatically cancel a previous run.
1110
concurrency:
1211
group: ${{ github.head_ref || github.run_id }}
1312
cancel-in-progress: true
14-
1513
jobs:
16-
1714
run-tests:
18-
1915
name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }}
2016
runs-on: ${{ matrix.os }}
21-
2217
strategy:
2318
fail-fast: false
2419
matrix:
25-
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
20+
os: [ubuntu-latest, macos-latest, windows-latest]
2621
python-version: ['3.9', '3.10', '3.11']
27-
2822
steps:
2923
- uses: actions/checkout@v2
3024
- uses: conda-incubator/setup-miniconda@v2
3125
with:
3226
auto-update-conda: true
3327
python-version: ${{ matrix.python-version }}
34-
3528
- name: Install core dependencies.
3629
shell: bash -l {0}
3730
run: conda install -c conda-forge tox-conda
38-
3931
- name: Run pytest.
4032
shell: bash -l {0}
4133
run: tox -e pytest -- -m "not slow" --cov-report=xml --cov=./
42-
4334
- name: Upload coverage report.
4435
if: runner.os == 'Linux' && matrix.python-version == '3.9'
4536
uses: codecov/codecov-action@v1
4637
with:
4738
token: ${{ secrets.CODECOV_TOKEN }}
48-
4939
docs:
50-
5140
name: Run documentation.
5241
runs-on: ubuntu-latest
53-
5442
steps:
5543
- uses: actions/checkout@v2
5644
- uses: conda-incubator/setup-miniconda@v2
5745
with:
5846
auto-update-conda: true
5947
python-version: 3.9
60-
6148
- name: Install core dependencies.
6249
shell: bash -l {0}
6350
run: conda install -c conda-forge tox-conda
64-
6551
- name: Build docs
6652
shell: bash -l {0}
6753
run: tox -e sphinx

.github/workflows/publish-to-pypi.yml

+24-27
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
1+
---
12
name: PyPI
2-
33
on: push
4-
54
jobs:
65
build-n-publish:
76
name: Build and publish Python 🐍 distributions 📦 to PyPI
87
runs-on: ubuntu-latest
98
steps:
10-
- uses: actions/checkout@master
11-
12-
- name: Set up Python 3.8
13-
uses: actions/setup-python@v1
14-
with:
15-
python-version: 3.8
16-
17-
- name: Install pypa/build
18-
run: >-
19-
python -m
20-
pip install
21-
build
22-
--user
23-
- name: Build a binary wheel and a source tarball
24-
run: >-
25-
python -m
26-
build
27-
--sdist
28-
--wheel
29-
--outdir dist/
30-
- name: Publish distribution 📦 to PyPI
31-
if: startsWith(github.ref, 'refs/tags')
32-
uses: pypa/gh-action-pypi-publish@master
33-
with:
34-
password: ${{ secrets.PYPI_API_TOKEN }}
9+
- uses: actions/checkout@master
10+
- name: Set up Python 3.8
11+
uses: actions/setup-python@v1
12+
with:
13+
python-version: 3.8
14+
- name: Install pypa/build
15+
run: >-
16+
python -m
17+
pip install
18+
build
19+
--user
20+
- name: Build a binary wheel and a source tarball
21+
run: >-
22+
python -m
23+
build
24+
--sdist
25+
--wheel
26+
--outdir dist/
27+
- name: Publish distribution 📦 to PyPI
28+
if: startsWith(github.ref, 'refs/tags')
29+
uses: pypa/gh-action-pypi-publish@master
30+
with:
31+
password: ${{ secrets.PYPI_API_TOKEN }}

.pre-commit-config.yaml

+17-27
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
1+
---
12
repos:
23
- repo: meta
34
hooks:
45
- id: check-hooks-apply
56
- id: check-useless-excludes
67
# - id: identity # Prints all files passed to pre-commits. Debugging.
8+
- repo: https://github.com/lyz-code/yamlfix
9+
rev: 1.13.0
10+
hooks:
11+
- id: yamlfix
712
- repo: https://github.com/pre-commit/pre-commit-hooks
813
rev: v4.4.0
914
hooks:
1015
- id: check-added-large-files
11-
args:
12-
- --maxkb=1300
16+
args: [--maxkb=1300]
1317
- id: check-case-conflict
1418
- id: check-merge-conflict
1519
- id: check-vcs-permalinks
20+
- id: check-yaml
1621
- id: check-toml
1722
- id: debug-statements
1823
- id: end-of-file-fixer
1924
- id: fix-byte-order-marker
20-
types:
21-
- text
25+
types: [text]
2226
- id: forbid-submodules
2327
- id: mixed-line-ending
24-
args:
25-
- --fix=lf
28+
args: [--fix=lf]
2629
description: Forces to replace line ending by the UNIX 'lf' character.
2730
- id: name-tests-test
28-
args:
29-
- --pytest-test-first
31+
args: [--pytest-test-first]
3032
- id: no-commit-to-branch
31-
args:
32-
- --branch
33-
- main
33+
args: [--branch, main]
3434
- id: trailing-whitespace
3535
- id: check-ast
3636
- id: check-docstring-first
37+
- repo: https://github.com/adrienverge/yamllint.git
38+
rev: v1.32.0
39+
hooks:
40+
- id: yamllint
3741
- repo: https://github.com/psf/black
3842
rev: 23.7.0
3943
hooks:
@@ -43,17 +47,6 @@ repos:
4347
rev: 1.15.0
4448
hooks:
4549
- id: blacken-docs
46-
- repo: https://github.com/PyCQA/docformatter
47-
rev: v1.7.5
48-
hooks:
49-
- id: docformatter
50-
args:
51-
- --in-place
52-
- --wrap-summaries
53-
- '88'
54-
- --wrap-descriptions
55-
- '88'
56-
- --blank
5750
- repo: https://github.com/astral-sh/ruff-pre-commit
5851
rev: v0.0.282
5952
hooks:
@@ -71,10 +64,7 @@ repos:
7164
rev: '0.49'
7265
hooks:
7366
- id: check-manifest
74-
args:
75-
- --no-build-isolation
76-
additional_dependencies:
77-
- setuptools-scm
78-
- toml
67+
args: [--no-build-isolation]
68+
additional_dependencies: [setuptools-scm, toml]
7969
ci:
8070
autoupdate_schedule: monthly

.readthedocs.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1+
---
12
version: 2
2-
33
build:
44
image: latest
5-
65
python:
76
version: 3.8
8-
97
conda:
108
environment: docs/rtd_environment.yml

codecov.yml

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1+
---
12
codecov:
23
notify:
3-
require_ci_to_pass: yes
4-
4+
require_ci_to_pass: true
55
coverage:
66
precision: 2
77
round: down
8-
range: "50...100"
8+
range: 50...100
99
status:
1010
patch:
1111
default:
1212
target: 80%
1313
project:
1414
default:
1515
target: 80%
16-
17-
ignore:
18-
- ".tox/**/*"
19-
- "setup.py"
16+
ignore: [.tox/**/*, setup.py]

docs/rtd_environment.yml

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
channels:
2-
- conda-forge
3-
- nodefaults
4-
1+
---
2+
channels: [conda-forge, nodefaults]
53
dependencies:
64
- python=3.9
75
- pip
@@ -17,6 +15,4 @@ dependencies:
1715
- sphinx-copybutton
1816
- sphinx-panels
1917
- pydata-sphinx-theme>=0.3.0
20-
21-
- pip:
22-
- ../
18+
- pip: [../]

environment.yml

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1+
---
12
name: dags
2-
3-
channels:
4-
- conda-forge
5-
- nodefaults
6-
3+
channels: [conda-forge, nodefaults]
74
dependencies:
85
- python >=3.9
96
- pip
@@ -30,6 +27,4 @@ dependencies:
3027
# Development
3128
- jupyterlab
3229
- nbsphinx
33-
34-
- pip:
35-
- -e .
30+
- pip: [-e .]

0 commit comments

Comments
 (0)