Skip to content

Commit

Permalink
Change heavy git hooks from pre-commit to pre-push stage.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauvilsa committed Aug 3, 2023
1 parent 9af3390 commit e0bdc2b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
fail_fast: true
default_install_hook_types: [pre-commit, pre-push]

ci:
skip:
- twine-check
- changelog-check
- circleci-config-validate
- mypy
- tox
- test-py36
Expand Down Expand Up @@ -94,6 +98,7 @@ repos:
- id: mypy
name: mypy jsonargparse*/*.py
entry: bash -c "mypy jsonargparse*/*.py"
stages: [pre-push]
language: system
types: [python]
pass_filenames: false
Expand All @@ -102,6 +107,7 @@ repos:
- id: tox
name: tox --parallel
entry: tox --parallel
stages: [pre-push]
language: system
pass_filenames: false
verbose: true
Expand All @@ -124,6 +130,7 @@ repos:
sed -i /__future__/d *.py;
pytest --color=yes";
fi'
stages: [pre-push]
language: system
pass_filenames: false

Expand All @@ -138,6 +145,7 @@ repos:
cd "$TEST_DIR";
sed -i "/^from __future__ import annotations$/d" *.py;
pytest $TEST_DIR;'
stages: [pre-push]
language: system
pass_filenames: false

Expand All @@ -150,13 +158,15 @@ repos:
else
sphinx-build -M doctest sphinx sphinx/_build sphinx/index.rst;
fi'
stages: [pre-push]
language: system
pass_filenames: false
verbose: true

- id: coverage
name: pytest -v -s --cov --cov-report=term --cov-report=html
entry: pytest -v -s --cov --cov-report=term --cov-report=html
stages: [pre-push]
language: system
pass_filenames: false
verbose: true
26 changes: 22 additions & 4 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Contributions to jsonargparse are very welcome, be it just to create `issues
proposing enhancements, or more directly by creating `pull requests
<https://github.com/omni-us/jsonargparse/pulls>`_.

Development environment
-----------------------

If you intend to work with the source code, note that this project does not
include any ``requirements.txt`` file. This is by intention. To make it very
clear what are the requirements for different use cases, all the requirements of
Expand All @@ -32,6 +35,9 @@ The crucial step is installing the requirements which would be done by running:
pip install -e ".[dev,all]"
pre-commit
----------

Please also install the `pre-commit <https://pre-commit.com/>`__ git hook
scripts so that unit tests and code checks are automatically run locally. This
is done as follows:
Expand All @@ -40,19 +46,31 @@ is done as follows:
pre-commit install
.. note::

The ``.pre-commit-config.yaml`` file was changed such that some hooks are
now run on ``pre-push``. If you have an old development environment, please
run ``pre-commit install`` again to update the git hooks.

Documentation
-------------

To build the documentation run:

.. code-block:: bash
sphinx-build sphinx sphinx/_build sphinx/index.rst
Then to see it, open the file ``sphinx/_build/index.html`` in a browser.
Then to see the built documentation, open the file ``sphinx/_build/index.html``
in a browser.

Tests
-----

Running the unit tests can be done either using using `pytest
<https://docs.pytest.org/>`__ or `tox
<https://tox.readthedocs.io/en/stable/>`__. For convenience, the ``setup.py``
script can run the tests and create an html coverage report. The tests are also
installed with the package, thus can be run in a production system.
<https://tox.readthedocs.io/en/stable/>`__. The tests are also installed with
the package, thus can be run in a production system.

.. code-block:: bash
Expand Down

0 comments on commit e0bdc2b

Please sign in to comment.