8000 Add pre-commit config and dev instructions · matplotlib/matplotlib@c2729bd · GitHub
[go: up one dir, main page]

Skip to content

Commit c2729bd

Browse files
committed
Add pre-commit config and dev instructions
Update pre-commit hooks rst format Disable autofixes on PRs Unless manually triggered. See https://pre-commit.ci/#configuration add pre-commit to environment.yml Slow down autoupdate schedule alphabetize Add sentence about where pre-commit config is Add excludes to pre-commit config Otherwise end of lines of test images will get fixed, this also ignores all the prev_whats_new and prev_api_changes as well as vendored components (agg, gitwash) pre-comit config
1 parent 993c1bc commit c2729bd

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

.pre-commit-config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
ci:
2+
autofix_prs: false
3+
autoupdate_schedule: 'quarterly'
4+
exclude: |
5+
(?x)^(
6+
extern|
7+
lib/matplotlib/mpl-data|
8+
doc/devel/gitwash|
9+
doc/users/prev|
10+
doc/api/prev|
11+
lib/matplotlib/tests/tinypages
12+
)
13+
repos:
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v4.0.1
16+
hooks:
17+
- id: check-added-large-files
18+
- id: check-docstring-first
19+
- id: end-of-file-fixer
20+
exclude_types: [svg]
21+
- id: mixed-line-ending
22+
- id: trailing-whitespace
23+
exclude_types: [svg]
24+
- repo: https://github.com/pycqa/flake8
25+
rev: 3.9.2
26+
hooks:
27+
- id: flake8
28+
additional_dependencies: [pydocstyle>5.1.0, flake8-docstrings>1.4.0]
29+
args: ["--docstring-convention=all"]

doc/devel/development_setup.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ true for ``*.py`` files. If you change the C-extension source (which might
6060
also happen if you change branches) you will have to re-run
6161
``python -m pip install -ve .``
6262

63+
Installing pre-commit hooks
64+
===========================
65+
You can optionally install `pre-commit <https://pre-commit.com/>`_ hooks.
66+
These will automatically check flake8 and other style issues when you run
67+
``git commit``. The hooks are defined in the top level
68+
``.pre-commit-config.yaml`` file. To install the hooks ::
69+
70+
pip install pre-commit
71+
pre-commit install
72+
6373
Installing additional dependencies for development
6474
==================================================
6575
See :ref:`development-dependencies`.

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ dependencies:
4848
- nbformat!=5.0.0,!=5.0.1
4949
- pandas!=0.25.0
5050
- pikepdf
51+
- pre-commit
5152
- pydocstyle>=5.1.0
5253
- pytest!=4.6.0,!=5.4.0
5354
- pytest-cov

0 commit comments

Comments
 (0)
0