Apache Liminal use Sphinx and readthedocs.org to create and publish documentation to readthedocs.org
Here is what you need to do in order to work and create docs locally
More details about sphinx and readthedocs can be found here:
Here is what you need to do:
pip install sphinx
Inside your project go to docs lib, update the docs you like and build them:
cd docs
make html
pip install sphinx-autobuild
cd docs
sphinx-autobuild source/ build/html/
Now open a browser on http://localhost:8000/ Your docs will automatically update
cd docs
sphinx-apidoc -o source/ ../liminal
When doing local development and running Liminal unit-tests, make sure to set LIMINAL_STAND_ALONE_MODE=True
- Setup Minikube
2.Install python requirements:
pip install -r requirements.txt
- Run tests:
./run_tests.sh
pre-commit is used to install Python code linting and formatting tools:
Requires python >=3.6
, pre-commit>=1.14
and a git
repository
- Run
pip install pre-commit
orpip install -r requirements.txt
- Install the hooks:
Simple install without post hooks:
pre-commit install
OR
Install the hooks: pre-commit install --install-hooks
Optional:
Install the post commit hooks: pre-commit install --hook-type post-commit
- To run pre commit hooks:
-
Either run
git commit
the new configuration files -
Run
pre-commit run -a
to lint and format your entire project
-
Now on every commit, pre-commit
will use a git hook to run the tools.
Warning: the first commit will take some time because the tools are being installed by
pre-commit
pre-commit run -a
to lint and format your entire project
- If
black
fail, they have reformatted your code. - You should check the changes made. Then simply "git add --update ." and re-commit or
git add
andgit commit
the changes.
Example:
- black: a Python automatic code formatter
- yamllint: A linter for YAML files. yamllint does not only check for syntax validity, but for weirdnesses like key repetition and cosmetic problems such as lines length, trailing spaces, indentation, etc.
- OutOfBoxHooks - Out-of-the-box hooks for pre-commit like Check for files that contain merge conflict strings
- Bandit is a tool designed to find common security issues in Python code.
- blacken-docs Run
black
on python code blocks in documentation files - pyupgrade A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.
- isort A Python utility / library to sort imports.