Skip to content

smpy: workspace hint prints a bare relative path that smpy add parses as a PyPI name #471

Closed

Description

@antosubash

Regression from #446 (GH #442).

Problem

After creating a module that is a uv workspace member, smpy prints a hint (_echo_workspace_hint in framework/cli/simple_module_cli/cli.py):

smpy add <rel> --path <host>   # adds it as { workspace = true }

<rel> is os.path.relpath(module, host). When the module sits inside the host directory, for example host/modules/foo, that gives a bare modules/foo. parse_add_spec (git_source.py) only treats specs starting with ., / or ~ as paths, so smpy add modules/foo is parsed as a PyPI requirement and the copied command fails.

The common layout, with the module next to the host, gives ../modules/foo and works.

Fix

Prefix a bare relative path with ./ in the hint:

if not rel.startswith("."):
    rel = f"./{rel}"

Add a test covering a module inside the host dir.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions