Contributing to Height Conversion Tool
Thank you for your interest in contributing to the Height Conversion Tool! We welcome contributions from the community.
Table of Contents
- Code of Conduct
- Getting Started
- How to Contribute
- Development Setup
- Coding Standards
- Testing Guidelines
- Submitting Changes
- Reporting Bugs
- Suggesting Enhancements
Code of Conduct
This project follows a simple code of conduct: be respectful, be constructive, and be collaborative. We aim to maintain a welcoming environment for all contributors.
Getting Started
Fork the repository on Hugging Face
Clone your fork to your local machine:
git clone https://huggingface.co/YOUR_USERNAME/height-conversion-tool cd height-conversion-toolSet up development environment (see below)
How to Contribute
There are many ways to contribute:
- π Report bugs - Help us identify and fix issues
- β¨ Suggest features - Share ideas for improvements
- π Improve documentation - Help others understand the tool better
- π§ Submit bug fixes - Fix issues you've found
- π Add new features - Implement new functionality
- β Write tests - Improve test coverage
- π Add translations - Help make the tool multilingual
Development Setup
Prerequisites
- Python 3.8 or higher
- pip
- git
Installation Steps
Create a virtual environment:
python -m venv venvActivate the virtual environment:
- On Linux/Mac:
source venv/bin/activate - On Windows:
venv\Scripts\activate
- On Linux/Mac:
Install development dependencies:
pip install -r requirements-dev.txtInstall the package in editable mode:
pip install -e .
Verify Installation
Run the tests to make sure everything is working:
pytest tests/ -v
Coding Standards
Python Style Guide
We follow PEP 8 with some modifications:
- Line length: Maximum 100 characters
- Indentation: 4 spaces (no tabs)
- Quotes: Use double quotes for strings
- Imports: Group and sort alphabetically
Code Formatting
We use Black for automatic code formatting:
black height_converter.py
Linting
We use flake8 for linting:
flake8 height_converter.py
Type Hints
Please include type hints for function parameters and return values:
def feet_to_cm(self, feet: int, inches: float = 0) -> float:
"""Convert feet and inches to centimeters."""
pass
Testing Guidelines
Writing Tests
- Place tests in the
tests/directory - Name test files with
test_prefix - Name test functions with
test_prefix - Use descriptive test names
Example:
def test_feet_to_cm_with_decimal_inches():
"""Test conversion with decimal inch values."""
converter = HeightConverter()
result = converter.feet_to_cm(5, 10.5)
assert result == pytest.approx(179.07, rel=0.01)
Running Tests
Run all tests:
pytest
Run with coverage:
pytest --cov=height_converter --cov-report=html
Run specific test file:
pytest tests/test_height_converter.py -v
Test Coverage
We aim for at least 90% test coverage. Check coverage with:
pytest --cov=height_converter --cov-report=term-missing
Submitting Changes
Branching Strategy
Create a new branch from
main:git checkout -b feature/your-feature-nameBranch naming conventions:
feature/- New featuresbugfix/- Bug fixesdocs/- Documentation updatestest/- Test improvements
Make your changes following our coding standards
Write or update tests for your changes
Run the test suite to ensure everything passes:
pytest black . flake8Commit your changes with a clear message:
git add . git commit -m "Add feature: description of your changes"Commit message format:
<type>: <short description> <optional detailed description> <optional footer>Types:
feat,fix,docs,test,refactor,style,chorePush to your fork:
git push origin feature/your-feature-nameCreate a Pull Request on Hugging Face
Pull Request Guidelines
Your PR should:
- β Have a clear title and description
- β Reference any related issues
- β Include tests for new functionality
- β Update documentation if needed
- β Pass all CI checks
- β Have no merge conflicts
PR Template:
## Description
Brief description of your changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Performance improvement
## Testing
Describe how you tested your changes
## Checklist
- [ ] Code follows style guidelines
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] All tests passing
Reporting Bugs
Before Submitting a Bug Report
- Check the documentation
- Search existing issues
- Try the latest version
How to Submit a Good Bug Report
Include:
- Clear title - Concise summary of the issue
- Description - Detailed explanation
- Steps to reproduce - Exact steps to trigger the bug
- Expected behavior - What should happen
- Actual behavior - What actually happens
- Environment - OS, Python version, package version
- Code sample - Minimal reproducible example
Template:
**Environment:**
- OS: [e.g., Ubuntu 22.04]
- Python version: [e.g., 3.10.5]
- Package version: [e.g., 1.0.0]
**Description:**
[Clear description of the bug]
**Steps to Reproduce:**
1. Step 1
2. Step 2
3. Step 3
**Expected Behavior:**
[What should happen]
**Actual Behavior:**
[What actually happens]
**Code Sample:**
```python
# Minimal code to reproduce the issue
## Suggesting Enhancements
We welcome enhancement suggestions! Please include:
1. **Use case** - Why is this enhancement needed?
2. **Proposed solution** - How should it work?
3. **Alternatives** - Other approaches considered
4. **Additional context** - Screenshots, examples, etc.
## Questions?
If you have questions about contributing, feel free to:
- Open a discussion on Hugging Face
- Ask in the community forum
- Contact the maintainers
## Recognition
Contributors will be recognized in:
- The project README
- Release notes
- Our hall of fame (coming soon!)
Thank you for contributing to Height Conversion Tool! π