File size: 6,835 Bytes
405b09e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# 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! π
|