Skip to content

Commit 5189025

Browse files
committed
Added pre-commit-config.yaml
1 parent af5b2a2 commit 5189025

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: https://gitlab.com/pycqa/flake8
3+
rev: 3.7.7
4+
hooks:
5+
- id: flake8
6+
language: python_venv
7+
- repo: https://github.com/pre-commit/mirrors-isort
8+
rev: v4.3.20
9+
hooks:
10+
- id: isort
11+
language: python_venv
12+
- repo: https://github.com/ambv/black
13+
rev: stable
14+
hooks:
15+
- id: black
16+
language_version: python3.7

doc/source/development/contributing.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ being rendered properly) and it also validates the doctests. It is possible to
490490
run the checks independently by using the parameters ``lint``, ``patterns`` and
491491
``doctests`` (e.g. ``./ci/code_checks.sh lint``).
492492

493+
We recommend using :ref:`contributing.pre_commit`. These will run a few fast
494+
checks each time you make a commit.
495+
493496
In addition, because a lot of people use our library, it is important that we
494497
do not make sudden changes to the code that could have the potential to break
495498
a lot of user code as a result, that is, we need it to be as *backwards compatible*
@@ -650,6 +653,19 @@ The `--recursive` flag can be passed to sort all files in a directory.
650653

651654
You can then verify the changes look ok, then git :ref:`commit <contributing.commit-code>` and :ref:`push <contributing.push-code>`.
652655

656+
.. _contributing.pre_commit:
657+
658+
Pre-Commit Hooks
659+
~~~~~~~~~~~~~~~~
660+
661+
Install the `pre commit <https://github.com/pre-commit/pre-commit>`_ tool. Then, from the
662+
root of the ``pandas`` repository, run ``pre-commit install`` to install a few plugins
663+
like black, isort, and flake8. These tools will automatically be run on each commit. If the
664+
tool reformats automatically (black, isort) then you can preview the changes before before
665+
staging and committing with ``git diff``.
666+
667+
You can skip the checks with ``git commit --no-verify``.
668+
653669
Backwards compatibility
654670
~~~~~~~~~~~~~~~~~~~~~~~
655671

0 commit comments

Comments
 (0)