Thank you for your interest in contributing to the Python IMDB Bot! This document provides guidelines and information for contributors.
- Code of Conduct
- Getting Started
- Development Setup
- Development Workflow
- Code Style
- Testing
- Submitting Changes
- Documentation
- Issue Reporting
This project follows a code of conduct to ensure a welcoming environment for all contributors. By participating, you agree to:
- Be respectful and inclusive
- Focus on constructive feedback
- Accept responsibility for mistakes
- Show empathy towards other contributors
- Help create a positive community
- Python 3.11 or higher
- Git
- Supabase account (for database development)
- Discord Bot Token (for testing)
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/your-username/python-imdb-bot.git cd python-imdb-bot - Add the upstream remote:
git remote add upstream https://github.com/original-repo/python-imdb-bot.git
Using uv (recommended):
# Install uv if not already installed
pip install uv
# Install dependencies
uv syncUsing pip:
pip install -r requirements.txtCreate a .env file for development:
cp .env.example .env
# Edit .env with your development credentialsRequired environment variables:
DISCORD_TOKEN: Your Discord bot tokenSUPABASE_URL: Supabase project URLSUPABASE_KEY: Supabase anon keyOMDB_API_KEY: OMDB API key (optional for basic functionality)
- Create a Supabase project for development
- Apply migrations:
npx supabase db push
- Verify schema:
npx supabase db diff
# Using uv
uv run python main.py
# Or using Python directly
python main.pymain: Production-ready codedevelop: Integration branch for featuresfeature/*: Feature branchesbugfix/*: Bug fix brancheshotfix/*: Critical fixes for production
Follow conventional commit format:
type(scope): description
[optional body]
[optional footer]
Types:
feat: New featuresfix: Bug fixesdocs: Documentation changesstyle: Code style changesrefactor: Code refactoringtest: Testing related changeschore: Maintenance tasks
Examples:
feat(rating): add emoji-based rating system
fix(api): handle OMDB API rate limits
docs(readme): update installation instructions
- Create a feature branch from
develop - Make your changes
- Write tests for new functionality
- Update documentation if needed
- Ensure all tests pass
- Submit a pull request to
develop
This project follows PEP 8 with some additional guidelines:
- Use
blackfor code formatting - Use
isortfor import sorting - Maximum line length: 88 characters
- Use type hints for function parameters and return values
- Use docstrings for all public functions and classes
# Format code with black
uv run black .
# Sort imports with isort
uv run isort .
# Check style with flake8
uv run flake8 .# Run pylint for additional checks
uv run pylint src/Install pre-commit hooks to automatically format and lint code:
pip install pre-commit
pre-commit install# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=src
# Run specific test file
uv run pytest tests/test_bot.py- Place tests in the
tests/directory - Use descriptive test names
- Test both success and failure cases
- Mock external API calls
- Use fixtures for common test data
Example test structure:
import pytest
from src.python_imdb_bot.utils import parse_message
class TestMessageParsing:
def test_valid_imdb_url(self):
"""Test parsing of valid IMDB URLs"""
message = "Check out tt0111161"
result = parse_message(message)
assert result is not None
assert result.IMDB_ID == "tt0111161"
def test_invalid_url(self):
"""Test handling of invalid URLs"""
message = "This is just text"
result = parse_message(message)
assert result is NoneBefore submitting a pull request, ensure:
- Code follows the established style guidelines
- All tests pass locally
- New functionality is covered by tests
- Documentation is updated if needed
- Commit messages follow conventional format
- Branch is up to date with
develop
Use the following template for pull requests:
## Description
Brief description of the changes made.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Refactoring
- [ ] Performance improvement
## Testing
Describe how the changes were tested.
## Checklist
- [ ] Tests pass
- [ ] Documentation updated
- [ ] Code style checks pass
- [ ] Ready for review- Use docstrings for all public functions, classes, and methods
- Follow Google docstring format
- Include type hints
- Document parameters, return values, and exceptions
- Update README.md for user-facing changes
- Update API.md for endpoint changes
- Update this CONTRIBUTING.md for process changes
- Keep changelog up to date
When reporting bugs, please include:
- Description: Clear description of the issue
- Steps to Reproduce: Step-by-step instructions
- Expected Behavior: What should happen
- Actual Behavior: What actually happens
- Environment: Python version, OS, bot version
- Logs: Relevant log output (with sensitive info removed)
For feature requests, include:
- Description: What feature you'd like to see
- Use Case: Why this feature would be useful
- Implementation Ideas: Any thoughts on how to implement it
- Alternatives: Other solutions you've considered
- Documentation: Check the README and other docs first
- Issues: Search existing issues before creating new ones
- Discussions: Use GitHub Discussions for questions
- Discord: Join our Discord server for real-time help
Contributors will be recognized in the project:
- Contributors list in README.md
- Changelog entries
- GitHub contributor statistics
Thank you for contributing to the Python IMDB Bot! 🎬