Skip to content

Commit

Permalink
[INF] Install pre-commit into repository pyjanitor-devs#601 (pyjanito…
Browse files Browse the repository at this point in the history
…r-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
  • Loading branch information
ericmjl authored and hectormz committed Oct 29, 2019
1 parent 38709e2 commit 8dcf387
Show file tree
Hide file tree
Showing 117 changed files with 17,193 additions and 17,163 deletions.
1 change: 0 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ tag = True
[bumpversion:file:setup.py]

[bumpversion:file:janitor/__init__.py]

2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You can provide the optional information later. -->

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

# Minimally Reproducible Code

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/documentation_fix.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ about: Use this issue tracker template if you'd like to propose a fix to the doc
# Brief Description of Fix

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

Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/new_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ I'd like to write a notebook that...

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

-
-
-
-
-
-

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

Expand Down
14 changes: 7 additions & 7 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Thank you for your PR!
<!-- Thank you for your PR!
BEFORE YOU CONTINUE! Please add the appropriate three-letter abbreviation to your title.
Expand All @@ -15,11 +15,11 @@ Finally, as commits come in, don't forget to regularly rebase!

# PR Description

Please describe the changes proposed in the pull request:
Please describe the changes proposed in the pull request:

-
-
-
-
-
-

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

Expand Down Expand Up @@ -52,9 +52,9 @@ To do a very quick check that everything is correct, follow these steps below:
- pycodestyle checking
- running the test suite
- docs build

Once done, please check off the check-box above.

If `make check` does not work for you, you can execute the commands listed in the Makefile individually.

## Code Changes
Expand Down
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/timothycrosley/isort
rev: 4.3.21
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 19.3b0
hooks:
- id: black
args: [-l 79]
24 changes: 16 additions & 8 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Ready to contribute? Here's how to setup ``pyjanitor`` for local development.

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!


.. 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``::
$ conda install -c defaults -c conda-forge make
Expand All @@ -36,7 +35,17 @@ This also installs your new conda environment as a Jupyter-accessible kernel. To

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

4. You should also be able to build the docs locally. To do this, from the main ``pyjanitor`` directory::
4. (Optional) Install the pre-commit hooks.

As of 29 October 2019, pre-commit hooks are available to run code formatting checks automagically
before git commits happen. If you did not have these installed before, run the following commands:

# Update your environment to install pre-commit
$ conda env update -f environment-dev.yml
# Install pre-commit hooks
$ pre-commit install-hooks

5. You should also be able to build the docs locally. To do this, from the main ``pyjanitor`` directory::

$ make docs

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

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.

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

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

6. Create a branch for local development:
7. Create a branch for local development:

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.

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

Now you can make your changes locally.

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

$ make check

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

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.

8. Commit your changes and push your branch to GitHub::
9. Commit your changes and push your branch to GitHub::

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

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``).
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``).



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

3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ install:

@echo "Registering current virtual environment as a Jupyter Python kernel..."
$(ACTIVATE) && python -m ipykernel install --user --name pyjanitor-dev --display-name "PyJanitor development"

@echo "Installing pre-commit hooks"
$(ACTIVATE) && pre-commit install
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ The final way is to use the `pipe()`_ method:
Contributing
------------

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

Adding new functionality
Expand Down
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.add_column.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.add\_column

.. currentmodule:: janitor

.. autofunction:: add_column
.. autofunction:: add_column
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.add_columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.add\_columns

.. currentmodule:: janitor

.. autofunction:: add_columns
.. autofunction:: add_columns
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.bin_numeric.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.bin\_numeric

.. currentmodule:: janitor

.. autofunction:: bin_numeric
.. autofunction:: bin_numeric
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.change_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.change\_type

.. currentmodule:: janitor

.. autofunction:: change_type
.. autofunction:: change_type
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.clean_names.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.clean\_names

.. currentmodule:: janitor

.. autofunction:: clean_names
.. autofunction:: clean_names
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.coalesce.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.coalesce

.. currentmodule:: janitor

