Skip to content

a colcon-venv package to manage venv for python packages #733

Description

@Briancbn

Managing python dependencies with pip has been especially annoying. It will be great if colcon can resolve the dependencies of all packages in the workspace and install them in a virtual environment.

Such feature existed in colcon-poetry-ros, but is limited to poetry. I did a quick prototype with UV in https://github.com/Briancbn/colcon-python-project-uv#usage. You can simply run the following command to setup a venv for your workspace

colcon venv sync

Then after build, an activate.sh file will be generated. User can simply source it and deactivate them as they like

$ source ./install/activate.sh

(colcon-ws) $ deactivate

$ 

This is currently just a prototype built on UV, but it supports poetry, uv_build, setuptools, scikit-build-core packages. UV also handles locking and resolving different versions of python dependencies. We have used this internally for a few months now for convenience.

We can also leverage pixi for this too and have a tighter integration with colcon-spawn-shell.

Please let me know if this is something useful for the community.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions