workspace
_workspace
Workspace context detection for UV workspaces.
Detects whether a project path is a standalone package, a UV workspace root, or a member of a UV workspace. Used by the check engine to filter checks by context.
ProjectContext
detect_context(path)
Detect whether path is a standalone package, workspace, or member.
Detection logic:
- If path/pyproject.toml has
[tool.uv.workspace]→WORKSPACE - If a parent directory is a workspace root →
MEMBER - Otherwise →
STANDALONE
Gracefully falls back to STANDALONE on missing or corrupt TOML.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Project root directory to inspect. |
required |
Returns:
| Type | Description |
|---|---|
ProjectContext
|
The detected |
Source code in packages/axm-init/src/axm_init/checks/_workspace.py
find_workspace_root(path)
Walk parent directories looking for a UV workspace root.
A workspace root is a directory whose pyproject.toml contains a
[tool.uv.workspace] section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Starting directory (typically a member package). |
required |
Returns:
| Type | Description |
|---|---|
Path | None
|
The workspace root |
Source code in packages/axm-init/src/axm_init/checks/_workspace.py
get_workspace_members(path)
Resolve workspace member package names from path.
Reads the members globs from [tool.uv.workspace] in the
pyproject.toml at path, resolves them via Path.glob(), and
filters out directories matching exclude globs.
Each resolved directory must contain a pyproject.toml to be
considered a valid member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Workspace root directory. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of member directory names (relative to path). |