I'm setting up a Python monorepo using uv for dependency management. When I run uv sync
in the root directory, only the root package's dependencies are installed - none of the subpackages' dependencies are being installed.
I'm building a data platform monorepo using Python 3.12 and uv for dependency management. The project has several components:
engine-core
)orchestrator
)dbt_forge
)Here's the (simplified) project structure :
custom-data-forge/
├── pyproject.toml
└── packages/
├── engine-core/ # Python library with importable modules
│ └── pyproject.toml
├── orchestrator/ # Airflow DAGs and pipeline code
│ └── pyproject.toml
└── modeling/
└── dbt_forge/ # dbt models and ClickHouse transformations
└── pyproject.toml
Root pyproject.toml
:
[project]
name = "custom-data-forge"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["pandas", "sqlalchemy", "tabulate"]
[tool.uv.workspace]
members = [
"packages/engine-core",
"packages/orchestrator",
"packages/modeling/dbt_forge",
]
Subpackage pyproject.toml
files:
# packages/engine-core/pyproject.toml
[project]
name = "engine-core"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["dbt-core", "dbt-clickhouse"]
# packages/orchestrator/pyproject.toml
[project]
name = "orchestrator"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["engine-core", "apache-airflow"]
# packages/modeling/dbt_forge/pyproject.toml
[project]
name = "dbt_forge"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["dbt-core", "dbt-clickhouse"]
When I run uv sync
in the root directory:
pandas
, sqlalchemy
, etc.) are installeddbt-core
, dbt-clickhouse
, apache-airflow
)[tool.uv] package = true
to the subpackages' pyproject.toml
filespyproject.toml
[build-system]
sections are properly configureduv.lock
and tried againuv sync
install dependencies from all workspace members?__init__.py
files) for uv to recognize them?There are two ways to solve this :
Include subpackages as dependencies in your root pyproject.toml
dependencies = ["engine-core", "orchestrator", "dbt-forge", "tabulate"]
[tool.uv.workspace]
# Workspace members (local packages)
members = [
"packages/engine-core",
"packages/orchestrator",
"packages/dbt-forge",
]
[tool.uv.sources]
# Map local package names to workspace members
engine-core = { workspace = true }
orchestrator = { workspace = true }
dbt-forge = { workspace = true }
Use the flag uv sync --all-packages