Contributing Guide¶
Thank you for considering contributing to python-newtype! This document provides guidelines and instructions for contributing.
Development Setup¶
-
Fork and clone the repository:
-
Create a virtual environment:
-
Install development dependencies:
Development Workflow¶
-
Create a new branch:
-
Make your changes and ensure:
- Code follows the project style
- Tests pass
- Documentation is updated
-
C extensions compile correctly
-
Run tests:
-
Build documentation:
-
Commit your changes:
-
Push and create a pull request:
Code Style¶
- Follow PEP 8
- Use type hints where appropriate
- Document functions and classes with docstrings
- Keep functions focused and concise
- Write clear commit messages
Testing¶
- Write tests for new features
- Ensure all tests pass
- Include both positive and negative test cases
- Test edge cases
- Use pytest fixtures appropriately
Running Tests¶
# Run all tests
make test
# Run with debug output
make test-debug
# Run specific test file
make test-file FILE=tests/test_newtype.py
# Run with memory leak detection
make test-leak
Documentation¶
- Update documentation for new features
- Include examples in docstrings
- Update API reference if needed
- Check documentation builds correctly
Building Documentation¶
C Extensions¶
When modifying C extensions:
- Follow C best practices
- Update header files appropriately
- Test compilation on multiple platforms
- Document any platform-specific code
- Use debug printing when needed
Building Extensions¶
Pull Request Process¶
- Update documentation
- Add tests for new features
- Ensure all tests pass
- Update CHANGELOG.md
- Create detailed pull request description
Release Process¶
- Update version number
- Update CHANGELOG.md
- Create release notes
- Tag release
- Build and upload to PyPI
Getting Help¶
- Open an issue for bugs
- Discuss major changes in issues first
- Join discussions in existing issues
- Ask questions in discussions
Code of Conduct¶
- Be respectful and inclusive
- Follow the project's code of conduct
- Help others learn and grow
- Give credit where due