Development Setup¶
Complete guide for setting up PMCGrab for development.
Prerequisites¶
- Python 3.10+
- Git
- uv (recommended)
Installation¶
1. Clone the Repository¶
2. Set Up Virtual Environment¶
3. Verify Installation¶
Development Tools¶
Code Quality¶
# Linting
uv run ruff check .
# Formatting
uv run ruff format .
# Type checking
uv run mypy src/
# Security scanning
uv run bandit -r src/
Testing¶
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=pmcgrab
# Run specific test file
uv run pytest tests/test_model.py
Documentation¶
Pre-commit Hooks¶
Install pre-commit hooks:
This will run checks automatically before each commit.
Environment Variables¶
For development, create a .env
file:
IDE Setup¶
VS Code¶
Recommended extensions:
- Python
- Pylance
- Ruff
- Test Explorer UI
Workspace settings in .vscode/settings.json
:
{
"python.defaultInterpreterPath": ".venv/bin/python",
"python.linting.enabled": true,
"python.formatting.provider": "black",
"python.testing.pytestEnabled": true
}
PyCharm¶
- Open project in PyCharm
- Configure Python interpreter to use virtual environment
- Enable pytest as test runner
- Configure Ruff as code formatter
Common Development Tasks¶
Adding a New Feature¶
- Create feature branch
- Add implementation in
src/pmcgrab/
- Add tests in
tests/
- Update documentation
- Run all checks
- Submit pull request
Debugging¶
# Enable verbose logging
export PMCGRAB_LOG_LEVEL=DEBUG
# Run with debugger
uv run python -m pdb -c continue -m pmcgrab.cli.pmcgrab_cli --help
Performance Profiling¶
# Profile code
uv run python -m cProfile -o profile.stats script.py
# Analyze results
uv run python -c "import pstats; pstats.Stats('profile.stats').sort_stats('cumulative').print_stats(20)"
Troubleshooting¶
Common Issues¶
- Import errors: Ensure virtual environment is activated
- Test failures: Check if all dependencies are installed
- Linting errors: Run
uv run ruff format .
to auto-fix
Getting Help¶
- Check existing issues on GitHub
- Ask questions in discussions
- Join our development chat (if available)