Contributing to PyWizardry
Help make PyWizardry better for everyone
๐ Getting Started
Prerequisites
- Python 3.7 or higher
- Git installed
- Basic understanding of Python
- GitHub account
Fork and Clone
# Fork the repository on GitHub
# Visit: https://github.com/saifullah10141/pywizardry
# Clone your fork
git clone https://github.com/YOUR_USERNAME/pywizardry.git
cd pywizardry
# Add upstream remote
git remote add upstream https://github.com/saifullah10141/pywizardry.git
# Create a branch
git checkout -b feature/your-feature-name
Development Setup
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install development dependencies
pip install -e .[dev]
# Install pre-commit hooks
pre-commit install
๐ Code of Conduct
Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
Our Standards
Examples of behavior that contributes to a positive environment:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior:
- The use of sexualized language or imagery
- Trolling, insulting or derogatory comments
- Public or private harassment
- Publishing others' private information without permission
- Other conduct which could reasonably be considered inappropriate
Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at saifullahanwar00040@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
Enforcement Guidelines:
- Correction: Private, written warning
- Warning: Public warning with consequences
- Temporary Ban: Temporary prohibition from interaction
- Permanent Ban: Permanent prohibition from interaction
๐ป Development Guide
Project Structure
pywizardry/
โโโ src/
โ โโโ pywizardry/
โ โโโ __init__.py # Main module
โ โโโ core/ # Core utilities
โ โโโ files/ # File operations
โ โโโ strings/ # String utilities
โ โโโ security/ # Security utilities
โ โโโ network/ # Network utilities
โ โโโ data/ # Data processing
โ โโโ async_utils/ # Async utilities
โโโ tests/ # Test files
โโโ examples/ # Example scripts
โโโ docs/ # Documentation
โโโ scripts/ # Development scripts
Coding Standards
Style Guidelines
- Follow PEP 8 style guide
- Use type hints for all functions
- Write docstrings for all public functions
- Keep functions focused and single-purpose
- Maximum line length: 88 characters
- Use meaningful variable names
Example Contribution
Adding a New Utility Function
"""
New utility function example
"""
from typing import List, Optional
from functools import wraps
def new_utility_function(
data: List[str],
option: Optional[str] = None
) -> List[str]:
"""
Brief description of what the function does.
Args:
data: List of strings to process
option: Optional parameter for customization
Returns:
List[str]: Processed list of strings
Raises:
ValueError: If input is invalid
Examples:
>>> new_utility_function(['a', 'b', 'c'])
['A', 'B', 'C']
>>> new_utility_function(['test'], option='upper')
['TEST']
"""
if not data:
raise ValueError("Data cannot be empty")
# Implementation here
result = [item.upper() for item in data]
return result
# Add tests in tests/test_module.py
# Update documentation in docs/
# Add examples in examples/
๐ Pull Request Process
Create a Branch
git checkout -b feature/amazing-feature
# or
git checkout -b fix/issue-description
Make Your Changes
Implement your feature or fix. Follow coding standards.
Run Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=pywizardry --cov-report=html
# Run specific test file
pytest tests/test_your_module.py -v
Code Quality Checks
# Format code
black src/pywizardry/
# Check imports
isort src/pywizardry/
# Lint code
flake8 src/pywizardry/
# Type checking
mypy src/pywizardry/
Commit Changes
git add .
git commit -m "feat: add amazing feature
- Added new utility function for X
- Improved performance of Y
- Fixed bug in Z
Closes #123"
Commit Message Format:
feat:New featurefix:Bug fixdocs:Documentationstyle:Formattingrefactor:Code restructuringtest:Testschore:Maintenance
Push and Create PR
git push origin feature/amazing-feature
Then create a Pull Request on GitHub with:
- Clear title and description
- Reference related issues
- Add screenshots if applicable
- Update documentation
Review Process
- CI tests must pass
- Code review by maintainers
- Address review comments
- Update PR if needed
๐ Documentation
Updating Documentation
PyWizardry documentation includes:
1. Docstrings
def example_function(param1: str, param2: int = 10) -> bool:
"""
Brief description of function.
Extended description explaining details, examples,
and edge cases.
Args:
param1: Description of first parameter
param2: Description of second parameter (default: 10)
Returns:
bool: Description of return value
Raises:
ValueError: When something goes wrong
Examples:
>>> example_function("test", 20)
True
>>> example_function("invalid")
False
"""
# Function implementation
return True
2. README Updates
Update README.md with:
- New features
- Usage examples
- Installation instructions
- Configuration options
3. API Documentation
Update API reference in docs/api/ directory.
๐งช Testing
Writing Tests
# tests/test_example.py
import pytest
from pywizardry import example_module
def test_basic_functionality():
"""Test basic functionality."""
result = example_module.example_function("test")
assert result is True
def test_with_parameters():
"""Test with different parameters."""
result = example_module.example_function("test", 20)
assert result is True
def test_edge_cases():
"""Test edge cases."""
with pytest.raises(ValueError):
example_module.example_function("")
def test_async_function():
"""Test async functions."""
import asyncio
result = asyncio.run(example_module.async_function())
assert result == expected_value
@pytest.mark.parametrize("input,expected", [
("a", "A"),
("b", "B"),
("c", "C"),
])
def test_parametrized(input, expected):
"""Parametrized test."""
result = example_module.process(input)
assert result == expected
Test Coverage
# Generate coverage report
pytest --cov=pywizardry --cov-report=html
# Minimum coverage requirement: 90%
# View report: open htmlcov/index.html
๐ฏ Areas for Contribution
Bug Fixes
- Check issue tracker for bugs
- Reproduce issues
- Submit fixes with tests
New Features
- Propose new utilities
- Discuss in issues first
- Implement with tests
Documentation
- Improve docstrings
- Add examples
- Fix typos/errors
Performance
- Optimize slow functions
- Add benchmarks
- Improve memory usage
Security
- Security audits
- Vulnerability fixes
- Security improvements
Internationalization
- Add localization
- Improve Unicode support
- Timezone handling