-
-
Notifications
You must be signed in to change notification settings - Fork 637
Switch to uv for package management #460
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
Conversation
scripts/build-uv.sh
Outdated
|
|
||
| # Create virtual environment using UV | ||
| print_step "Creating virtual environment with UV..." | ||
| find . -type d -name ".venv" -exec rm -rf {} + 2>/dev/null || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this might be redundant step if uv venv .venv --python 3.12 is idempotent, might also make sense to just rm -rf .venv before too if it it might exist to make the test more reproducible and not get bugs due to existing state vs desired state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
scripts/build-uv.sh
Outdated
| # Create a .env file for VS Code to use the virtual environment | ||
| print_step "Creating .env file for VS Code..." | ||
| echo "PYTHONPATH=${PROJECT_ROOT}/libs/python/core:${PROJECT_ROOT}/libs/python/computer:${PROJECT_ROOT}/libs/python/agent:${PROJECT_ROOT}/libs/python/som:${PROJECT_ROOT}/libs/python/pylume:${PROJECT_ROOT}/libs/python/computer-server:${PROJECT_ROOT}/libs/python/mcp-server" > .env | ||
| echo "PYTHONPATH=${VIRTUAL_ENV}/lib/python${PYTHON_VERSION}/site-packages" > .env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this overwrites .env, which could be nasty if i have something there i want to keep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! We already have this line: https://github.com/trycua/cua/blob/main/.vscode/py.code-workspace#L58C1-L59C1
So I'm thinking that should be enough for VS Code to locate packages?
d65d583 to
47f0aff
Compare
47f0aff to
c9aa66c
Compare
|
@r33drichards My initial solution actually did not work. I have recreated the setup using the uv documentation and a much simpler approach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently the ./Dockerfile file still uses the old build.sh. this Dockerfile is used by the ./.devcontainer and the ./scripts/run-docker-dev.sh setups. we should replace those with a uv sync or deprecate the containerized development mode
That's a good point. I’d support deprecating the devcontainer, with the option to recreate it quickly if a user requests it of course. |
This PR changes our monorepo setup to use uv.
This removes the existing build scripts which led to dependency issues due to sequential installation of Cua packages.
Usage
This setup requires no build scripts. You can just run:
(To test that this works, run
rm -rf .venvfirst.)When you run this:
uv sync. A virtual environment is created if necessary, and packages are installed fromuv.lock.You can also run
uv syncto create the virtual environment manually, to use it in VS Code for example.Changes:
pylumefrom the pyprojectdefaultInterpreterPathto.venvin VS Code