Skip to content

build(test-checkin-in-trace-id): Migrate to uv and pyproject.toml#9

Merged
ericapisani merged 3 commits into
mainfrom
PY-2437-test-checkin-in-trace-id
May 21, 2026
Merged

build(test-checkin-in-trace-id): Migrate to uv and pyproject.toml#9
ericapisani merged 3 commits into
mainfrom
PY-2437-test-checkin-in-trace-id

Conversation

@ericapisani

Copy link
Copy Markdown
Member

Summary

  • Replace pip/requirements.txt with uv/pyproject.toml for dependency management
  • Update run.sh and run-celery.sh to use uv run instead of manual venv creation and pip install
  • Remove legacy requirements.txt

Refs PY-2437

Test plan

  • Verify pyproject.toml includes all dependencies from the original requirements.txt
  • Verify run.sh and run-celery.sh use uv run
  • Verify requirements.txt is removed

🤖 Generated with Claude Code

Replace pip/requirements.txt with uv/pyproject.toml for dependency
management. Update run.sh and run-celery.sh to use uv instead of
manual venv creation and pip install.

Refs PY-2437
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear-code

linear-code Bot commented May 21, 2026

Copy link
Copy Markdown

PY-2437

Comment on lines +4 to +8
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

source .venv/bin/activate

pip install -r requirements.txt

python main.py No newline at end of file
uv run python main.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The script installs uv in a subshell, but the PATH is not updated for the current session, causing the subsequent uv run command to fail.
Severity: HIGH

Suggested Fix

After installing uv, update the PATH for the current shell session before calling uv. For example, you can add export PATH="$HOME/.cargo/bin:$PATH" or source the relevant profile file.

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: test-checkin-in-trace-id/run.sh#L4-L8

Potential issue: The script checks if `uv` is installed and, if not, downloads and runs
the installer using `curl ... | sh`. This executes the installer in a subshell, which
cannot modify the parent shell's environment. Consequently, any updates the installer
makes to the `PATH` variable are lost when the subshell exits. The immediate next line,
which attempts to execute `uv run ...`, will fail with a 'command not found' error
because the `uv` executable's location has not been added to the current shell's `PATH`.
This will cause the script to exit due to `set -e`.

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

…ion in scripts

Create .venv with uv venv if missing, activate it, and install deps
with uv pip install -e . before running the app commands.

Refs PY-2437
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 30f59ea. Configure here.

Comment thread test-checkin-in-trace-id/run.sh Outdated
Comment on lines +4 to +14
requires-python = ">=3.12"

dependencies = [
"celery[redis]>=5.4.0",
"ipdb>=0.13.13",
"requests>=2.32.3",
"sentry-sdk[celery]",
]

[tool.uv.sources]
sentry-sdk = { path = "../../sentry-python", editable = true }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The test setup uses uv pip install -e . which will fail due to a missing [build-system] and would ignore local dependency paths in [tool.uv.sources].
Severity: HIGH

Suggested Fix

Replace uv pip install -e . in run.sh and run-celery.sh with uv sync. This command correctly respects the [tool.uv.sources] configuration to use the local SDK path. Additionally, add a [build-system] table (e.g., for setuptools) to pyproject.toml to make the project installable.

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: test-checkin-in-trace-id/pyproject.toml#L1-L14

Potential issue: The test setup scripts `run.sh` and `run-celery.sh` use `uv pip install
-e .` to install the test project. This command will fail for two reasons. First, the
`pyproject.toml` file lacks a `[build-system]` table, which is required for an editable
installation, causing the installation to crash. Second, even if a build system were
present, `uv pip install` ignores the `[tool.uv.sources]` configuration. This means it
would install the `sentry-sdk` dependency from PyPI instead of the specified local
development path, defeating the purpose of testing local code changes.

Comment on lines +4 to +6
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The script installs uv in a subshell, but the parent script's PATH is not updated, causing the subsequent uv run command to fail.
Severity: MEDIUM

Suggested Fix

After the installation line curl -LsSf https://astral.sh/uv/install.sh | sh, source the appropriate environment file to update the PATH in the current shell session. For example, add a line like source "$HOME/.cargo/env" or export PATH="$HOME/.local/bin:$PATH", depending on where the uv installation script places the executable.

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: test-checkin-in-trace-id/run-celery.sh#L4-L6

Potential issue: The script attempts to install `uv` if it is not found by piping a curl
command to `sh`. This installation process runs in a subshell and cannot modify the
`PATH` environment variable of the parent script. As a result, when the script later
tries to execute `uv run celery ...`, the `uv` command will not be found in the
unchanged `PATH`, leading to a 'command not found' error. This will cause the script to
fail in any environment where `uv` was not already installed and available in the
`PATH`.

@ericapisani ericapisani merged commit 4a46445 into main May 21, 2026
11 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.

1 participant