.. autofunction:: coalesce
.. autofunction:: coalesce
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.collapse_levels.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.collapse\_levels

.. currentmodule:: janitor

.. autofunction:: collapse_levels
.. autofunction:: collapse_levels
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.concatenate_columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.concatenate\_columns

.. currentmodule:: janitor

.. autofunction:: concatenate_columns
.. autofunction:: concatenate_columns
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.convert_excel_date.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.convert\_excel\_date

.. currentmodule:: janitor

.. autofunction:: convert_excel_date
.. autofunction:: convert_excel_date
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.convert_matlab_date.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.convert\_matlab\_date

.. currentmodule:: janitor

.. autofunction:: convert_matlab_date
.. autofunction:: convert_matlab_date
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.convert_unix_date.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.convert\_unix\_date

.. currentmodule:: janitor

.. autofunction:: convert_unix_date
.. autofunction:: convert_unix_date
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.currency\_column\_to\_numeric

.. currentmodule:: janitor

.. autofunction:: currency_column_to_numeric
.. autofunction:: currency_column_to_numeric
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.deconcatenate_column.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.deconcatenate\_column

.. currentmodule:: janitor

.. autofunction:: deconcatenate_column
.. autofunction:: deconcatenate_column
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.drop_duplicate_columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.drop\_duplicate\_columns

.. currentmodule:: janitor

.. autofunction:: drop_duplicate_columns
.. autofunction:: drop_duplicate_columns
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.dropnotnull.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.dropnotnull

.. currentmodule:: janitor

.. autofunction:: dropnotnull
.. autofunction:: dropnotnull
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.encode_categorical.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.encode\_categorical

.. currentmodule:: janitor

.. autofunction:: encode_categorical
.. autofunction:: encode_categorical
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.expand_column.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.expand\_column

.. currentmodule:: janitor

.. autofunction:: expand_column
.. autofunction:: expand_column
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.fill_empty.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.fill\_empty

.. currentmodule:: janitor

.. autofunction:: fill_empty
.. autofunction:: fill_empty
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.filter_column_isin.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.filter\_column\_isin

.. currentmodule:: janitor

.. autofunction:: filter_column_isin
.. autofunction:: filter_column_isin
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.filter_date.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.filter\_date

.. currentmodule:: janitor

.. autofunction:: filter_date
.. autofunction:: filter_date
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.filter_on.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.filter\_on

.. currentmodule:: janitor

.. autofunction:: filter_on
.. autofunction:: filter_on
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.filter_string.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.filter\_string

.. currentmodule:: janitor

.. autofunction:: filter_string
.. autofunction:: filter_string
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.find_replace.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.find\_replace

.. currentmodule:: janitor

.. autofunction:: find_replace
.. autofunction:: find_replace
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.get_dupes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.get\_dupes

.. currentmodule:: janitor

.. autofunction:: get_dupes
.. autofunction:: get_dupes
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.get_features_targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.get\_features\_targets

.. currentmodule:: janitor

.. autofunction:: get_features_targets
.. autofunction:: get_features_targets
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.groupby_agg.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.groupby\_agg

.. currentmodule:: janitor

.. autofunction:: groupby_agg
.. autofunction:: groupby_agg
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.impute.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.impute

.. currentmodule:: janitor

.. autofunction:: impute
.. autofunction:: impute
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.label_encode.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.label\_encode

.. currentmodule:: janitor

.. autofunction:: label_encode
.. autofunction:: label_encode
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.limit_column_characters.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.limit\_column\_characters

.. currentmodule:: janitor

.. autofunction:: limit_column_characters
.. autofunction:: limit_column_characters
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.min_max_scale.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.min\_max\_scale

.. currentmodule:: janitor

.. autofunction:: min_max_scale
.. autofunction:: min_max_scale
2 changes: 1 addition & 1 deletion docs/janitor.functions/janitor.remove_columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ janitor.remove\_columns

.. currentmodule:: janitor

.. autofunction:: remove_columns
.. autofunction:: remove_columns
Loading

0 comments on commit 8dcf387

Please sign in to comment.