Skip to content

Support for uv workspace #1639

@JP-Ellis

Description

@JP-Ellis

Summary

Provide compatibility with uv workspaces.

Background

uv has recently added support for workspaces which you can read about here. When configured, all packages within a specific workspace are all automatically installed as editable. Workspaces also provides support for specific overrides, for example, by specifying that a package should be installed from a git+https link, or some absolute path.

In theory, uv automatically discovers the pyproject.toml file and any parent pyproject.toml file. For example, when using uv's own environment, running uv pip install --editable '.[devel]' works seamlessly. Unfortunately, the way Hatch invokes uv pip install somehow interfers with uv's automatic discovery of workspaces.

Workaround

The workaround at the moment is to run uv pip install --editable ... by hand using Hatch's pre-install commands. For example, the following works fine:

[tool.hatch.envs.default]
installer            = "uv"
features             = ["devel"]
pre-install-commands = ["uv pip install --editable '.[devel]'"]  # omitting this results in a failure

It is unclear to me how this is a workaround, as I would have expected Hatch to run the same pre-install command in the background.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions