Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export VIRTUAL_ENV=".venv"
layout python3
export VIRTUAL_ENV="${PWD}/.venv"
devenv sync
PATH_add "${PWD}/.venv/bin"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ spring-server.txt
spy.log
.kotlin
**/tomcat.8080/webapps/
**/__pycache__
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13.3
16 changes: 16 additions & 0 deletions devenv/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[devenv]
minimum_version = 1.22.1

[uv]
darwin_arm64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-aarch64-apple-darwin.tar.gz
darwin_arm64_sha256 = 954d24634d5f37fa26c7af75eb79893d11623fc81b4de4b82d60d1ade4bfca22
darwin_x86_64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-x86_64-apple-darwin.tar.gz
darwin_x86_64_sha256 = ae755df53c8c2c1f3dfbee6e3d2e00be0dfbc9c9b4bdffdb040b96f43678b7ce
linux_arm64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-aarch64-unknown-linux-gnu.tar.gz
linux_arm64_sha256 = 27da35ef54e9131c2e305de67dd59a07c19257882c6b1f3cf4d8d5fbb8eaf4ca
linux_x86_64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-x86_64-unknown-linux-gnu.tar.gz
linux_x86_64_sha256 = 6dcb28a541868a455aefb2e8d4a1283dd6bf888605a2db710f0530cec888b0ad
# used for autoupdate
# NOTE: if using uv-build as a build backend, you'll have to make sure the versions match
version = 0.8.2

23 changes: 23 additions & 0 deletions devenv/sync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from devenv import constants
from devenv.lib import config, proc, uv
import os

def main(context: dict[str, str]) -> int:
reporoot = context["reporoot"]
cfg = config.get_repo(reporoot)

uv.install(
cfg["uv"]["version"],
cfg["uv"][constants.SYSTEM_MACHINE],
cfg["uv"][f"{constants.SYSTEM_MACHINE}_sha256"],
reporoot,
)

# reporoot/.venv is the default venv location
print(f"syncing .venv ...")
if not os.path.exists(".venv"):
proc.run(("uv", "venv", "--seed"))
proc.run(("uv", "sync", "--frozen", "--quiet"))
Comment on lines +18 to +20
Copy link

Choose a reason for hiding this comment

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

Bug: The script assumes it's running from the repository root when creating the .venv, but it can be invoked from other directories, causing environment setup to fail.
Severity: CRITICAL

Suggested Fix

Before line 18, change the current directory to the repository root using os.chdir(reporoot). Alternatively, modify the subsequent proc.run calls to use absolute paths for the virtual environment and specify the correct working directory, for example: proc.run(..., cwd=reporoot).

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: devenv/sync.py#L18-L20

Potential issue: The script `devenv/sync.py` exhibits inconsistent handling of the
working directory. While an initial `uv.install()` call correctly uses the `reporoot`
context variable, subsequent operations to create and sync the virtual environment on
lines 18-20 use the relative path `.venv` without ensuring the current working directory
is the repository root. If `devenv sync` is invoked from any directory other than the
repository root, it will create the `.venv` in the wrong location, leading to a broken
development environment.

Did we get this right? 👍 / 👎 to inform future reviews.


return 0

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[project]
name = "javasdk"
version = "0.0.0"
Copy link

Choose a reason for hiding this comment

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

Missing dependencies in pyproject.toml breaks local development

Medium Severity

The pyproject.toml has no dependencies field, and uv.lock only contains the virtual package. However, requirements.txt lists dependencies like requests that are imported by test/system-test-runner.py. When developers use the new devenv setup (uv sync --frozen), the venv is created without these dependencies, causing ImportError when running the test scripts locally.

Additional Locations (1)

Fix in Cursor Fix in Web

8 changes: 8 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading