-
Notifications
You must be signed in to change notification settings - Fork 0
Contributing
Garot Conklin edited this page Jan 28, 2025
·
1 revision
Thank you for your interest in contributing to githubauthlib! This document provides guidelines and instructions for contributing to the project.
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
-
Fork the repository
-
Clone your fork:
git clone https://github.com/YOUR_USERNAME/githubauthlib.git
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # Linux/macOS venv\Scripts\activate # Windows
-
Install development dependencies:
pip install -r requirements.txt
-
Create a new branch:
git checkout -b feature/your-feature-name
-
Make your changes:
- Write tests for new functionality
- Update documentation as needed
- Follow the coding style guidelines
-
Run tests:
pytest tests/
-
Run code formatting:
black . isort .
-
Run type checking:
mypy githubauthlib
-
Commit your changes:
git add . git commit -m "feat: Add new feature"
-
Push to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request
- Follow PEP 8 style guide
- Use type hints for all function parameters and return values
- Write docstrings for all public functions and classes
- Keep functions focused and single-purpose
- Use descriptive variable names
from typing import Optional
def process_data(input_data: str, max_length: Optional[int] = None) -> list[str]:
"""
Process the input data and return a list of results.
Args:
input_data: The data to process
max_length: Optional maximum length for results
Returns:
List of processed strings
Raises:
ValueError: If input_data is empty
"""
if not input_data:
raise ValueError("Input data cannot be empty")
# Implementation
return []
- Write tests for all new functionality
- Maintain test coverage above 90%
- Use pytest fixtures for common setup
- Mock external dependencies
- Test edge cases and error conditions
import pytest
from githubauthlib import get_github_token, GitHubAuthError
def test_get_github_token_success(mock_keychain):
# Arrange
mock_keychain.return_value = "valid_token"
# Act
token = get_github_token()
# Assert
assert token == "valid_token"
def test_get_github_token_failure(mock_keychain):
# Arrange
mock_keychain.side_effect = GitHubAuthError("Failed to access keychain")
# Act & Assert
with pytest.raises(GitHubAuthError):
get_github_token()
- Update docstrings for any modified functions
- Keep the README.md up to date
- Update the wiki for significant changes
- Include code examples for new features
Follow the Conventional Commits specification:
- feat: New feature
- fix: Bug fix
- docs: Documentation changes
- style: Code style changes
- refactor: Code refactoring
- test: Test updates
- chore: Maintenance tasks
Example:
feat: Add Windows credential manager support
- Implement Windows token retrieval
- Add tests for Windows platform
- Update documentation
- Update the README.md with details of changes
- Update the documentation
- Add tests for new functionality
- Ensure all tests pass
- Update the version number if applicable
- Request review from maintainers
- Update version in
__init__.py
- Update CHANGELOG.md
- Create a new release on GitHub
- Build and upload to PyPI
- Create an issue for bugs or feature requests
- Join the discussion in GitHub Discussions
- Contact the maintainers
githubauthlib/
├── .git/
├── .gitignore
├── README.md
├── LICENSE
├── setup.py
├── requirements.txt
├── githubauthlib/
│ ├── __init__.py
│ └── github_auth.py
├── tests/
│ ├── __init__.py
│ └── test_github_auth.py
└── docs/
├── conf.py
└── index.rst