Skip to content

Commit 8dcf387

Browse files
ericmjlhectormz
authored andcommitted
[INF] Install pre-commit into repository pyjanitor-devs#601 (pyjanitor-devs#602)
* Add pre-commit to dev env spec * add pre-commit * Pre-commit text file fixes * Added pre-commit hooks to install command * Add instructions on pre-commit hooks * add default -l 79 to black * fix environment yaml spec filename * add pre-commit to requirements-dev.txt
1 parent 38709e2 commit 8dcf387

File tree

117 files changed

+17193
-17163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+17193
-17163
lines changed

.bumpversion.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ tag = True
66
[bumpversion:file:setup.py]
77

88
[bumpversion:file:janitor/__init__.py]
9-

.github/ISSUE_TEMPLATE/bug_report.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ You can provide the optional information later. -->
1414

1515
- Operating system: macOS/Linux/Windows <!-- delete the appropriate ones -->
1616
- OS details (optional): <!-- e.g. version, or Linux distro -->
17-
- Python version (required):
17+
- Python version (required):
1818

1919
# Minimally Reproducible Code
2020

.github/ISSUE_TEMPLATE/documentation_fix.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ about: Use this issue tracker template if you'd like to propose a fix to the doc
66
# Brief Description of Fix
77

88
<!-- Please describe the fix in terms of a "before" and "after". In other words, what's not so good about the current docs
9-
page, and what you would like to see it become.
9+
page, and what you would like to see it become.
1010
1111
Example starter wording is provided. -->
1212

.github/ISSUE_TEMPLATE/new_examples.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ I'd like to write a notebook that...
1111

1212
(optional but encouraged) This notebook would likely cover the following pyjanitor functions:
1313

14-
-
15-
-
16-
-
14+
-
15+
-
16+
-
1717

1818
<!-- It's ok if you don't eventually use those functions, by the way! -->
1919

.github/pull_request_template.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- Thank you for your PR!
1+
<!-- Thank you for your PR!
22
33
BEFORE YOU CONTINUE! Please add the appropriate three-letter abbreviation to your title.
44
@@ -15,11 +15,11 @@ Finally, as commits come in, don't forget to regularly rebase!
1515

1616
# PR Description
1717

18-
Please describe the changes proposed in the pull request:
18+
Please describe the changes proposed in the pull request:
1919

20-
-
21-
-
22-
-
20+
-
21+
-
22+
-
2323

2424
<!-- Doing so provides maintainers with context on what the PR is, and can help us more effectively review your PR. -->
2525

@@ -52,9 +52,9 @@ To do a very quick check that everything is correct, follow these steps below:
5252
- pycodestyle checking
5353
- running the test suite
5454
- docs build
55-
55+
5656
Once done, please check off the check-box above.
57-
57+
5858
If `make check` does not work for you, you can execute the commands listed in the Makefile individually.
5959

6060
## Code Changes

.pre-commit-config.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v2.4.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/timothycrosley/isort
12+
rev: 4.3.21
13+
hooks:
14+
- id: isort
15+
- repo: https://github.com/psf/black
16+
rev: 19.3b0
17+
hooks:
18+
- id: black
19+
args: [-l 79]

CONTRIBUTING.rst

+16-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Ready to contribute? Here's how to setup ``pyjanitor`` for local development.
2727

2828
This also installs your new conda environment as a Jupyter-accessible kernel. To run correctly inside the environment, make sure you select the correct kernel from the top right corner of JupyterLab!
2929

30-
3130
.. note :: If you are on Windows, you may need to install ``make`` before you can run the install. You can get it from ``conda-forge``::
3231
3332
$ conda install -c defaults -c conda-forge make
@@ -36,7 +35,17 @@ This also installs your new conda environment as a Jupyter-accessible kernel. To
3635

3736
.. note:: For PyCharm users, here are some `instructions <PYCHARM_USERS.html>`__ to get your Conda environment set up.
3837

