Thank you for your interest in contributing to Custom Functions! 🎉
This document provides guidelines and instructions for contributing. Please take a moment to read through it before making your first contribution.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Pull Request Process
- Coding Standards
- Testing Guidelines
- Documentation
- Commit Messages
- Issue Reporting
- Community
By participating in this project, you agree to abide by our Code of Conduct. Please read it before contributing.
- Python 3.12 or higher
- pip (Python package manager)
- Git
-
Fork the Repository
- Click the "Fork" button at the top right of the repository page
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/My_simple_functions.git cd My_simple_functions -
Set Up Remote Upstream
git remote add upstream https://github.com/coderooz/My_simple_functions.git
-
Create a Virtual Environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies
pip install -e ".[dev]" pip install flake8 black isort pytest pytest-cov -
Create a Branch
git checkout -b feature/your-feature-name # or git checkout -b fix/your-bug-fix
We welcome various types of contributions:
- 🐛 Bug Fixes: Fix issues reported in the issue tracker
- ✨ New Features: Add new functionality or handlers
- 📝 Documentation: Improve README, docstrings, or comments
- 🧪 Tests: Add or improve test coverage
- ⚡ Performance: Optimize existing code
- 🔧 Refactoring: Improve code structure without changing behavior
- 🔒 Security: Fix security vulnerabilities
- Look for issues labeled
good first issuefor beginner-friendly tasks - Check
help wantedfor areas where we need assistance - Always comment on an issue before starting work to avoid duplicate efforts
- Ensure your code follows the coding standards (see below)
- Add or update tests for your changes
- Update documentation if necessary
- Run the test suite and ensure all tests pass
- Update CHANGELOG.md with your changes
- Submit a Pull Request using the PR template
- Code follows project style guidelines
- Self-review completed
- Code is commented where necessary
- Documentation updated
- No new warnings generated
- Tests added/updated and passing
- CHANGELOG.md updated
- Project maintainers will review your PR
- Address any requested changes
- Once approved, a maintainer will merge your PR
We use the following tools to maintain code quality:
- Black: Code formatter
- isort: Import sorter
- flake8: Linter
- mypy: Type checker (optional)
# Format code with Black
black .
# Sort imports with isort
isort .
# Run flake8 linter
flake8 .
# Run all checks
black . && isort . && flake8 .- Follow PEP 8 style guide
- Use type hints where possible
- Write descriptive variable and function names
- Keep functions focused and single-purpose
- Maximum line length: 120 characters
def example_function(param1: str, param2: int = 10) -> dict:
"""Brief description of what the function does.
Args:
param1: Description of param1
param2: Description of param2 (default: 10)
Returns:
Description of return value
Raises:
ValueError: When param1 is empty
"""
if not param1:
raise ValueError("param1 cannot be empty")
# Implementation
result = {"key": param1, "count": param2}
return result# Run all tests
pytest
# Run with coverage
pytest --cov=custom_functions --cov-report=html
# Run specific test file
pytest tests/test_datahandler.py
# Run with verbose output
pytest -v- Place tests in the
tests/directory - Name test files as
test_<module_name>.py - Use descriptive test function names:
test_<function>_<scenario> - Test both normal cases and edge cases
- Mock external dependencies when appropriate
import pytest
from custom_functions.DataHandler import DataHandler
def test_timestamp_returns_string():
"""Test that timestamp returns a formatted string."""
result = DataHandler.timestamp()
assert isinstance(result, str)
def test_timestamp_custom_format():
"""Test timestamp with custom format."""
result = DataHandler.timestamp(format="%Y-%m-%d")
assert len(result) == 10Good documentation is essential. When contributing:
- Update README.md if adding new features
- Add docstrings to all public functions and classes
- Update inline comments for complex logic
- Include usage examples in docstrings
We use Google-style docstrings:
def my_function(param1: str) -> bool:
"""One-line summary.
Detailed description of what the function does,
its behavior, and any important notes.
Args:
param1: Description of parameter
Returns:
Description of return value
Raises:
ExceptionType: When condition occurs
"""We follow Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
feat(DataHandler): add JSON parsing utility
fix(FileHandler): handle empty file edge case
docs: update README with new installation instructions
test(DbHandler): add tests for createTb method
- Check existing issues to avoid duplicates
- Use the appropriate issue template
- Provide as much context as possible
- Website: https://coderooz.in
- Contact: https://coderooz.in/contact
- Email: contact@coderooz.in
All contributors will be recognized in:
- The CHANGELOG.md
- The README.md contributors section
- GitHub's contributors page
Thank you for contributing to Custom Functions! 🙏
Author: Ranit Saha
Website: https://coderooz.in