Thank you for your interest in contributing to GhostStream! This document provides guidelines and information for contributors.
- Code of Conduct
- Getting Started
- How to Contribute
- Development Setup
- Code Style
- Testing
- Pull Request Process
- Issue Guidelines
This project follows the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/ghoststream.git cd ghoststream - Add upstream remote:
git remote add upstream https://github.com/ORIGINAL_OWNER/ghoststream.git
Before submitting a bug report:
- Check existing issues to avoid duplicates
- Collect information about the bug:
- OS and version (Windows/macOS/Linux)
- Python version
- FFmpeg version
- GPU and driver version (if applicable)
- Steps to reproduce
- Expected vs actual behavior
- Relevant log output
Feature requests are welcome! Please:
- Check if the feature has already been requested
- Describe the use case and why it would be valuable
- Consider if it fits the project's scope
We accept pull requests for:
- Bug fixes
- New features (discuss in an issue first for major features)
- Documentation improvements
- Test coverage improvements
- Performance optimizations
- Python 3.10+
- FFmpeg with hardware acceleration support
- Git
# Clone your fork
git clone https://github.com/YOUR_USERNAME/ghoststream.git
cd ghoststream
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/macOS
# or
.\venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Install development dependencies
pip install pytest pytest-asyncio black isort mypy
# Verify setup
python -m ghoststream --helpghoststream/
├── ghoststream/ # Main package
│ ├── __init__.py
│ ├── __main__.py # Entry point
│ ├── api.py # FastAPI routes
│ ├── config.py # Configuration
│ ├── hardware.py # Hardware detection
│ ├── jobs.py # Job management
│ ├── models.py # Pydantic models
│ ├── transcoder.py # Legacy re-exports
│ └── transcoding/ # Modular transcoding package
│ ├── adaptive.py # Enterprise load balancing
│ ├── commands.py # FFmpeg command building
│ ├── constants.py # Constants and presets
│ ├── encoders.py # Encoder selection
│ ├── engine.py # Main engine
│ ├── filters.py # Video filters
│ ├── models.py # Transcoding models
│ └── probe.py # Media probing
├── tests/ # Test suite
├── docs/ # Documentation
├── examples/ # Usage examples
└── docker/ # Docker files
We follow PEP 8 with these tools:
# Format code with black
black ghoststream/
# Sort imports with isort
isort ghoststream/
# Type checking with mypy
mypy ghoststream/- Use type hints for all function signatures
- Write docstrings for public functions and classes
- Keep functions focused and small
- Use meaningful variable names
- Add comments for complex logic
async def transcode_video(
source: str,
output_config: OutputConfig,
progress_callback: Optional[Callable[[TranscodeProgress], None]] = None
) -> Tuple[bool, str]:
"""
Transcode a video file with the given configuration.
Args:
source: URL or path to source video
output_config: Transcoding output configuration
progress_callback: Optional callback for progress updates
Returns:
Tuple of (success, output_path_or_error_message)
"""
# Implementation...# Run all tests
pytest
# Run with coverage
pytest --cov=ghoststream
# Run specific test file
pytest tests/test_transcoder.py
# Run with verbose output
pytest -v- Place tests in the
tests/directory - Name test files
test_*.py - Name test functions
test_* - Use pytest fixtures for common setup
- Mock external dependencies (FFmpeg, nvidia-smi, etc.)
import pytest
from ghoststream.transcoding import TranscodeEngine
@pytest.fixture
def engine():
return TranscodeEngine()
async def test_get_media_info(engine):
info = await engine.get_media_info("test_video.mp4")
assert info.width > 0
assert info.height > 0-
Create a branch for your changes:
git checkout -b feature/your-feature-name # or git checkout -b fix/bug-description -
Make your changes with clear, atomic commits
-
Test your changes:
pytest black --check ghoststream/ isort --check ghoststream/
-
Update documentation if needed
-
Push to your fork:
git push origin feature/your-feature-name
-
Open a Pull Request on GitHub
-
Fill out the PR template with:
- Description of changes
- Related issue numbers
- Testing done
- Screenshots (if UI changes)
- Maintainers will review your PR
- Address any requested changes
- Once approved, your PR will be merged
Use the bug report template and include:
- Clear title describing the issue
- Steps to reproduce
- Expected behavior
- Actual behavior
- Environment details
- Logs/screenshots
Use the feature request template and include:
- Clear description of the feature
- Use case / motivation
- Possible implementation approach
- Alternatives considered
- Open a Discussion on GitHub
- Check existing issues and discussions
- Read the documentation in
docs/
Thank you for contributing to GhostStream! 🎉