Repository navigation
Contributing
jsem-nerad edited this page Nov 12, 2025
·
5 revisions
Thank you for your interest in contributing to strava-cz-python!
# Fork the repository on GitHub, then:
git clone https://github.com/YOUR-USERNAME/strava-cz-python.git
cd strava-cz-python# Check Python version (3.9+ required)
python3 --version
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install in development mode with dev dependencies
pip install -e .[dev]# Check Python version
python --version
# Create virtual environment
python -m venv venv
venv\Scripts\activate
# Install in development mode
pip install -e .[dev]# Run tests
pytest
# Check code style
black --check src/
flake8 src/
# Type checking
mypy src/git checkout main
git pull origin main
git checkout -b feature/your-feature-name- Write your code in
src/strava_cz/ - Add tests in
tests/ - Update documentation if needed
- Follow the code style guidelines
# Run all tests
pytest
# Run with coverage
pytest --cov=strava_cz --cov-report=term-missing
# Run specific test file
pytest tests/test_strava_cz.py
# Run specific test
pytest tests/test_strava_cz.py::test_function_name# Auto-format with black
black src/ tests/
# Check style with flake8
flake8 src/ tests/
# Type check with mypy
mypy src/git add .
git commit -m "feat: add new feature"
# Use conventional commit messages:
# feat: new feature
# fix: bug fix
# docs: documentation changes
# test: test additions or changes
# refactor: code refactoring
# style: formatting changes
# chore: maintenance tasksgit push origin feature/your-feature-nameThen create a Pull Request on GitHub.
- Follow PEP 8
- Use Black for formatting (line length: 100)
- Use type hints where appropriate
- Write docstrings for public functions and classes
from typing import Optional, List
class Example:
"""Brief description of the class.
Longer description if needed.
Attributes:
attribute: Description of attribute
"""
def __init__(self, value: str):
"""Initialize the example.
Args:
value: Description of parameter
"""
self.attribute = value
def method(self, param: int, optional: Optional[str] = None) -> bool:
"""Brief description of method.
Args:
param: Description of parameter
optional: Description of optional parameter
Returns:
Description of return value
Raises:
ValueError: When something is invalid
"""
if param < 0:
raise ValueError("Param must be positive")
return TrueUse Google-style docstrings:
def function(arg1: str, arg2: int) -> bool:
"""Summary line.
Extended description paragraph.
Args:
arg1: Description of arg1
arg2: Description of arg2
Returns:
Description of return value
Raises:
ExceptionType: When this happens
"""
pass- Use
pytestfor testing - Name test files
test_*.py - Name test functions
test_* - Use descriptive test names
- Include docstrings explaining what's being tested
import pytest
from strava_cz import StravaCZ, AuthenticationError
def test_login_success():
"""Test successful login with valid credentials."""
strava = StravaCZ(username="test", password="test", canteen_number="3753")
assert strava.user.is_logged_in is True
def test_login_failure():
"""Test login failure with invalid credentials."""
with pytest.raises(AuthenticationError):
StravaCZ(username="wrong", password="wrong", canteen_number="3753")
def test_menu_fetch():
"""Test menu fetching and parsing."""
strava = StravaCZ(username="test", password="test", canteen_number="3753")
strava.menu.fetch()
assert len(strava.menu.get_days()) > 0- Aim for >80% code coverage
- Test both success and failure cases
- Test edge cases
- Mock external API calls when appropriate
- Write clear docstrings for all public APIs
- Include examples in docstrings when helpful
- Use type hints
- Update relevant wiki pages when adding features
- Include examples in documentation
- Keep documentation in sync with code
- Update README.md for major features
- Include usage examples
- Keep feature list current
- Write code with proper error handling
- Add comprehensive tests
- Update docstrings
- Add type hints
- Format with Black
- Pass flake8 and mypy checks
- Update CHANGELOG.md
- Update relevant wiki pages
- Add examples if needed
- Create pull request with clear description
from typing import Optional
class NewFeature:
"""Description of new feature.
This feature does XYZ and is useful for ABC.
Example:
>>> feature = NewFeature()
>>> result = feature.do_something()
>>> print(result)
"""
def __init__(self, param: str):
"""Initialize the feature.
Args:
param: Description
"""
self.param = param
def do_something(self) -> bool:
"""Perform the main action.
Returns:
True if successful
Raises:
ValueError: If param is invalid
"""
# Implementation
pass- Check if the bug is already reported in Issues
- Verify you're using the latest version
- Create a minimal reproducible example
**Describe the bug**
A clear description of what the bug is.
**To Reproduce**
Steps to reproduce:
1. Do this
2. Then this
3. See error
**Code Example**
```python
from strava_cz import StravaCZ
strava = StravaCZ(...)
# Minimal code that reproduces the issue
```
**Expected behavior**
What you expected to happen.
**Actual behavior**
What actually happened.
**Error message**
```
Full error traceback
```
**Environment**
- OS: [e.g., Windows 10, Ubuntu 22.04]
- Python version: [e.g., 3.11.0]
- Library version: [e.g., 0.2.0]
**Additional context**
Any other relevant information.**Feature Description**
Clear description of the feature.
**Use Case**
Why is this feature needed? What problem does it solve?
**Proposed Solution**
How should this feature work?
**Example Usage**
```python
# Example of how the feature would be used
strava.new_feature()
```
**Alternatives**
Other ways this could be implemented.
**Additional Context**
Any other relevant information.- Code follows project style guidelines
- Tests added and passing
- Documentation updated
- CHANGELOG.md updated
- Commits follow conventional commit format
- PR description is clear and complete
## Description
Brief description of changes.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Changes Made
- List specific changes
- Be clear and detailed
## Testing
Describe tests added or modified.
## Related Issues
Fixes #123
Relates to #456
## Screenshots (if applicable)
Add screenshots for UI changes.
## Checklist
- [ ] Code formatted with Black
- [ ] Tests pass
- [ ] Documentation updated
- [ ] CHANGELOG updated- pytest - Testing framework
- pytest-cov - Coverage reporting
- black - Code formatter
- flake8 - Linter
- mypy - Type checker
- types-requests - Type stubs for requests
- pyproject.toml - Project metadata and tool configuration
- .gitignore - Git ignore rules
- tests/pytest.ini - Pytest configuration (if exists)
# Format code
black src/ tests/
# Lint code
flake8 src/ tests/
# Type check
mypy src/
# Run tests
pytest
# Run tests with coverage
pytest --cov=strava_cz --cov-report=html
# Run specific test
pytest tests/test_strava_cz.py::test_name -v
# Install in development mode
pip install -e .
# Install with dev dependencies
pip install -e .[dev](For maintainers)
- Update version in
pyproject.toml - Update
CHANGELOG.md - Create git tag
- Push to GitHub
- Create GitHub release
- Build and publish to PyPI
# Update version in pyproject.toml
version = "0.3.0"
# Update CHANGELOG.md
# Add new section for version
# Commit changes
git add .
git commit -m "chore: bump version to 0.3.0"
# Create tag
git tag v0.3.0
# Push
git push origin main
git push origin v0.3.0- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - Questions and general discussion
- Pull Requests - Code contributions
- Be respectful and inclusive
- Provide constructive feedback
- Focus on what's best for the community
- Show empathy toward others
If you have questions about contributing:
- Check existing documentation
- Search GitHub Issues
- Create a new issue with your question
Thank you for contributing to strava-cz-python! Your contributions help make this library better for everyone.