39-
4. You should also be able to build the docs locally. To do this, from the main ``pyjanitor`` directory::
38+
4. (Optional) Install the pre-commit hooks.
39+
40+
As of 29 October 2019, pre-commit hooks are available to run code formatting checks automagically
41+
before git commits happen. If you did not have these installed before, run the following commands:
42+
43+
# Update your environment to install pre-commit
44+
$ conda env update -f environment-dev.yml
45+
# Install pre-commit hooks
46+
$ pre-commit install-hooks
47+
48+
5. You should also be able to build the docs locally. To do this, from the main ``pyjanitor`` directory::
4049

4150
$ make docs
4251

@@ -53,11 +62,11 @@ The command above allows you to view the documentation locally in your browser.
5362

5463
Sphinx uses `rst files (restructured text) <http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_ as its markdown language. To edit documentation, go to the rst file that corresponds to the html file you would like to edit. Make the changes directly in the rst file with the correct markup. Save the file, and rebuild the html pages using the same commands as above to see what your changes look like in html.
5564

56-
5. Submit an issue to the ``pyjanitor`` GitHub issue tracker describing your planned changes: https://github.com/ericmjl/pyjanitor/issues
65+
6. Submit an issue to the ``pyjanitor`` GitHub issue tracker describing your planned changes: https://github.com/ericmjl/pyjanitor/issues
5766

5867
This helps us keep track of who is working on what.
5968

60-
6. Create a branch for local development:
69+
7. Create a branch for local development:
6170

6271
New features added to ``pyjanitor`` should be done in a new branch you have based off of the latest version of the ``dev`` branch. The protocol for ``pyjanitor`` branches for new development is that the ``master`` branch mirrors the current version of ``pyjanitor`` on PyPI, whereas the ``dev`` branch is for additional features for an eventual new official version of the package which might be deemed slightly less stable. Once more confident in the reliability/suitability for introducing a batch of changes into the official version, the ``dev`` branch is then merged into ``master`` and the PyPI package is subsequently updated.
6372

@@ -67,7 +76,7 @@ To base a branch directly off of ``dev`` instead of ``master``, create a new one
6776

6877
Now you can make your changes locally.
6978

70-
7. When you're done making changes, check that your changes are properly formatted and that all tests still pass::
79+
8. When you're done making changes, check that your changes are properly formatted and that all tests still pass::
7180

7281
$ make check
7382

@@ -85,13 +94,13 @@ All of these commands are available when you create the development environment.
8594

8695
When you run the test locally, the tests in ``chemistry.py``, ``biology.py``, ``spark.py`` are automatically skipped if you don't have the optional dependencies (e.g. ``rdkit``) installed.
8796

88-
8. Commit your changes and push your branch to GitHub::
97+
9. Commit your changes and push your branch to GitHub::
8998

9099
$ git add .
91100
$ git commit -m "Your detailed description of your changes."
92101
$ git push origin name-of-your-bugfix-or-feature
93102

94-
9. Submit a pull request through the GitHub website. When you are picking out which branch to merge into, be sure to select ``dev`` (not ``master``).
103+
10. Submit a pull request through the GitHub website. When you are picking out which branch to merge into, be sure to select ``dev`` (not ``master``).
95104

96105

97106

@@ -118,4 +127,3 @@ Before you submit a pull request, check that it meets these guidelines:
118127
2. If the pull request adds functionality, the docs should be updated. Put
119128
your new functionality into a function with a docstring, and add the
120129
feature to the list in README.rst.
121-

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@ install:
4949

5050
@echo "Registering current virtual environment as a Jupyter Python kernel..."
5151
$(ACTIVATE) && python -m ipykernel install --user --name pyjanitor-dev --display-name "PyJanitor development"
52+
53+
@echo "Installing pre-commit hooks"
54+
$(ACTIVATE) && pre-commit install

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ The final way is to use the `pipe()`_ method:
270270
Contributing
271271
------------
272272

273-
Follow `contribution docs
273+
Follow `contribution docs
274274
<https://pyjanitor.readthedocs.io/contributing.html>`_ for a full description of the process of contributing to ``pyjanitor``.
275275

276276
Adding new functionality

docs/janitor.functions/janitor.add_column.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.add\_column
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: add_column
6+
.. autofunction:: add_column

docs/janitor.functions/janitor.add_columns.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.add\_columns
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: add_columns
6+
.. autofunction:: add_columns

docs/janitor.functions/janitor.bin_numeric.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.bin\_numeric
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: bin_numeric
6+
.. autofunction:: bin_numeric

