First off, thank you for considering contributing to hostex-python! It's people like you that make this library better for everyone.
This project and everyone participating in it is governed by our commitment to creating a welcoming and inclusive environment. Please be respectful and constructive in all interactions.
Before creating bug reports, please check the issue list to see if the problem has already been reported. When you are creating a bug report, please include as many details as possible:
- Use a clear and descriptive title
- Describe the exact steps to reproduce the problem
- Provide specific examples to demonstrate the steps
- Describe the behavior you observed and what behavior you expected
- Include details about your configuration and environment
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include:
- Use a clear and descriptive title
- Provide a step-by-step description of the suggested enhancement
- Provide specific examples to demonstrate the enhancement
- Explain why this enhancement would be useful
- Fork the repository
- Create a new branch from
mainfor your feature or bug fix - Make your changes
- Add tests for your changes
- Run the test suite and ensure all tests pass
- Update documentation as needed
- Submit a pull request
- Python 3.7 or higher
- Git
-
Fork and clone the repository
git clone https://github.com/your-username/hostex-python.git cd hostex-python -
Create a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install development dependencies
pip install -e ".[dev]" -
Set up pre-commit hooks (recommended)
pre-commit install
Run the full test suite:
pytestRun tests with coverage:
pytest --cov=hostex --cov-report=htmlRun specific test files:
pytest tests/test_client.py
pytest tests/test_endpoints.pyRun tests with different verbosity:
pytest -v # Verbose
pytest -s # Don't capture outputWe use several tools to maintain code quality:
Format code with Black:
black hostex tests
# or
make formatLint code with flake8:
flake8 hostex tests
# or
make lintType check with mypy:
mypy hostex
# or
make type-checkRun all quality checks:
make checkDocumentation is located in the docs/ directory. When making changes:
- Update relevant documentation files
- Ensure examples are working and up-to-date
- Update the API reference if adding new features
- Update the changelog for notable changes
- Follow PEP 8 style guide
- Use Black for code formatting
- Maximum line length is 88 characters (Black default)
- Use type hints for all public functions and methods
- Write docstrings for all public classes and methods
- Keep functions and methods focused and small
- Use descriptive variable and function names
- Add type hints to improve code clarity
- Write comprehensive tests for new functionality
- Follow existing patterns in the codebase
- Write tests for all new functionality
- Maintain or improve test coverage
- Use descriptive test names that explain what is being tested
- Test both success and error cases
- Use mocks for external API calls
class TestNewFeature:
"""Test the new feature functionality."""
def test_feature_success_case(self, mock_client, requests_mocker):
"""Test that feature works correctly with valid input."""
# Setup
# Execute
# Assert
def test_feature_error_case(self, mock_client):
"""Test that feature handles errors correctly."""
# Test error conditions- Use clear and meaningful commit messages
- Start with a capital letter
- Use the imperative mood ("Add feature" not "Added feature")
- Keep the first line under 50 characters
- Reference issues and pull requests when applicable
Examples:
Add support for custom field updates
Fix rate limiting retry logic
Update documentation for OAuth flow
When adding new API endpoints or functionality:
- Follow existing patterns - Look at similar endpoints for consistency
- Add comprehensive error handling - Handle all expected error cases
- Include input validation - Validate parameters before making API calls
- Add rate limiting support - Ensure new endpoints respect rate limits
- Write thorough tests - Test success cases, error cases, and edge cases
- Update documentation - Add examples and update API reference
- Endpoint implementation in appropriate module
- Input validation and type hints
- Error handling for all expected error codes
- Comprehensive tests (success, errors, edge cases)
- Documentation updates
- Example usage in docs/examples.md
Releases are handled by maintainers. The process includes:
- Update version in
setup.pyandhostex/__init__.py - Update
CHANGELOG.mdwith new version details - Create release tag
- Build and publish to PyPI
- Create GitHub release with release notes
If you have questions about contributing, please:
- Check the existing documentation
- Search existing issues
- Create a new issue with the "question" label
- Reach out to maintainers
Thank you for contributing to hostex-python! 🚀