5.2 KiB
Contributing to AniWorld
Thank you for considering contributing to AniWorld! This document provides guidelines and instructions for contributing to the project.
Code of Conduct
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code.
How Can I Contribute?
Reporting Bugs
Before creating bug reports, please check the existing issues to avoid duplicates. When you are creating a bug report, please include as many details as possible:
- Use a clear and descriptive title
- Describe the exact steps which reproduce the problem
- Provide specific examples to demonstrate the steps
- Describe the behavior you observed after following the steps
- Explain which behavior you expected to see instead and why
- Include screenshots if applicable
Suggesting Enhancements
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include:
- Use a clear and descriptive title
- Provide a step-by-step description of the suggested enhancement
- Provide specific examples to demonstrate the steps
- Describe the current behavior and explain which behavior you expected to see instead
- Explain why this enhancement would be useful
Pull Requests
- Fork the repo and create your branch from
main - If you've added code that should be tested, add tests
- If you've changed APIs, update the documentation
- Ensure the test suite passes
- Make sure your code lints
- Issue that pull request!
Development Process
Setting Up Development Environment
-
Clone the repository:
git clone https://github.com/yourusername/aniworld.git cd aniworld -
Create and activate virtual environment:
python -m venv aniworld source aniworld/bin/activate # On Windows: aniworld\Scripts\activate -
Install development dependencies:
pip install -r requirements-dev.txt -
Install pre-commit hooks:
pre-commit install -
Set up environment variables:
cp src/server/.env.example src/server/.env # Edit .env file with your configuration
Running Tests
Run the full test suite:
pytest
Run specific test categories:
pytest tests/unit/ # Unit tests only
pytest tests/integration/ # Integration tests only
pytest tests/e2e/ # End-to-end tests only
Run with coverage:
pytest --cov=src --cov-report=html
Code Quality
We use several tools to maintain code quality:
- Black for code formatting
- isort for import sorting
- flake8 for linting
- mypy for type checking
- bandit for security scanning
Run all checks:
# Format code
black src tests
isort src tests
# Lint code
flake8 src tests
mypy src
# Security scan
bandit -r src
Architecture Guidelines
This project follows Clean Architecture principles:
- Core Layer: Domain entities, use cases, interfaces, exceptions
- Application Layer: Application services, DTOs, validators, mappers
- Infrastructure Layer: External concerns (database, providers, file system, etc.)
- Web Layer: Controllers, middleware, templates, static assets
- Shared Layer: Utilities, constants, decorators used across layers
Dependency Rules
- Dependencies should point inward toward the core
- Core layer should have no dependencies on outer layers
- Use dependency injection for external dependencies
- Use interfaces/protocols to define contracts
File Organization
- Group related functionality in modules
- Use clear, descriptive names
- Keep files focused and cohesive
- Follow Python package conventions
Commit Guidelines
We follow conventional commits:
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that do not affect the meaning of the coderefactor: A code change that neither fixes a bug nor adds a featuretest: Adding missing tests or correcting existing testschore: Changes to the build process or auxiliary tools
Example:
feat(api): add anime search endpoint
- Implement search functionality in anime controller
- Add search validation and error handling
- Include unit tests for search features
Documentation
- Update README.md if you change functionality
- Add docstrings to all public functions and classes
- Update API documentation for any API changes
- Include examples in docstrings where helpful
Performance Considerations
- Profile code changes for performance impact
- Minimize database queries
- Use caching appropriately
- Consider memory usage for large operations
- Test with realistic data sizes
Security Guidelines
- Validate all user input
- Use parameterized queries for database access
- Implement proper authentication and authorization
- Keep dependencies up to date
- Run security scans regularly
Release Process
- Update version in
pyproject.toml - Update
CHANGELOG.md - Create release branch
- Run full test suite
- Update documentation
- Create pull request for review
- Merge to main after approval
- Tag release
- Deploy to production
Questions?
Feel free to open an issue for any questions about contributing!