uv icon indicating copy to clipboard operation
uv copied to clipboard

Feature Request: Command to Install All Dependencies Listed in pyproject.toml

Open dimanu-py opened this issue 1 year ago • 3 comments

I've been using uv and really enjoy it, but I've noticed a missing feature that other package managers like pdm provide: a command to install all the dependencies listed in the pyproject.toml file.

When I clone a project, the first step is usually installing all dependencies. With pdm, for example, I can simply run pdm install, and it automatically creates a virtual environment and installs all the required dependencies. Additionally, this can be filtered to install only specific types of dependencies (e.g., production, dev).

I was expecting a similar feature in uv, but I couldn't find a way to install all dependencies directly from the pyproject.toml file. Having such a command would make project setup much easier and faster.

I think adding this command would improve the user experience for managing dependencies in projects.

Thank you for considering this!

dimanu-py avatar Dec 14 '24 22:12 dimanu-py

Are you looking for uv sync, maybe?

charliermarsh avatar Dec 15 '24 00:12 charliermarsh

@charliermarsh I believed so when reading the documentation. But after some tries I didn't manage to make it work as I expected, thus I open the issue.

Maybe I am using it wrong, this is what I tried:

  • Clone a one of repositories that was setup with uv and had some dependencies:

    Current pyproject.toml file here
      [project]
      name = "python-template"
      version = "0.1.0"
      description = "Python template for projects"
      readme = "README.md"
      requires-python = ">=3.12"
      dependencies = []
    
      [dependency-groups]
      test = [
          "coverage>=7.6.9",
          "doublex>=1.9.6.1",
          "doublex-expects>=0.7.1",
          "expects>=0.9.0",
          "pytest>=8.3.4",
          "pytest-watch>=4.2.0",
          "pytest-xdist>=3.6.1",
      ]
      lint = [
          "mypy>=1.13.0",
          "ruff>=0.8.3",
          "yapf>=0.43.0",
      ]
    
  • Go to the folder in my terminal, no .venv folder is yet created

  • Run uv sync

  • The virtual environment gets created, but no dependencies are install

dimanu-py avatar Dec 16 '24 13:12 dimanu-py

dependency-groups are not included by default, you should try uv sync --all-groups

j178 avatar Dec 17 '24 01:12 j178

Or, change your default-groups declaration.

zanieb avatar Dec 17 '24 02:12 zanieb

@j178 thanks for the help, that tag fixed the problem.

Turns out that with the version I was using that command didn't exist and had to upgrade uv 👍

dimanu-py avatar Dec 17 '24 11:12 dimanu-py