Setup Summary¶
⚠️ Planned Feature: This document references CLI entry points (
ga-trees,ga-train,ga-experiment), the[api]extra (FastAPI/Uvicorn), and MLflow integration. These are not yet implemented in the current release.
📦 What Was Done¶
This update modernizes the package configuration to follow current Python packaging standards (PEP 517/518/621).
🎯 Key Changes¶
1. Enhanced pyproject.toml¶
- ✅ Proper dependency declarations
- ✅ Optional extras defined (
viz,optimization,baselines,explainability,api) - ✅ Development tools configuration
- ✅ Tool settings (black, isort, pytest, mypy, coverage, ruff)
- ✅ Entry points for CLI tools
2. Modernized setup.py¶
- ✅ Maintained for backward compatibility
- ✅ Reads from pyproject.toml standards
- ✅ Proper dependency grouping
- ✅ Entry points for console scripts
3. Cleaned requirements.txt¶
- ✅ ONLY core dependencies (9 packages)
- ✅ No optional dependencies
- ✅ Clear installation instructions
- ✅ Version pins for stability
4. New Requirements Files¶
- ✅
requirements-optional.txt- All optional features - ✅
requirements-dev.txt- Development tools
5. Enhanced CI/CD¶
- ✅ Multi-platform testing (Ubuntu, Windows, macOS)
- ✅ Python 3.8-3.12 support
- ✅ Code quality checks (black, isort, flake8, mypy)
- ✅ Integration tests
- ✅ Package building and validation
6. Pre-commit Hooks¶
- ✅ Automatic code formatting
- ✅ Import sorting
- ✅ Linting checks
- ✅ Type checking
- ✅ Security checks (bandit)
7. Additional Files¶
- ✅
MANIFEST.in- Package distribution - ✅
.pre-commit-config.yaml- Git hooks - ✅
INSTALLATION.md- Comprehensive guide - ✅
MIGRATION_GUIDE.md- Upgrade instructions - ✅
validate_setup.py- Setup validation script
📊 Dependency Structure¶
ga-optimized-trees
│
├── Core (always installed)
│ ├── numpy, pandas, scikit-learn, scipy
│ ├── deap (genetic algorithms)
│ ├── matplotlib, seaborn (plotting)
│ └── pyyaml, tqdm (utilities)
│
├── Optional Extras
│ ├── [viz] → graphviz, networkx
│ ├── [optimization] → optuna, mlflow
│ ├── [baselines] → xgboost, lightgbm
│ ├── [explainability] → shap, lime
│ ├── [api] → fastapi, uvicorn, pydantic
│ ├── [dev] → pytest, black, isort, flake8, mypy
│ ├── [all] → all features (not dev)
│ └── [full] → everything including dev
🚀 Installation Methods¶
Minimal (Core Only)¶
Installs: 9 core packages Use for: Basic usage, minimal footprint
With Features¶
# Visualization
pip install -e .[viz]
# Optimization tools
pip install -e .[optimization]
# Everything
pip install -e .[all]
Development¶
Legacy (Still Works)¶
✅ Validation¶
Run the validation script to check your setup:
This checks:
- ✓ Python version (3.8+)
- ✓ Core dependencies
- ✓ Package installation
- ✓ Optional dependencies (reports status)
- ✓ File structure
- ✓ Basic functionality
- ✓ CLI tools
📝 What You Need to Do¶
For Users (Just Using the Package)¶
Option 1: Minimal
Option 2: Full Features
For Developers (Contributing)¶
# 1. Install with dev tools
pip install -e .[dev]
# 2. Setup pre-commit
pre-commit install
# 3. Verify
python validate_setup.py
# 4. Run tests
pytest tests/ -v
🎉 Benefits¶
1. Cleaner Dependencies¶
- Core: 9 packages (was 15+)
- Optional features clearly separated
- No unnecessary bloat
2. Better Developer Experience¶
# Before
pip install numpy pandas scikit-learn scipy deap matplotlib seaborn pyyaml tqdm
pip install pytest black flake8 mypy
pip install optuna mlflow xgboost
# After
pip install -e .[dev]
3. Faster Installation¶
# Core only: ~30 seconds
pip install -e .
# vs Old way: ~2 minutes
pip install -r requirements.txt # (with optional deps)
4. Modern Standards¶
- PEP 517/518/621 compliant
- Ready for PyPI publication
- Works with modern tools (poetry, pip-tools, etc.)
5. Automatic Quality Checks¶
# Setup once
pre-commit install
# Now every commit:
# - Formats code (black)
# - Sorts imports (isort)
# - Checks style (flake8)
# - Validates types (mypy)
# - Checks security (bandit)
🔄 Migration Path¶
If You're Using the Old Setup¶
Don't panic! Old method still works:
But upgrade when ready:
# 1. Clean install
rm -rf venv/
python -m venv venv
source venv/bin/activate
# 2. New method
pip install -e .
# 3. Optional features if needed
pip install -e .[viz,optimization]
# 4. Validate
python validate_setup.py
📚 Documentation¶
- Installation: See
INSTALLATION.md - Migration: See
MIGRATION_GUIDE.md - Validation: Run
python validate_setup.py - Full Docs: See
docs/README.md
🐛 Troubleshooting¶
"Extra 'xyz' not found"¶
"No module named 'ga_trees'"¶
"Pre-commit hook failed"¶
📊 Before vs After¶
| Aspect | Before | After |
|---|---|---|
| Core deps | 15+ packages | 9 packages |
| Optional deps | Mixed in | Separate extras |
| Install time | ~2 min | ~30 sec (core) |
| Dev setup | Manual | pip install -e .[dev] |
| CI/CD | Basic | Multi-platform |
| Standards | Mixed | PEP 517/518/621 |
| Code quality | Manual | Automatic (pre-commit) |
🎯 Next Steps¶
- Validate Setup
- Run Quick Test
- Try Full Experiment
- Setup Development (if contributing)
✨ Highlights¶
- ✅ Zero breaking changes - old methods still work
- ✅ Cleaner installation - only 9 core packages
- ✅ Modern standards - PEP compliant
- ✅ Better tooling - pre-commit, ruff, mypy
- ✅ CI/CD enhanced - multi-platform testing
- ✅ Well documented - comprehensive guides
🤝 Contributing¶
The new setup makes contributing easier:
# Clone
git clone https://github.com/ibrah5em/ga-optimized-trees.git
cd ga-optimized-trees
# Setup
pip install -e .[dev]
pre-commit install
# Code (formatting is automatic!)
# ... make changes ...
git commit -m "feat: add new feature"
# Pre-commit hooks run automatically:
# ✓ Code formatted
# ✓ Imports sorted
# ✓ Style checked
# ✓ Types validated
📞 Support¶
- Issues: https://github.com/ibrah5em/ga-optimized-trees/issues
- Docs:
docs/README.md - FAQ:
docs/faq/faq.md
Ready to get started?
🎉 Enjoy the enhanced setup!