Contributing to mywheelΒΆ
Thank you for your interest in contributing to mywheel! This document provides guidelines and instructions for contributing to this project.
π€ How to ContributeΒΆ
Reporting IssuesΒΆ
Before creating an issue, please:
Check if the issue already exists in GitHub Issues
Use an appropriate issue template
Include:
Python version
Operating system
Minimal reproducible example
Expected vs actual behavior
Submitting Pull RequestsΒΆ
We welcome pull requests! Hereβs the process:
Fork the repository
Create a branch for your changes:
git checkout -b feature/your-featureMake your changes following the guidelines below
Test thoroughly (see Testing section)
Submit a PR with a clear description
π οΈ Development SetupΒΆ
PrerequisitesΒΆ
Python 3.8 or higher
Git
Virtual environment (recommended)
InstallationΒΆ
# Clone your fork
git clone https://github.com/YOUR_USERNAME/mywheel.git
cd mywheel
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode with testing dependencies
pip install -e ".[testing]"
# Install pre-commit hooks
pre-commit install
Project StructureΒΆ
mywheel/
βββ src/mywheel/ # Source code
β βββ __init__.py
β βββ robin.py # Round-robin implementation
β βββ dllist.py # Doubly-linked list
β βββ bpqueue.py # Bounded priority queue
β βββ map_adapter.py # List-to-map adapter
β βββ array_like.py # Array-like utilities
βββ tests/ # Test suite
β βββ conftest.py
β βββ test_*.py
βββ docs/ # Sphinx documentation
βββ AGENTS.md # Guidelines for agentic contributors
π Code Style GuidelinesΒΆ
General PrinciplesΒΆ
Follow existing patterns: The codebase uses consistent patterns (see
AGENTS.md)Type hints required: All public APIs must have type hints
Memory efficiency: Use
__slots__for classes with fixed attributesDocstrings: Google/NumPy-style with doctest examples
Specific RulesΒΆ
Imports: Standard β Third-party β Local package
from typing import Generic, TypeVar from hypothesis import given from mywheel import Dllist
Naming:
Classes:
PascalCaseFunctions/Methods:
snake_casePrivate:
_leading_underscore
Error Handling:
Use
assertfor invariants and preconditionsRaise specific exceptions (
IndexError,NotImplementedError,StopIteration)Use
id()for object identity comparisons
Circular References:
# Self-referential initialization self.next = self # Identity checks if id(self.next) == id(self):
Before CommittingΒΆ
# Format code
black .
isort .
# Run linters
flake8 src/mywheel
# Type check
mypy src/mywheel
# Run tests
pytest tests/
# Run all checks at once
pre-commit run --all-files
π§ͺ TestingΒΆ
Running TestsΒΆ
# All tests with coverage
pytest
# Specific test file
pytest tests/test_dllist.py
# Specific test
pytest tests/test_robin.py::test_slnode
# Verbose output
pytest -v
# Pattern matching
pytest -k "test_dllist"
# In isolated environment (tox)
tox
Writing TestsΒΆ
Unit tests: Use
pytestfor specific functionalityProperty tests: Use
hypothesisfor data structure invariantsCoverage: Maintain 100% coverage for new code
Test structure:
# Standard pytest test def test_feature(): assert expected == actual # Property-based test @given(st.integers(min_value=1, max_value=100)) def test_property(value): assert invariant_holds(value)
Test NamingΒΆ
Test classes:
Test<ClassName>,Test<ClassName>PropertiesTest functions:
test_<feature>,test_<behavior>
π DocumentationΒΆ
DocstringsΒΆ
Use Google/NumPy-style docstrings for all public APIs:
def method(self, param: int) -> str:
"""
Brief description.
Detailed description of what the method does.
Args:
param: Description of param
Returns:
Description of return value
Raises:
IndexError: When param is out of range
Examples:
>>> obj.method(5)
'result'
"""
Module DocumentationΒΆ
Each module should have a module-level docstring explaining:
Purpose of the implementation
Key algorithms used
Performance characteristics
Usage examples
π Code Review ProcessΒΆ
Before Submitting PRΒΆ
β All tests pass locally
β Type checking passes (
mypy)β Linting passes (
flake8)β Code formatted with
blackandisortβ New code has tests
β Docstrings updated
β
AGENTS.mdupdated if adding new patterns
During ReviewΒΆ
Be responsive: Address review feedback promptly
Explain changes: Provide rationale for significant decisions
Be patient: Reviewers volunteer their time
After MergeΒΆ
Your contribution will be credited in release notes
Thank you for helping improve
mywheel!
π Release ProcessΒΆ
Releases are managed by maintainers:
Version updated via
setuptools_scm(git tags)Changelog updated in
CHANGELOG.mdBuilt and published to PyPI via CI
π¬ Getting HelpΒΆ
GitHub Issues: For bugs and feature requests
Discussions: For questions and general discussions
Documentation: Read <AGENTS.md> for codebase patterns
π LicenseΒΆ
By contributing, you agree that your contributions will be licensed under the
Thank you for contributing to mywheel! π