Thank you for considering to contribute to codetiming. This guide is meant to help you find your way around the project, and let you know which standards that are used.
If you are looking for tutorials or tips on how to use codetiming, have a look at the documentation and the accompanying article Python Timer Functions: Three Ways to Monitor Your Code.
Have you found an issue with codetiming, or do you have a suggestion for a new feature? Great! Have a look at the known issues to see if anyone has reported it already. If not, please post a new issue.
When reporting an issue, please include as much of the following information as possible:
- Your version of
codetiming:print(codetiming.__version__) - Your version of Python:
print(sys.version) - Your operating system
- A description of your issue, ideally including a short code snippet that reproduces the issue
When suggesting a new feature, try to include an example of how your feature could be used.
Do you want to contribute code to codetiming? Fantastic! We welcome contributions as pull requests.
codetiming uses flit for package management. You can use flit through pip.
You can then install codetiming locally for development with pip:
$ python -m pip install --editable .[dev,test]
This will install codetiming and all its dependencies, including development tools like black and mypy, and test runners like pytest. The --editable option allows you to test your changes without reinstalling.
Run tests using tox. You can also run individual tests manually. tox helps to enforce the following principles:
-
Consistent code style using
black. You can automatically format your code as follows:$ python -m black codetiming/ tests/ -
Static type hinting using
mypy. Test your type hints as follows:$ mypy --strict codetiming/ tests/See Real Python's Python Type Checking guide for more information.
-
Unit testing using
pytest. You can run your tests and see a coverage report as follows:$ python -m pytest --cov=codetiming --cov-report=term-missing -
Code issues are checked with the flake8 linter. You can run flake8 manually as follows:
$ python -m flake8 codetiming/ tests/ -
Imports are sorted consistently using isort. You can automatically sort your imports as follows:
$ python -m isort codetiming/ tests/ -
All modules, functions, classes, and methods must have docstrings. This is enforced by Interrogation. You can test compliance as follows:
$ python -m interrogate -c pyproject.toml -vv
Feel free to ask for help in your PR if you are having challenges with any of these tests.