Contributing to Tianshou¶
Install Develop Version¶
To install Tianshou in an “editable” mode, run
$ pip install -e ".[dev]"
in the main directory. This installation is removable by
$ python setup.py develop --uninstall
PEP8 Code Style Check¶
We follow PEP8 python code style. To check, in the main directory, run:
$ flake8 . --count --show-source --statistics
This command will run automatic tests in the main directory
$ pytest test --cov tianshou -s --durations 0 -v
Test by GitHub Actions¶
Actionsbutton in your own repo:
Click the green button:
You will see
Actions Enabled.on the top of html page.
When you push a new commit to your own repo (e.g.
git push), it will automatically run the test in this page:
Documentations are written under the
docs/ directory as ReStructuredText (
index.rst is the main page. A Tutorial on ReStructuredText can be found here.
API References are automatically generated by Sphinx according to the outlines under
docs/api/ and should be modified when any code changes.
To compile documentation into webpages, run
$ make html
docs/ directory. The generated webpages are in
docs/_build and can be viewed with browsers.
Chinese documentation is in https://tianshou.readthedocs.io/zh/latest/.
Documentation Generation Test¶
We have the following three documentation tests:
pydocstyle: test docstrings under
tianshou/. To check, in the main directory, run:
$ pydocstyle tianshou
doc8: test ReStructuredText formats. To check, in the main directory, run:
$ doc8 docs
sphinx test: test if there is any errors/warnings when generating front-end html documentations. To check, in the main directory, run:
$ cd docs $ make html SPHINXOPTS="-W"