Contributing
Thank you for considering contributing to Macscribe! This guide will help you get started.
Getting Started
Prerequisites
- Python 3.12 or later
- macOS with Apple Silicon (M1, M2, M3, etc.)
- Git
- Basic knowledge of Python and command-line tools
Setting Up Development Environment
- Fork and clone the repository:
- Install dependencies:
Using pip:
Using uv (recommended):
- Verify installation:
Development Workflow
Making Changes
- Create a new branch:
or
- Make your changes:
Edit the relevant files in src/macscribe/
- Test your changes:
- Commit your changes:
Commit Message Guidelines
Follow these conventions:
Add:for new featuresFix:for bug fixesUpdate:for improvements to existing featuresDocs:for documentation changesTest:for test-related changesRefactor:for code refactoring
Examples:
git commit -m "Add: support for Spotify podcast URLs"
git commit -m "Fix: handle corrupted audio files gracefully"
git commit -m "Update: improve transcription accuracy"
git commit -m "Docs: add batch processing examples"
Code Style
Python Style Guide
Macscribe follows PEP 8 style guidelines:
- Use 4 spaces for indentation
- Maximum line length of 88 characters (Black formatter)
- Use descriptive variable names
- Add docstrings to functions and classes
Example:
def validate_input(input_source: str) -> bool:
"""
Validate whether the input is a supported URL or existing local file.
Args:
input_source: URL or file path to validate
Returns:
True if valid, False otherwise
"""
# Implementation
pass
Type Hints
Use type hints for function parameters and return values:
from typing import Optional
def process_audio(
audio_file: str,
model: str,
output_format: Optional[str] = None
) -> dict:
"""Process audio file with specified model."""
pass
Testing
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=macscribe
# Run specific test file
pytest tests/test_downloader.py
# Run specific test
pytest tests/test_downloader.py::test_validate_input
Writing Tests
Create tests in the tests/ directory:
# tests/test_downloader.py
from macscribe.downloader import validate_input
def test_validate_youtube_url():
"""Test validation of YouTube URLs."""
assert validate_input("https://youtube.com/watch?v=abc123")
assert validate_input("https://youtu.be/abc123")
def test_validate_invalid_url():
"""Test validation rejects invalid URLs."""
assert not validate_input("https://invalid-site.com")
def test_validate_local_file(tmp_path):
"""Test validation of local files."""
# Create temporary file
test_file = tmp_path / "test.mp3"
test_file.write_text("test")
assert validate_input(str(test_file))
Project Structure
macscribe/
├── src/
│ └── macscribe/
│ ├── __init__.py
│ ├── cli.py # CLI interface
│ ├── clipboard.py # Clipboard operations
│ ├── downloader.py # URL and file handling
│ └── transcriber.py # Transcription logic
├── tests/ # Test files
├── docs/ # Documentation
├── pyproject.toml # Project configuration
└── README.md
Adding New Features
Example: Adding Support for a New Platform
- Update
validate_inputindownloader.py:
def validate_input(input_source: str) -> bool:
# Existing code...
# Add new platform
if "newplatform.com" in input_source.lower():
return True
# Existing code...
- Add tests:
def test_validate_newplatform_url():
"""Test validation of NewPlatform URLs."""
assert validate_input("https://newplatform.com/video/123")
- Update documentation:
Edit relevant docs files to mention the new platform.
- Submit a pull request:
See "Submitting Pull Requests" section below.
Documentation
Building Documentation
Documentation is available at http://127.0.0.1:8000/ when serving locally.
Writing Documentation
- Use clear, concise language
- Include code examples
- Add links to related sections
- Use proper Markdown formatting
Example:
## Feature Name
Brief description of the feature.
### Usage
\`\`\`bash
macscribe example-command
\`\`\`
### Options
- `--option`: Description of option
Submitting Pull Requests
Before Submitting
- Ensure tests pass:
- Update documentation:
Add or update relevant documentation files.
- Update CHANGELOG (if exists):
Document your changes.
- Rebase on main:
Creating a Pull Request
- Push your branch:
-
Open a pull request on GitHub:
-
Go to the repository on GitHub
- Click "New Pull Request"
- Select your branch
-
Fill out the PR template
-
PR Description Template:
## Description
Brief description of changes.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Code refactoring
## Testing
Describe how you tested your changes.
## Checklist
- [ ] Tests pass
- [ ] Documentation updated
- [ ] Code follows style guidelines
- [ ] Commits are properly formatted
Code Review Process
- Maintainers will review your PR
- Address any feedback or requested changes
- Once approved, your PR will be merged
Areas for Contribution
High Priority
- [ ] Support for additional platforms (Spotify, SoundCloud, etc.)
- [ ] Cross-platform clipboard support (Linux, Windows)
- [ ] Output format options (SRT, VTT, JSON)
- [ ] Progress indicators for long transcriptions
- [ ] Configuration file support
Medium Priority
- [ ] Batch processing improvements
- [ ] Audio preprocessing options
- [ ] Custom model management
- [ ] Language detection
- [ ] Translation support
Documentation
- [ ] More usage examples
- [ ] Video tutorials
- [ ] API documentation improvements
- [ ] Troubleshooting guides
Reporting Bugs
Before Reporting
- Check if the issue already exists
- Verify you're using the latest version
- Collect relevant information
Bug Report Template
## Description
Clear description of the bug.
## Steps to Reproduce
1. Step 1
2. Step 2
3. Step 3
## Expected Behavior
What you expected to happen.
## Actual Behavior
What actually happened.
## Environment
- Macscribe version:
- Python version:
- OS version:
- Chip: M1/M2/M3
## Additional Context
Any other relevant information.
Feature Requests
Suggesting Features
- Check if the feature is already requested
- Clearly describe the feature and its benefits
- Provide use cases and examples
Feature Request Template
## Feature Description
Clear description of the proposed feature.
## Use Case
Describe why this feature would be useful.
## Proposed Implementation
If you have ideas about how to implement it.
## Alternatives
Other ways to achieve similar results.
Community Guidelines
Code of Conduct
- Be respectful and inclusive
- Provide constructive feedback
- Help others learn and grow
- Focus on what's best for the project
Getting Help
- Open an issue for bugs or questions
- Join discussions in existing issues
- Check documentation first
Recognition
Contributors will be recognized in:
- GitHub contributors list
- Release notes (for significant contributions)
- Documentation (for doc improvements)
License
By contributing to Macscribe, you agree that your contributions will be licensed under the MIT License.
Questions?
If you have questions about contributing, feel free to:
- Open an issue with your question
- Contact the maintainers
- Check existing documentation
Thank you for contributing to Macscribe!