You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working with ROS 2 Humble, largely in Python. I'm managing an environment for a few users, and I've chosen uv as our scheme for managing virtual environments.
ROS 2 can respect Python virtual environments, but it relies on whatever is set in PYTHONPATH for those. At the moment, I am having to manually set it as such: export PYTHONPATH=$PYTHONPATH:$VIRTUAL_ENV/lib/python3.10/site-packages
From this issue I understand that this isn't really functionallity in uv's wheelhouse, but I'm wondering if there's a reasonable way in uv to create some sort of hook that, after sourcing .venv/bin/activate, will add anything added by that venv to the PYTHONPATH? (Bonus points if this would also work for something installed via uv pip install -e ... because that doesn't place the editable package in the site-packages directory (for obvious reasons)).
I see that for something like uv run ... the --env-file argument could work, but, because of the constraints of my project, I'm using uv only for the virtual environment management, not for actually running anything.
Or, possibly, if there is any other wisdom or best-practices to dynamically set my PYTHONPATH with uv.
Question
Hello,
I'm working with ROS 2 Humble, largely in Python. I'm managing an environment for a few users, and I've chosen
uv
as our scheme for managing virtual environments.ROS 2 can respect Python virtual environments, but it relies on whatever is set in PYTHONPATH for those. At the moment, I am having to manually set it as such:
export PYTHONPATH=$PYTHONPATH:$VIRTUAL_ENV/lib/python3.10/site-packages
From this issue I understand that this isn't really functionallity in
uv
's wheelhouse, but I'm wondering if there's a reasonable way inuv
to create some sort of hook that, after sourcing.venv/bin/activate
, will add anything added by that venv to the PYTHONPATH? (Bonus points if this would also work for something installed viauv pip install -e ...
because that doesn't place the editable package in the site-packages directory (for obvious reasons)).I see that for something like
uv run ...
the--env-file
argument could work, but, because of the constraints of my project, I'm usinguv
only for the virtual environment management, not for actually running anything.Or, possibly, if there is any other wisdom or best-practices to dynamically set my PYTHONPATH with
uv
.Thanks!
Platform
Ubuntu 22.04.5 LTS x86_64
Version
uv 0.5.24 (42fae92 2025-01-23)
The text was updated successfully, but these errors were encountered: