Skip to content

Latest commit

 

History

History
596 lines (452 loc) · 11.1 KB

GETTING_STARTED_WITH_EXPANSION.md

File metadata and controls

596 lines (452 loc) · 11.1 KB

🚀 Getting Started with Repository Expansion

This guide helps you start implementing the expansion roadmap immediately.


📖 Understanding the Roadmap

We've created three key documents to guide expansion:

  1. ROADMAP.md (13KB)

    • Comprehensive 10-phase expansion plan
    • Detailed tasks for each phase
    • Timeline estimates
    • Success metrics
  2. EXPANSION_PRIORITIES.md (8KB)

    • Top 10 immediate priorities
    • 30-day action plan
    • Quick setup commands
    • Learning paths
  3. EXPANSION_OVERVIEW.md (15KB)

    • Visual diagrams and charts
    • Priority matrices
    • Technology coverage map
    • Metrics dashboard

⚡ Quick Start: First Week

Day 1: Setup Testing Infrastructure

Goal: Get pytest working

# Install dependencies
pip install pytest pytest-cov pytest-mock

# Create pytest configuration
cat > pytest.ini << 'EOF'
[pytest]
testpaths = tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*
addopts = 
    --verbose
    --cov=.
    --cov-report=html
    --cov-report=term-missing
    --cov-report=xml
    --ignore=.git
    --ignore=.github
    --ignore=venv
    --ignore=env
EOF

# Create tests directory
mkdir -p tests
touch tests/__init__.py

# Create first test file
cat > tests/test_basic.py << 'EOF'
"""Basic tests to verify test infrastructure"""
import pytest

def test_imports():
    """Test that we can import common libraries"""
    import numpy
    import pandas
    import sklearn
    assert True

def test_python_version():
    """Verify Python version"""
    import sys
    assert sys.version_info >= (3, 8)
EOF

# Run tests
pytest

Expected Output: Tests pass, coverage report generated


Day 2: Setup CI/CD

Goal: Automate testing with GitHub Actions

# Create workflow directory
mkdir -p .github/workflows

# Create CI workflow
cat > .github/workflows/ci.yml << 'EOF'
name: CI

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main, develop ]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ['3.9', '3.10', '3.11', '3.12']

    steps:
    - uses: actions/checkout@v3
    
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
    
    - name: Cache dependencies
      uses: actions/cache@v3
      with:
        path: ~/.cache/pip
        key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
        restore-keys: |
          ${{ runner.os }}-pip-
    
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install pytest pytest-cov
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
    
    - name: Run tests
      run: |
        pytest --cov=. --cov-report=xml --cov-report=term
    
    - name: Upload coverage
      uses: codecov/codecov-action@v3
      if: matrix.python-version == '3.12'
      with:
        file: ./coverage.xml
        fail_ci_if_error: false

  lint:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.12'
    
    - name: Install linting tools
      run: |
        pip install black flake8 isort mypy
    
    - name: Check formatting with black
      run: black --check .
      continue-on-error: true
    
    - name: Lint with flake8
      run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
      continue-on-error: true
    
    - name: Check import sorting
      run: isort --check-only .
      continue-on-error: true
EOF

Expected Output: Workflow file created, will run on next push


Day 3: Add Pre-commit Hooks

Goal: Catch issues before committing

# Install pre-commit
pip install pre-commit

# Create configuration
cat > .pre-commit-config.yaml << 'EOF'
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-added-large-files
        args: ['--maxkb=1000']
      - id: check-json
      - id: check-toml
      - id: check-merge-conflict
      - id: debug-statements

  - repo: https://github.com/psf/black
    rev: 23.7.0
    hooks:
      - id: black
        language_version: python3.12

  - repo: https://github.com/PyCQA/flake8
    rev: 6.0.0
    hooks:
      - id: flake8
        args: ['--max-line-length=100', '--extend-ignore=E203,W503']

  - repo: https://github.com/pycqa/isort
    rev: 5.12.0
    hooks:
      - id: isort
        args: ["--profile", "black"]
EOF

# Install hooks
pre-commit install

# Run on all files (optional)
pre-commit run --all-files

Expected Output: Hooks installed, run on every commit


Day 4-5: Create First New Project (BERT Classification)

Goal: Add a transformer-based classification example

# Create project directory
mkdir -p bert_classification

# Create project structure
cd bert_classification
touch __init__.py
touch train.py
touch inference.py
touch utils.py

# Create requirements file
cat > requirements.txt << 'EOF'
transformers>=4.30.0
torch>=2.0.0
datasets>=2.12.0
scikit-learn>=1.3.0
numpy>=1.24.0
pandas>=2.0.0
tqdm>=4.65.0
EOF

# Create README
cat > README.md << 'EOF'
# BERT Text Classification

Fine-tuning BERT for text classification tasks.

## Features
- Pre-trained BERT model fine-tuning
- Support for binary and multi-class classification
- Training and evaluation scripts
- Inference examples

## Usage

