This guide helps you get started contributing to the deep-solutions project.
- Prerequisites
- Getting the Code
- Environment Setup
- Installing Dependencies
- Verifying Setup
- Development Workflow
- Quick Reference
- Next Steps
Before starting, ensure your system has:
- Git - Version control
- Conda (Miniconda/Anaconda) - Python environment management
- Python 3.8 - Development environment (required)
⚠️ Important: This project requires development in Python 3.8 environment. Although the project supports 3.8-3.12, development must use the minimum supported version to ensure compatibility.
If you're an external contributor, first fork the repository:
- Visit deep-solutions
- Click the Fork button in the top right
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/deep-solutions.git
cd deep-solutions- Add upstream remote:
git remote add upstream https://github.com/FrostyHec/deep-solutions.gitIf you're a team member, clone directly:
git clone https://github.com/FrostyHec/deep-solutions.git
cd deep-solutionsThis project uses the Pip-in-Conda strategy:
| Tool | Responsibility |
|---|---|
| Conda | Manages Python version only (creates isolated environment) |
| Pip | Manages all Python package dependencies |
📌 Why this design?
- Avoids dependency conflicts from mixing conda and pip
pyproject.tomlis the single source of truth for dependencies- Consistent with CI/CD environment
# Create Python 3.8 environment
conda create -n deep-solutions python=3.8 -y
# Activate environment
conda activate deep-solutionsAfter activating the environment, install the project in editable mode with dev dependencies:
# Install project (editable mode) + dev dependencies
pip install -e ".[dev]"This installs:
- The project itself (editable mode, changes take effect immediately)
- Core dependencies (numpy, scipy)
- Development dependencies (pytest, ruff, mypy, tox, commitizen, pre-commit, etc.)
# Install pre-commit hooks (one-time setup)
pre-commit install --hook-type commit-msg
pre-commit installRun the following commands to verify your environment is correctly configured:
# Check Python version
python --version
# Output should be: Python 3.8.x
# Check package is installed
python -c "import deep_solutions; print(deep_solutions.__version__)"
# Run tests
pytest
# Run code checks
ruff check src/ tests/
# Run type checks
mypy src/If all commands succeed, your environment is correctly configured!
Always create a new branch from the latest main:
# Get latest code
git fetch origin
git checkout main
git pull origin main
# Create feature branch
git checkout -b feature/your-feature-name- Source code goes in
src/deep_solutions/directory - Test files go in
tests/directory - Ensure code has proper type annotations and docstrings
- All comments and docstrings must be in English
Before committing, use the one-click check script:
./scripts/check.shThis script runs:
- Code formatting (ruff format)
- Lint check (ruff check)
- Type check (mypy)
- Run tests (pytest)
Use Commitizen for conventional commits:
# Interactive commit (recommended)
cz commit
# Or standard git commit with proper format
git commit -m "feat: add new feature X"
# Push to remote
git push origin feature/your-feature-name- Visit the GitHub repository
- Click "Compare & pull request"
- Fill in PR description using the template
- Wait for CI checks and code review
Merge Requirements: PR must pass all CI checks and receive at least one review approval before merging.
| Task | Command |
|---|---|
| Activate environment | conda activate deep-solutions |
| Install dependencies | pip install -e ".[dev]" |
| Run tests | pytest |
| Format code | ruff format src/ tests/ |
| Lint check | ruff check src/ tests/ |
| Type check | mypy src/ |
| One-click check | ./scripts/check.sh |
| Simulate CI | ./scripts/ci-local.sh |
| Tox test | tox -e py38 |
| Interactive commit | cz commit |
| Language check | python scripts/check_language.py |
After completing environment setup, we recommend reading:
- Project Structure - Understand directory structure and dependency management
- Code Standards - Learn commit conventions and code style
- Local Testing Guide - Learn various local testing methods
- CI Workflow - Understand CI/CD process
- Language Guidelines - Understand bilingual requirements
- Commit Conventions - Learn commit message format
If you encounter issues:
- Check GitHub Issues
- Create a new Issue describing your problem
- Participate in Discussions
Welcome to join us! 🎉