Additional development and testing tools¶
Pytest¶
Pytest is a testing framework. At the moment, Sage is not yet using any tests based on pytest.
Installation: pip install -U pytest, see documentation for details.
Usage:
- Manual: Run pytest path/to/the/test_file.py or pytest to run all tests (from a virtual environment with Sage installed)
- VS Code: Install the Python extension and follow the offical VS Code documentation.
Configuration: conftest.py in the source folder
Documentation: https://docs.pytest.org/en/stable/index.html
Pyright¶
Pyright is static type checker.
Installation: npm install -g pyright, see documentation for details.
Usage:
- Manual: Run pyright path/to/the/file.py
- VS Code: Install the Pylance extension.
Configuration: pyrightconfig.json in the root
Note: Currently, only the manifolds package is checked. Further packages can be added in the pyrightconfig.json file.
Documentation: https://github.com/microsoft/pyright#documentation
Pycodestyle¶
Pycodestyle checks against the style conventions of PEP8 Python.
Installation: pip install -U pycodestyle --user
Usage:
- Manual: Run pycodestyle path/to/the/file.py
- VS Code: Activate by adding the setting "python.linting.pycodestyleEnabled": true, see official VS Code documentation for details.
Configuration: [pycodestyle] block in src/tox.ini
Documentation: https://pycodestyle.pycqa.org/en/latest/index.html
Pyflakes¶
Pyflakes checks for common coding errors.