[Python] managing multi-component project with uv package manager

Discussão em 'Python' iniciado por Stack, Fevereiro 28, 2025.

  1. Stack

    Stack Membro Participativo

    I have an application that is made of a crawler, api, and data sub projects. crawler populates data in a DB, and an API serves data from that DB, so both depends on the data project. I am new with uv package manager and think thought this is a good use case for workspaces. My dir structure is as follows (simplified here):

    myapp
    |- pyproject.toml - define main project myapp, no dependencies. designate crawler, api, data as workspace members and set their source to workspace.
    |- crawler
    | |- pyproject.toml - define project crawler and its dependencies (including data, from workspace)
    | |- main.py
    |- api
    | |- pyproject.toml - define project api and its dependencies (including data, from workspace)
    | |- main.py
    |- data
    | |- pyproject.toml - define project data and its dependencies
    | |- main.py


    I'd expect to have a .venv for each project but it seems to create a .venv for the myapp root project regardless of where I run a uv command (in a sub project or in root), or regardless if I specify the --project flag (which I thought should run the command in that project's venv.

    Appreciate some guidance on how to manage a project like this, including how the pyprojects should be managed and how the uv commands should be executed. Thanks.

    Continue reading...

Compartilhe esta Página