Welcome to the chemeleon2 project! This guide will help you set up your development environment and understand our workflow.
(prerequisites-section)=
Before starting, ensure you have:
- Python 3.11+ installed
- Git installed
- uv package manager (recommended)
If you don't have uv installed:
curl -LsSf https://astral.sh/uv/install.sh | sh(setup-section)=
git clone https://github.com/hspark1212/chemeleon2.git
cd chemeleon2# Install all dependencies with dev dependencies (pytest, ruff, pyright, etc.)
uv sync --extra dev
# Optional install torch with your cuda version (e.g., for CUDA 12.8)
uv pip install torch==2.7.0 torchvision==0.22.0 torchaudio==2.7.0 --index-url https://download.pytorch.org/whl/cu128Install pre-commit hooks to ensure code quality on every commit:
# activate the virtual environment
source .venv/bin/activate
# Install pre-commit hooks
pre-commit installTest that everything works:
# Run pre-commit hooks on all files to ensure code quality
pre-commit run --all-files
# Run pytest to ensure tests pass
pytest -v(git-workflow-section)=
- Repository (repo): Folder with your project code and its entire history
- Branch: Independent workspace for changes.
maincontains stable code - Commit: Saved snapshot of your code changes
- Push: Upload local changes to GitHub
- Pull Request (PR): Request to merge your changes into
main
- Create a new branch for your work
- Make your changes and commit them
- Push your branch to GitHub
- Create a Pull Request
- Wait for review - maintainers will review and merge
# Check what branch you're on
git branch
# Create and switch to a new branch
git checkout -b feature/my-feature
# Check what files changed
git status
# Stage all changes
git add .
# Commit (pre-commit hooks run automatically)
git commit -m "feat: add new feature"
# Push to GitHub (first time)
git push -u origin feature/my-feature
# Push to GitHub (subsequent times)
git push- Features:
feature/description - Bug fixes:
fix/description - Documentation:
docs/description - Examples:
feature/add-model,fix/training-bug,docs/update-readme
(dev-workflow-section)=
-
Activate the virtual environment (if not already activated):
source .venv/bin/activate -
Create a branch (see Git Workflow above)
-
Make your changes in your code editor
-
Test your changes locally:
# Run relevant tests pytest tests/ # Or run specific test files pytest tests/unit/test_your_feature.py
-
Commit your changes:
git add . git commit -m "feat: descriptive commit message"
Pre-commit hooks will automatically run. If they fail:
- Fix the issues shown
- Stage changes again:
git add . - Commit again:
git commit -m "your message"
-
Push to GitHub:
git push -u origin your-branch-name
-
Create a Pull Request:
- Go to GitHub
- Click "Compare & pull request"
- Describe your changes
- Submit for review
Use conventional commit format:
feat: add new feature- New functionalityfix: resolve bug in training- Bug fixesdocs: update README- Documentationtest: add unit tests- Testsrefactor: reorganize code- Code restructuringchore: update dependencies- Maintenance
(testing-section)=
# Run all tests
pytest tests/
# Run specific test categories
pytest tests/ -m baseline # Baseline validation
pytest tests/ -m unit # Unit tests
pytest tests/ -m integration # Integration tests
# Run specific test file
pytest tests/unit/test_featurizer.py -v# Check code style
ruff check .
# Auto-fix issues
ruff check . --fix
# Format code
ruff format .Hooks run automatically on git commit. To run manually:
# Run on all files
.venv/bin/pre-commit run --all-files
# Run on staged files only
.venv/bin/pre-commit run(troubleshooting-section)=
# Reinstall hooks
.venv/bin/pre-commit uninstall
.venv/bin/pre-commit installIf you encounter import errors, reinstall the package in editable mode:
# Using uv sync (recommended)
uv sync --extra dev
# Or using uv pip
source .venv/bin/activate
uv pip install -e ".[dev]"If you have dependency conflicts or installation issues:
Option 1: Using uv sync (recommended)
# Clear and reinstall with uv sync
rm -rf .venv
uv sync --extra dev
.venv/bin/pre-commit installOption 2: Using uv pip
# Clear and reinstall with uv pip
rm -rf .venv
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
.venv/bin/pre-commit installEnsure you're using Python 3.11+:
python --version
# or
.venv/bin/python --versionThank you for contributing to chemeleon2!