Thank you for your interest in contributing to designer-plugin! This document provides guidelines and instructions for contributing.
- Python 3.11 or higher
- uv package manager
-
Clone the repository:
git clone https://github.com/disguise-one/python-plugin.git cd python-plugin -
Install dependencies:
uv sync --dev
-
Install pre-commit hooks:
uv run pre-commit install
Run the full test suite:
uv run pytestRun tests with verbose output:
uv run pytest -vRun specific test file:
uv run pytest tests/test_core.pyLinting:
uv run ruff checkAuto-fix linting issues:
uv run ruff check --fixFormatting:
uv run ruff formatType checking:
uv run mypyRun all checks:
uv run ruff check && uv run ruff format --check && uv run mypy && uv run pytestPre-commit hooks are configured to automatically run:
ruff check --fix- Linting with auto-fixruff format- Code formatting
These run automatically on git commit. To run manually:
uv run pre-commit run --all-files- Follow PEP 8 style guidelines
- Use type hints for all function signatures
- Write docstrings for all public APIs
- Prefer explicit over implicit
All code must include type hints:
def my_function(name: str, count: int = 0) -> dict[str, int]:
"""Do something useful.
Args:
name: The name parameter.
count: The count parameter.
Returns:
A dictionary mapping name to count.
"""
return {name: count}Use Google-style docstrings:
def example_function(param1: str, param2: int) -> bool:
"""Brief description of the function.
More detailed explanation if needed. Can span
multiple lines.
Args:
param1: Description of param1.
param2: Description of param2.
Returns:
Description of return value.
Raises:
ValueError: When param2 is negative.
"""
if param2 < 0:
raise ValueError("param2 must be non-negative")
return True- Group related functionality together
- Use clear, descriptive names
- Avoid circular imports
- Place tests in the
tests/directory - Name test files
test_*.py - Name test classes
Test* - Name test functions
test_*
class TestMyFeature:
"""Test suite for my feature."""
def test_basic_functionality(self) -> None:
"""Test basic functionality works correctly."""
result = my_function("test", 42)
assert result == {"test": 42}
def test_error_handling(self) -> None:
"""Test error handling for invalid input."""
with pytest.raises(ValueError):
my_function("test", -1)- Aim for high test coverage
- Test both success and error cases
- Test edge cases and boundary conditions
- Use mocks for external dependencies
-
Create a feature branch:
git checkout -b feature/my-new-feature
-
Make your changes:
- Write code
- Add tests
- Update documentation
-
Run all checks:
uv run ruff check . && uv run ruff format --check . && uv run mypy && uv run pytest
-
Commit your changes:
git add . git commit -m "Add my new feature"
Commit messages should:
- Use present tense ("Add feature" not "Added feature")
- Be clear and descriptive
- Reference issue numbers if applicable
-
Push to your fork:
git push origin feature/my-new-feature
- Open a Pull Request on GitHub
- Fill out the PR template
- Link any related issues
- Wait for CI checks to pass
- Address review feedback
- All tests must pass
- Code must pass linting and type checking
- New features must include tests
- Documentation must be updated
When reporting bugs, please include:
- Description of the issue
- Steps to reproduce
- Expected behaviour
- Actual behaviour
- Python version
- Package version
- Minimal code example (if applicable)
When requesting features, please include:
- Clear description of the feature
- Use case and motivation
- Example API or usage (if applicable)
- Any alternatives you've considered
- Update README.md for user facing changes
- Update docstrings for API changes
- Update CHANGELOG.md following Keep a Changelog format
- Add examples for new features
- Write clear, concise documentation
- Include code examples
- Explain the "why" not just the "what"
- Keep documentation up to date with code
Releases are managed by project maintainers:
- Update version in
pyproject.toml - Update
CHANGELOG.md - Create git tag:
git tag -a v1.2.0 -m "Release v1.2.0" - Push tag:
git push origin v1.2.0 - Build distributions:
uv build - Upload to PyPI:
twine upload dist/*
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn and grow
- Assume good intentions
If you have questions about contributing:
- Open a GitHub Issue
- Check existing issues and PRs
- Review the documentation
By contributing, you agree that your contributions will be licensed under the MIT License.