diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0d9efa7d..ae6aa643 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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 @@ -102,6 +107,7 @@ repos: - id: tox name: tox --parallel entry: tox --parallel + stages: [pre-push] language: system pass_filenames: false verbose: true @@ -124,6 +130,7 @@ repos: sed -i /__future__/d *.py; pytest --color=yes"; fi' + stages: [pre-push] language: system pass_filenames: false @@ -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 @@ -150,6 +158,7 @@ repos: else sphinx-build -M doctest sphinx sphinx/_build sphinx/index.rst; fi' + stages: [pre-push] language: system pass_filenames: false verbose: true @@ -157,6 +166,7 @@ repos: - 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 diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 6ca1fdf4..855530f4 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -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 `_. +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 @@ -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 `__ git hook scripts so that unit tests and code checks are automatically run locally. This is done as follows: @@ -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 `__ or `tox -`__. 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. +`__. The tests are also installed with +the package, thus can be run in a production system. .. code-block:: bash