Contributions to jsonargparse are very welcome, be it just to create issues for reporting bugs and proposing enhancements, or more directly by creating pull requests.
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
the project are stored in the file pyproject.toml
. The basic runtime
requirements are defined in dependencies
. Requirements for optional features
stored in [project.optional-dependencies]
. Also in the same section there
are requirements for testing, development and documentation building: test
,
test-no-urls
, dev
and doc
.
The recommended way to work with the source code is the following. First clone the repository, then create a virtual environment, activate it and finally install the development requirements. More precisely the steps are:
git clone https://github.com/omni-us/jsonargparse.git
cd jsonargparse
virtualenv -p python3 venv
. venv/bin/activate
The crucial step is installing the requirements which would be done by running:
pip install -e ".[dev,all]"
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:
pre-commit install
To build the documentation run:
sphinx-build sphinx sphinx/_build sphinx/index.rst
Then to see it, open the file sphinx/_build/index.html
in a browser.
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.
tox # Run tests using tox on available python versions
pytest # Run tests using pytest on the python of the environment
pytest --cov # Run tests and generate coverage report
python3 -m jsonargparse_tests # Run tests for installed package (requires pytest and pytest-subtests)