Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspace dependencies are not fully synced before run #7838

Open
mathialo opened this issue Oct 1, 2024 · 0 comments
Open

Workspace dependencies are not fully synced before run #7838

mathialo opened this issue Oct 1, 2024 · 0 comments

Comments

@mathialo
Copy link

mathialo commented Oct 1, 2024

I'm currently testing out the workspace features of uv, and have come across something unexpected.

When running uv run ... in a workspace member, it will install any new packages from the member's dependencies into the venv, but it will not remove any dependencies left-over from other members. That can lead to an issue where two members needs a dependency, and it's only listed for one, but unless you manually run uv sync every time you move between them you will not notice.

I've set up a small project to illustrate, with two subpackages:

.
├── project-a
│   ├── hello.py
│   ├── pyproject.toml
│   └── README.md
├── project-b
│   ├── hello.py
│   ├── pyproject.toml
│   └── README.md
├── pyproject.toml
├── README.md
└── uv.lock

where project-a has a dependency on pyhumps:

[project]
name = "project-a"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = ["pyhumps>=3.8.0"]

and project-b does not:

[project]
name = "project-b"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = []

Both have a similar hello.py test script that uses pyhumps:

from humps import pascalize

def main():
    print(f"Hello from {pascalize('project-a')}!")

if __name__ == "__main__":
    main()

If I run uv run hello.py in project-a first, uv run hello.py will work in project-b after - until I manually run uv sync and then it stops working.

This same behavior is there for dev dependencies as well. Say if one member dev-depends on pytest, running uv run pytest anywhere else in the workspace works until manually synced.

This can of course be worked around by always running uv sync, but knowing myself I will forget to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant