Skip to content

Conversation

@jamesmurdza
Copy link
Contributor

@jamesmurdza jamesmurdza commented Oct 10, 2025

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:

uv run python examples/agent_examples.py

(To test that this works, run rm -rf .venv first.)

When you run this:

  1. uv runs uv sync. A virtual environment is created if necessary, and packages are installed from uv.lock.
  2. The script is run in the new virtual environment

You can also run uv sync to create the virtual environment manually, to use it in VS Code for example.

Changes:

  • Migrates pyproject and the corresponding lock file to use uv
  • Removes build shell scripts, as they are not needed given uv’s built-in functionality.
  • Removes the script to automatically install uv—which saves the user a minor amount of time but brings extra complexity.
  • Upgrades the project to Python 3.13
  • Fixes a dependency conflict with transformers
  • Removes pylume from the pyproject
  • Sets defaultInterpreterPath to .venv in VS Code
  • Updates the Development guide to reflect the switch to uv

@jamesmurdza jamesmurdza changed the title Chore/refactor build uv script Use uv for dependency management and simplify build script Oct 10, 2025
@jamesmurdza jamesmurdza self-assigned this Oct 10, 2025

# Create virtual environment using UV
print_step "Creating virtual environment with UV..."
find . -type d -name ".venv" -exec rm -rf {} + 2>/dev/null || true
Copy link
Contributor

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

Copy link
Contributor

@r33drichards r33drichards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

# 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
Copy link
Contributor

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

Copy link
Contributor Author

@jamesmurdza jamesmurdza Oct 10, 2025

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?

@jamesmurdza jamesmurdza force-pushed the chore/refactor-build-uv-script branch from d65d583 to 47f0aff Compare October 20, 2025 14:25
@jamesmurdza jamesmurdza changed the title Use uv for dependency management and simplify build script Switch to uv for package management Oct 20, 2025
@jamesmurdza jamesmurdza force-pushed the chore/refactor-build-uv-script branch from 47f0aff to c9aa66c Compare October 20, 2025 14:35
@jamesmurdza
Copy link
Contributor Author

@r33drichards My initial solution actually did not work. I have recreated the setup using the uv documentation and a much simpler approach.

@jamesmurdza jamesmurdza marked this pull request as ready for review October 20, 2025 14:36
Copy link
Contributor

@ddupont808 ddupont808 left a 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

@jamesmurdza
Copy link
Contributor Author

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.

@jamesmurdza jamesmurdza merged commit 3666756 into main Oct 20, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants