First off, thank you for considering contributing to Weather Dominator! It's people like you that make Weather Dominator such a great tool.
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code.
Before creating bug reports, please check the existing issues as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
- Use a clear and descriptive title
- Describe the exact steps which reproduce the problem
- Provide specific examples to demonstrate the steps
- Describe the behavior you observed after following the steps
- Explain which behavior you expected to see instead and why
- Include screenshots if possible
- Include your environment details (OS, Python version, etc.)
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include:
- Use a clear and descriptive title
- Provide a step-by-step description of the suggested enhancement
- Provide specific examples to demonstrate the steps
- Describe the current behavior and explain the expected behavior
- Explain why this enhancement would be useful
- Fill in the required template
- Follow the Python style guide (PEP 8)
- Include appropriate test cases
- Update documentation as needed
- End all files with a newline
git clone https://github.com/YOUR_USERNAME/Weather_Dominator.git
cd Weather_Dominatorpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txt
pip install -r requirements-dev.txtpre-commit installThis project follows PEP 8 with some modifications:
- Maximum line length: 100 characters
- Use 4 spaces for indentation
- Use double quotes for strings
- Use type hints for function signatures
We use multiple tools to maintain code quality. All tools are configured to run automatically via pre-commit hooks.
Black formats Python code to a consistent style:
# Check what would be formatted
black src/ tests/ *.py --check
# Apply formatting
black src/ tests/ *.pyConfiguration:
- Line length: 100 characters
- Target Python version: 3.13
isort organizes imports in a consistent, readable format:
# Check import organization
isort src/ tests/ *.py --check --diff
# Apply import sorting
isort src/ tests/ *.pyConfiguration:
- Profile: black (compatible with Black formatter)
- Line length: 100 characters
flake8 checks code for style issues and potential bugs:
# Run flake8 on source code
flake8 src/ --max-line-length=100 --extend-ignore=E203,W503,W293Configuration:
- Max line length: 100
- Ignored rules: E203 (whitespace before ':'), W503 (line break before binary operator), W293 (blank line contains whitespace)
- Excludes:
.git,__pycache__,build,dist,.eggs,*.egg
mypy validates type hints for type safety:
# Run type checking on src/
mypy src/ --ignore-missing-imports --no-strict-optionalConfiguration:
- Ignores missing imports from external libraries
- No strict optional checking
- Only checks
src/directory
Run all quality tools at once:
# Format code
black src/ tests/ *.py
# Sort imports
isort src/ tests/ *.py
# Check code quality
flake8 src/ --max-line-length=100 --extend-ignore=E203,W503,W293
# Type check
mypy src/ --ignore-missing-imports --no-strict-optionalOr use pre-commit to run all checks:
# Run on staged files
pre-commit run
# Run on all files
pre-commit run --all-files# Run all tests
pytest
# Run with coverage
pytest --cov=src --cov-report=html
# Run specific test file
pytest tests/test_weather_api.py- Place test files in the
tests/directory - Name test files as
test_*.py - Name test functions as
test_* - Use descriptive names for test functions
- Include docstrings for complex test cases
- Use fixtures for common setup
Example test structure:
def test_weather_api_success():
"""Test that weather API returns correct data for valid city."""
weather_api = WeatherAPI(api_key="test_key")
result = weather_api.get_current_weather("New York")
assert "temp" in result
assert "humidity" in result
assert result["city"] == "New York"We use Google-style docstrings:
def function_name(param1: str, param2: int) -> bool:
"""
Short description of function.
Longer description if needed. Can span multiple lines
and include detailed information about the function.
Args:
param1: Description of param1
param2: Description of param2
Returns:
Description of return value
Raises:
ValueError: Description of when this is raised
Example:
>>> function_name("test", 42)
True
"""
pass- Use comments to explain "why", not "what"
- Keep comments up to date
- Write comments in complete sentences
- Capitalize the first word
- Use inline comments sparingly
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests liberally after the first line
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation only changesstyle: Code style changes (formatting, missing semi colons, etc)refactor: Code refactoringperf: Performance improvementtest: Adding missing testschore: Changes to build process or auxiliary tools
Example:
feat(weather-api): add caching for API responses
Implement response caching to reduce API calls and improve
performance. Cache expires after 5 minutes.
Closes #123
Weather_Dominator/
├── src/ # Core source code
│ ├── constants.py # Application constants
│ ├── config_manager.py # Configuration management
│ ├── exceptions.py # Custom exceptions
│ └── logger.py # Logging configuration
├── data/ # Data modules
├── ui/ # User interface
├── db/ # Database layer
├── ml/ # Machine learning
├── utils/ # Utilities
├── tests/ # Test suite
├── docs/ # Documentation
└── config/ # Configuration files
- Create a branch for your changes
- Make your changes with clear, descriptive commits
- Add tests for new functionality
- Update documentation as needed
- Run the test suite to ensure everything passes
- Submit a pull request with a clear description
- Code follows the project's style guidelines
- Tests pass locally
- New tests added for new functionality
- Documentation updated
- Commit messages follow the format
- No merge conflicts
- Reviewed own code changes
Feel free to:
- Open an issue with the "question" label
- Start a discussion in GitHub Discussions
- Contact the maintainers
Contributors will be recognized in:
- The project README
- Release notes
- Contributors page
Thank you for contributing to Weather Dominator! 🌩️