docs/janitor.functions/janitor.change_type.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.change\_type
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: change_type
6+
.. autofunction:: change_type

docs/janitor.functions/janitor.clean_names.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.clean\_names
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: clean_names
6+
.. autofunction:: clean_names

docs/janitor.functions/janitor.coalesce.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.coalesce
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: coalesce
6+
.. autofunction:: coalesce

docs/janitor.functions/janitor.collapse_levels.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.collapse\_levels
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: collapse_levels
6+
.. autofunction:: collapse_levels

docs/janitor.functions/janitor.concatenate_columns.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.concatenate\_columns
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: concatenate_columns
6+
.. autofunction:: concatenate_columns

docs/janitor.functions/janitor.convert_excel_date.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.convert\_excel\_date
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: convert_excel_date
6+
.. autofunction:: convert_excel_date

docs/janitor.functions/janitor.convert_matlab_date.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.convert\_matlab\_date
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: convert_matlab_date
6+
.. autofunction:: convert_matlab_date

docs/janitor.functions/janitor.convert_unix_date.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.convert\_unix\_date
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: convert_unix_date
6+
.. autofunction:: convert_unix_date

docs/janitor.functions/janitor.currency_column_to_numeric.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.currency\_column\_to\_numeric
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: currency_column_to_numeric
6+
.. autofunction:: currency_column_to_numeric

docs/janitor.functions/janitor.deconcatenate_column.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.deconcatenate\_column
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: deconcatenate_column
6+
.. autofunction:: deconcatenate_column

docs/janitor.functions/janitor.drop_duplicate_columns.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.drop\_duplicate\_columns
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: drop_duplicate_columns
6+
.. autofunction:: drop_duplicate_columns

docs/janitor.functions/janitor.dropnotnull.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.dropnotnull
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: dropnotnull
6+
.. autofunction:: dropnotnull

docs/janitor.functions/janitor.encode_categorical.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.encode\_categorical
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: encode_categorical
6+
.. autofunction:: encode_categorical

docs/janitor.functions/janitor.expand_column.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.expand\_column
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: expand_column
6+
.. autofunction:: expand_column

docs/janitor.functions/janitor.fill_empty.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.fill\_empty
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: fill_empty
6+
.. autofunction:: fill_empty

docs/janitor.functions/janitor.filter_column_isin.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.filter\_column\_isin
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: filter_column_isin
6+
.. autofunction:: filter_column_isin

docs/janitor.functions/janitor.filter_date.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.filter\_date
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: filter_date
6+
.. autofunction:: filter_date

docs/janitor.functions/janitor.filter_on.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.filter\_on
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: filter_on
6+
.. autofunction:: filter_on

docs/janitor.functions/janitor.filter_string.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.filter\_string
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: filter_string
6+
.. autofunction:: filter_string

docs/janitor.functions/janitor.find_replace.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.find\_replace
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: find_replace
6+
.. autofunction:: find_replace

docs/janitor.functions/janitor.get_dupes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.get\_dupes
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: get_dupes
6+
.. autofunction:: get_dupes

docs/janitor.functions/janitor.get_features_targets.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.get\_features\_targets
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: get_features_targets
6+
.. autofunction:: get_features_targets

docs/janitor.functions/janitor.groupby_agg.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.groupby\_agg
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: groupby_agg
6+
.. autofunction:: groupby_agg

docs/janitor.functions/janitor.impute.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.impute
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: impute
6+
.. autofunction:: impute

docs/janitor.functions/janitor.label_encode.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.label\_encode
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: label_encode
6+
.. autofunction:: label_encode

docs/janitor.functions/janitor.limit_column_characters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.limit\_column\_characters
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: limit_column_characters
6+
.. autofunction:: limit_column_characters

docs/janitor.functions/janitor.min_max_scale.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.min\_max\_scale
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: min_max_scale
6+
.. autofunction:: min_max_scale

docs/janitor.functions/janitor.remove_columns.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ janitor.remove\_columns
33

44
.. currentmodule:: janitor
55

6-
.. autofunction:: remove_columns
6+
.. autofunction:: remove_columns

0 commit comments

Comments
 (0)