Thank you for your interest in contributing to TimeTagger! This document provides guidelines and instructions for contributing to this project.
Please be respectful and considerate of others when contributing to this project. We aim to foster an inclusive and welcoming community.
- Fork the repository on GitHub
- Clone your fork to your local machine
- Set up the development environment as described in the README.md
- Create a branch for your changes
TimeTagger follows these code style guidelines:
- We use Black for Python code formatting
- Maximum line length is not strictly enforced, but aim for readability
- Import order: standard library imports first, then third party, then local
- Use meaningful variable and function names
- Add docstrings to public functions, classes, and methods
Before submitting a pull request, please run our linting tool:
python scripts/lint_code.pyThis will check for common issues like:
- Bare except blocks (should specify exception types)
- Print statements (should use logging instead)
- TODO and FIXME comments
To automatically fix some issues:
python scripts/lint_code.py --fixAdditionally, you can run these tasks:
# Run the test suite
python -m invoke tests
# Check code style with flake8
python -m invoke lint
# Format code with black
python -m invoke format- Always catch specific exceptions instead of using bare
except:blocks - Use logging instead of print statements for errors and debugging
- Follow this pattern for error handling:
try:
# Code that might raise an exception
except SpecificException as e:
logger.error(f"Specific error message: {e}")
# Handle the exception appropriately- Use the Python logging module instead of print statements
- Configure loggers at the module level:
import logging
logger = logging.getLogger("timetagger.module_name")- Use appropriate log levels:
- DEBUG: Detailed information for debugging
- INFO: Confirmation that things are working
- WARNING: Something unexpected happened, but the application still works
- ERROR: A more serious problem, some functionality may not work
- CRITICAL: A very serious error that may prevent the program from continuing
- Update documentation if needed for your changes
- Add tests for new functionality
- Run all tests and make sure they pass
- Make sure your code follows the style guidelines and passes the linting
- Submit a pull request with a clear description of the changes
By contributing to TimeTagger, you agree that your contributions will be licensed under the project's license.