Workspace
workspace
Workspace detection and multi-package analysis.
Detects uv workspaces via [tool.uv.workspace] in pyproject.toml
and aggregates PackageInfo across all member packages.
analyze_workspace(path)
Analyze all packages in a uv workspace.
Discovers workspace members, analyzes each with analyze_package(),
and builds inter-package dependency edges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to workspace root. |
required |
Returns:
| Type | Description |
|---|---|
WorkspaceInfo
|
WorkspaceInfo with all packages and dependency edges. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If path is not a workspace root. |
Example
ws = analyze_workspace(Path("/path/to/workspace")) len(ws.packages) > 0 True
Source code in packages/axm-ast/src/axm_ast/core/workspace.py
build_workspace_context(path)
Build complete workspace context in one call.
Lists all packages, their mutual dependencies, per-package stats, and the workspace-level dependency graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to workspace root. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Workspace context dict. |
Source code in packages/axm-ast/src/axm_ast/core/workspace.py
build_workspace_dep_graph(ws)
Build an adjacency-list dependency graph between packages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ws
|
WorkspaceInfo
|
Analyzed workspace info. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, list[str]]
|
Dict mapping package dir name to list of packages it depends on. |
Example
graph = build_workspace_dep_graph(ws) graph["axm-mcp"]['axm']
Source code in packages/axm-ast/src/axm_ast/core/workspace.py
detect_workspace(path)
Detect a uv workspace at the given path.
Reads pyproject.toml looking for [tool.uv.workspace] members.
If found, resolves each member's source package directory and returns
a populated WorkspaceInfo. Returns None if not a workspace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to potential workspace root. |
required |
Returns:
| Type | Description |
|---|---|
WorkspaceInfo | None
|
WorkspaceInfo if workspace detected, None otherwise. |
Example
ws = detect_workspace(Path("/path/to/workspace")) ws is not None True
Source code in packages/axm-ast/src/axm_ast/core/workspace.py
format_workspace_graph_mermaid(ws)
Format the inter-package dependency graph as Mermaid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ws
|
WorkspaceInfo
|
Analyzed workspace info. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Mermaid diagram string. |