Thank you for your interest in contributing to LocalPortManager!
-
Fork the repository
-
Clone your fork:
git clone https://github.com/yourusername/LocalportManager.git cd LocalportManager -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install development dependencies:
pip install -e ".[dev]" # Or manually: pip install pytest pytest-cov black isort flake8 mypy bandit
# Run all tests
pytest
# Run with coverage
pytest --cov=localportmanager --cov-report=html
# Run only unit tests
pytest -m unit
# Run only integration tests
pytest -m integration
# Exclude slow tests
pytest -m "not slow"We use:
- black for code formatting
- isort for import sorting
- flake8 for linting
- mypy for type checking
# Format code
black localportmanager.py tests/
# Sort imports
isort localportmanager.py tests/
# Run linter
flake8 localportmanager.py tests/
# Type check
mypy localportmanager.py-
Create a feature branch:
git checkout -b feature/my-new-feature
-
Make your changes and add tests
-
Ensure tests pass and coverage is ≥80%:
pytest --cov=localportmanager --cov-fail-under=80
-
Commit your changes:
git commit -am "Add some feature" -
Push to your fork:
git push origin feature/my-new-feature
-
Open a Pull Request
Use conventional commits format:
feat:New featurefix:Bug fixdocs:Documentation changestest:Adding or correcting testsrefactor:Code refactoringchore:Maintenance tasks
Example:
feat: Add support for custom port ranges
- Implement find_free_port with configurable range
- Add CLI option --port-range
- Add tests for new functionality
When reporting issues, please include:
- Python version
- Operating system
- Steps to reproduce
- Expected behavior
- Actual behavior
- Error messages or logs
Be respectful and constructive in all interactions.