height-conversion-tool / CONTRIBUTING.md
NuBest's picture
Upload 10 files
405b09e verified

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

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:

    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:

    python -m venv venv
    
  2. Activate the virtual environment:

    • On Linux/Mac:
      source venv/bin/activate
      
    • On Windows:
      venv\Scripts\activate
      
  3. Install development dependencies:

    pip install -r requirements-dev.txt
    
  4. Install 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

  1. Create a new branch from main:

    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:

    pytest
    black .
    flake8
    
  5. Commit 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, chore

  6. Push to your fork:

    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:

## 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:

**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! πŸŽ‰