### Training
```python
python train.py --dataset imdb --epochs 3 --batch-size 16

Inference

python inference.py --text "This movie is amazing!"

Model Performance

  • Accuracy: TBD
  • F1 Score: TBD EOF

**See detailed implementation in ROADMAP.md Phase 2.1**

---

## 📚 Recommended Reading Order

1. Start with **EXPANSION_PRIORITIES.md** (8KB)
   - Get immediate action items
   - Understand quick wins

2. Review **EXPANSION_OVERVIEW.md** (15KB)
   - See visual roadmap
   - Understand priorities

3. Deep dive into **ROADMAP.md** (13KB)
   - Full implementation details
   - Long-term planning

---

## 🎯 Your First Contribution

### Option 1: Testing (Beginner-Friendly)
Pick an existing project and write tests:

```python
# Example: tests/test_bag_of_words.py
import pytest
from basic_text_processing.bag_of_words import (
    create_bow_representation
)

def test_bag_of_words_basic():
    sentences = ["hello world", "world of code"]
    result = create_bow_representation(sentences)
    
    assert result is not None
    assert len(result) == 2
    # Add more assertions

def test_bag_of_words_empty():
    with pytest.raises(ValueError):
        create_bow_representation([])

Option 2: Documentation (Easy)

Improve project READMEs:

  • Add usage examples
  • Include expected outputs
  • Explain parameters
  • Add troubleshooting section

Option 3: New Project (Intermediate)

Implement from EXPANSION_PRIORITIES.md:

  • BERT classification
  • FastAPI deployment
  • Gradio demo app

🔧 Development Setup

Recommended IDE Setup

VS Code Extensions:

{
  "recommendations": [
    "ms-python.python",
    "ms-python.vscode-pylance",
    "ms-python.black-formatter",
    "charliermarsh.ruff",
    "njpwerner.autodocstring",
    "mhutchie.git-graph"
  ]
}

PyCharm Configuration:

  • Enable Black formatter
  • Configure pytest as test runner
  • Enable type checking (mypy)

📝 Commit Message Convention

type(scope): brief description

[optional body]

[optional footer]

Types:

  • feat: New feature/project
  • fix: Bug fix
  • docs: Documentation only
  • style: Formatting, missing semicolons, etc.
  • refactor: Code restructuring
  • test: Adding tests
  • chore: Maintenance tasks

Examples:

feat(bert): add BERT classification project
test(spacy): add unit tests for entity recognition
docs(readme): update installation instructions
ci: add GitHub Actions workflow

🚦 Development Workflow

1. Create Issue/Pick Task
   ↓
2. Create Branch
   git checkout -b feature/your-feature
   ↓
3. Implement Changes
   - Write code
   - Add tests
   - Update docs
   ↓
4. Run Tests Locally
   pytest
   ↓
5. Commit Changes
   git commit -m "feat: description"
   ↓
6. Push Branch
   git push origin feature/your-feature
   ↓
7. Create Pull Request
   - Link to issue
   - Describe changes
   - Request review
   ↓
8. Address Review Comments
   ↓
9. Merge!

✅ Definition of Done

Before marking a task complete, ensure:

  • Code implemented and working
  • Tests written and passing (>80% coverage)
  • Documentation updated
  • README includes usage examples
  • Code formatted (black, isort)
  • No linting errors
  • CI/CD passing
  • Peer review completed (if applicable)

🐛 Troubleshooting

Common Issues

1. Import Errors

# Solution: Install in development mode
pip install -e .

2. Test Discovery Issues

# Solution: Ensure __init__.py in test directories
touch tests/__init__.py

3. Pre-commit Hook Failures

# Solution: Run black and fix manually
black .
pre-commit run --all-files

4. ModuleNotFoundError

# Solution: Add to PYTHONPATH
export PYTHONPATH="${PYTHONPATH}:$(pwd)"

📊 Progress Tracking

Create a local tracking file:

cat > MY_PROGRESS.md << 'EOF'
# My Expansion Progress

## Completed
- [ ] Testing setup
- [ ] CI/CD configuration
- [ ] Pre-commit hooks

## In Progress
- [ ] BERT classification

## Next Up
- [ ] FastAPI deployment
- [ ] NER system

## Notes
- 

EOF

🎓 Learning Resources

Must-Read Before Starting

  1. Hugging Face Course (Free)

  2. PyTorch Tutorials (If using PyTorch)

  3. Testing in Python

Recommended Courses

  • Stanford CS224N (NLP)
  • Fast.ai NLP
  • DeepLearning.AI NLP Specialization

💬 Getting Help

Where to Ask Questions

  1. GitHub Issues

    • For bugs and feature requests
    • Tag with appropriate labels
  2. GitHub Discussions

    • For general questions
    • Share ideas
  3. Pull Request Comments

    • For implementation-specific questions

🎉 Celebrate Wins

Don't forget to:

  • ⭐ Star the repo
  • 📢 Share your contributions
  • 🤝 Help others
  • 💡 Suggest improvements

📅 Weekly Goals Template

## Week of [Date]

### Goals
1. [ ] Complete testing setup
2. [ ] Add 1 new project
3. [ ] Write 3 tests

### Actual Progress
- ✅ Completed testing setup
- 🚧 Started BERT project
- ❌ Blocked on: [issue]

### Next Week
- [ ] Finish BERT project
- [ ] Add FastAPI example

🔗 Quick Links


Ready to start? Pick your first task from EXPANSION_PRIORITIES.md!

Last Updated: October 2025