| # 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](#code-of-conduct) | |
| - [Getting Started](#getting-started) | |
| - [How to Contribute](#how-to-contribute) | |
| - [Development Setup](#development-setup) | |
| - [Coding Standards](#coding-standards) | |
| - [Testing Guidelines](#testing-guidelines) | |
| - [Submitting Changes](#submitting-changes) | |
| - [Reporting Bugs](#reporting-bugs) | |
| - [Suggesting Enhancements](#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 | |
| 1. **Fork the repository** on Hugging Face | |
| 2. **Clone your fork** to your local machine: | |
| ```bash | |
| git clone https://huggingface.co/YOUR_USERNAME/height-conversion-tool | |
| cd height-conversion-tool | |
| ``` | |
| 3. **Set 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 | |
| 1. **Create a virtual environment**: | |
| ```bash | |
| python -m venv venv | |
| ``` | |
| 2. **Activate the virtual environment**: | |
| - On Linux/Mac: | |
| ```bash | |
| source venv/bin/activate | |
| ``` | |
| - On Windows: | |
| ```bash | |
| venv\Scripts\activate | |
| ``` | |
| 3. **Install development dependencies**: | |
| ```bash | |
| pip install -r requirements-dev.txt | |
| ``` | |
| 4. **Install the package in editable mode**: | |
| ```bash | |
| pip install -e . | |
| ``` | |
| ### Verify Installation | |
| Run the tests to make sure everything is working: | |
| ```bash | |
| pytest tests/ -v | |
| ``` | |
| ## Coding Standards | |
| ### Python Style Guide | |
| We follow [PEP 8](https://pep8.org/) 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: | |
| ```bash | |
| black height_converter.py | |
| ``` | |
| ### Linting | |
| We use **flake8** for linting: | |
| ```bash | |
| flake8 height_converter.py | |
| ``` | |
| ### Type Hints | |
| Please include type hints for function parameters and return values: | |
| ```python | |
| 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: | |
| ```python | |
| 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: | |
| ```bash | |
| pytest | |
| ``` | |
| Run with coverage: | |
| ```bash | |
| pytest --cov=height_converter --cov-report=html | |
| ``` | |
| Run specific test file: | |
| ```bash | |
| pytest tests/test_height_converter.py -v | |
| ``` | |
| ### Test Coverage | |
| We aim for at least 90% test coverage. Check coverage with: | |
| ```bash | |
| pytest --cov=height_converter --cov-report=term-missing | |
| ``` | |
| ## Submitting Changes | |
| ### Branching Strategy | |
| 1. **Create a new branch** from `main`: | |
| ```bash | |
| git checkout -b feature/your-feature-name | |
| ``` | |
| Branch naming conventions: | |
| - `feature/` - New features | |
| - `bugfix/` - Bug fixes | |
| - `docs/` - Documentation updates | |
| - `test/` - Test improvements | |
| 2. **Make your changes** following our coding standards | |
| 3. **Write or update tests** for your changes | |
| 4. **Run the test suite** to ensure everything passes: | |
| ```bash | |
| pytest | |
| black . | |
| flake8 | |
| ``` | |
| 5. **Commit your changes** with a clear message: | |
| ```bash | |
| 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`, `chore` | |
| 6. **Push to your fork**: | |
| ```bash | |
| git push origin feature/your-feature-name | |
| ``` | |
| 7. **Create 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:** | |
| ```markdown | |
| ## 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: | |
| 1. **Clear title** - Concise summary of the issue | |
| 2. **Description** - Detailed explanation | |
| 3. **Steps to reproduce** - Exact steps to trigger the bug | |
| 4. **Expected behavior** - What should happen | |
| 5. **Actual behavior** - What actually happens | |
| 6. **Environment** - OS, Python version, package version | |
| 7. **Code sample** - Minimal reproducible example | |
| **Template:** | |
| ```markdown | |
| **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! π | |