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 '.[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.
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 agit+https
link, or some absolute path.In theory,
uv
automatically discovers thepyproject.toml
file and any parentpyproject.toml
file. For example, when usinguv
's own environment, runninguv pip install --editable '.[devel]'
works seamlessly. Unfortunately, the way Hatch invokesuv pip install
somehow interfers withuv
'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: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.