Thank you for your interest in contributing to Backtrader Web! This document provides guidelines and instructions for contributors.
- Development Workflow
- Setting Up Development Environment
- Running Tests
- Coding Standards
- Submitting Changes
- Code Review Process
# Fork the repository on GitHub
git clone https://github.com/YOUR_USERNAME/backtrader_web.git
cd backtrader_webgit checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fixBranch naming conventions:
feature/- New featuresfix/- Bug fixesrefactor/- Code refactoringdocs/- Documentation changestest/- Test additions or updates
Follow the coding standards outlined below.
Ensure all tests pass before pushing (see Running Tests).
Use conventional commit messages:
git commit -m "feat: add new strategy backtest feature"Commit types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasksperf: Performance improvementsci: CI/CD changes
git push origin feature/your-feature-nameThen create a pull request on GitHub.
- Python 3.10+
- Node.js 20+
- PostgreSQL 14+ (optional, for integration tests)
- Redis 7+ (optional)
cd src/backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -e ".[dev,postgres,redis,backtrader]"
# Run database migrations
python -c "from app.db.database import init_db; import asyncio; asyncio.run(init_db())"cd src/frontend
# Install dependencies
npm install
# Start development server
npm run devcd src/backend
# Run all tests
pytest
# Run specific test file
pytest tests/test_auth.py
# Run with coverage
pytest --cov=app --cov-report=html
# Run integration tests
pytest -m integration
# Run with verbose output
pytest -vcd src/frontend
# Run all unit tests
npm run test
# Run with coverage
npm run test -- --coverage
# Watch mode
npm run test -- --watch# Using the E2E runner script (recommended)
./scripts/run-e2e.sh
# Or manually
cd src/frontend
npm run test:e2e
# With UI mode
npm run test:e2e:ui
# Debug mode
npm run test:e2e:debug
# Specific browser
npx playwright test --project=chromium
# Specific test file
npx playwright test auth.spec.ts# Start all services
docker-compose -f docker-compose.ci.yml up -d
# Run E2E tests
cd src/frontend
export BASE_URL=http://localhost:3000
npm run test:e2e
# Stop services
docker-compose -f docker-compose.ci.yml down- Follow PEP 8 style guidelines
- Use Ruff for linting and formatting
- Maximum line length: 100 characters
- Use type hints for function signatures
- Write docstrings for public functions and classes
from typing import List, Optional
def get_strategies(user_id: int, active: Optional[bool] = None) -> List[dict]:
"""
Retrieve strategies for a user.
Args:
user_id: The user's ID
active: Filter by active status
Returns:
List of strategy dictionaries
"""
# Implementation...- Use ESLint for linting
- Follow Vue 3 Composition API patterns
- Use Pinia for state management
- Write meaningful component names
// Good
<script setup lang="ts">
import { ref, computed } from 'vue'
interface Strategy {
id: number
name: string
}
const strategies = ref<Strategy[]>([])
const activeCount = computed(() => strategies.value.filter(s => s.active).length)
</script>- Unit tests should be fast and isolated
- E2E tests should cover critical user flows
- Mock external dependencies (API calls, database)
- Use descriptive test names
# Good test name
def test_login_with_valid_credentials_returns_token():
# ...Before submitting a PR, ensure:
- All tests pass locally
- Code follows style guidelines
- New features include tests
- Documentation is updated
- Commit messages follow conventions
- PR description is clear and complete
## Summary
Brief description of changes.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
Describe testing performed.
## Screenshots (if applicable)
Add screenshots for UI changes.
## Related Issues
Fixes #123
Related to #456- Be Constructive: Provide helpful feedback
- Be Respectful: Treat others with respect
- Be Timely: Respond to reviews promptly
- Explain Why: Explain reasoning for suggestions
- Code follows project standards
- Tests are adequate
- No security vulnerabilities
- Performance impact considered
- Documentation updated
- Make requested changes
- Reply to each comment with your response
- Mark conversations as resolved when addressed
- Request re-review when ready
All pull requests go through automated checks:
- Lint: Code style checks
- Tests: Unit and integration tests
- Build: Production build validation
- E2E: End-to-end browser tests
- Security: Security vulnerability scanning
See CI/CD Documentation for details.
- Open an issue for bugs or feature requests
- Start a discussion for questions
- Check existing documentation
By contributing, you agree that your contributions will be licensed under the MIT License.