How tweag/python-monorepo-example works
Main Components
A. Repository Structure Layer
• Root Monorepo Container
• Libraries Container ("libs/")
• Templates Container ("templates/")
• CI/CD Container (".github/workflows/")
B. Library Components
• Base Library ("libs/base/")
• Fancy Library ("libs/fancy/")
• Their internal structure:
• Source code
• Tests
• Configuration files
C. Template System
• PyLibrary Template
• Template Hooks
• Cookiecutter Generation System
Relationships to Highlight
A. Dependencies Flow
• Virtual environment isolation
• Template generation flow
Use a Multi-Layer Approach
┌─ Monorepo Root ──────────────────────────────┐
• ┌─ Libraries ─────┐ ┌─ Templates ────────┐ │
• ┌─ Base ────┐ │ │ ┌─ PyLibrary ──┐ │ │
• ┘ │ │ └──────────────┘ │ │
• ┌─ Fancy ───┐ │ │ │ │
• ┘ │
• ┘ │ │
• ┘ │
• ┌─ CI/CD ──────────────────────────────┐ │
• ┘ │
• ┘
Important Elements
A. Library Components:
• ┌─ Library ─────────────┐
• Source Code │
• Tests │
• Requirements │
• Virtual Environment│
• ┘
B. Template System:
• ┌─ Template ───────────┐
• Cookiecutter JSON │
• Hooks │
• Template Files │
• ┘
Additional Details
• Version control integration points
• How editable installs work between libraries
• Test execution paths
• Template instantiation process
Remember to:
• Clear labels for all components
• Notes about the "live at HEAD" workflow
• Document virtual environment isolation