-
Notifications
You must be signed in to change notification settings - Fork 0
fix(scripts): add uv lock refresh to version update script #50
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
The update_version.py script now runs `uv lock` after updating the version in __init__.py. This ensures that uv.lock stays in sync when pyproject.toml version changes, preventing potential lockfile inconsistencies after release-please updates. Changes: - Import subprocess module for running shell commands - Add `uv lock` execution at the end of main() - Update docstring to reflect the additional responsibility
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.
1 issue found across 1 file
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="scripts/update_version.py">
<violation number="1" location="scripts/update_version.py:42">
P2: Missing error handling for subprocess call. Per project standards in `.cursor/rules/uv-scripts.mdc`, external calls should use try/except blocks with meaningful error messages and appropriate exit codes. If `uv` is not installed or the command fails, users will see an unhelpful traceback.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
|
|
||
| # Update uv.lock to reflect version change in pyproject.toml | ||
| print("Updating uv.lock...") | ||
| subprocess.run(["uv", "lock"], check=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.
P2: Missing error handling for subprocess call. Per project standards in .cursor/rules/uv-scripts.mdc, external calls should use try/except blocks with meaningful error messages and appropriate exit codes. If uv is not installed or the command fails, users will see an unhelpful traceback.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/update_version.py, line 42:
<comment>Missing error handling for subprocess call. Per project standards in `.cursor/rules/uv-scripts.mdc`, external calls should use try/except blocks with meaningful error messages and appropriate exit codes. If `uv` is not installed or the command fails, users will see an unhelpful traceback.</comment>
<file context>
@@ -36,6 +37,11 @@ def main() -> None:
+ # Update uv.lock to reflect version change in pyproject.toml
+ print("Updating uv.lock...")
+ subprocess.run(["uv", "lock"], check=True)
+ print("uv.lock updated successfully")
+
</file context>
| subprocess.run(["uv", "lock"], check=True) | |
| try: | |
| subprocess.run(["uv", "lock"], check=True) | |
| except FileNotFoundError: | |
| print("Error: 'uv' command not found. Please install uv first.") | |
| raise SystemExit(1) | |
| except subprocess.CalledProcessError as e: | |
| print(f"Error: 'uv lock' failed with exit code {e.returncode}") | |
| raise SystemExit(1) |
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.
Pull request overview
This PR adds automatic lockfile refresh to the version update script to keep uv.lock synchronized when release-please updates the package version in pyproject.toml. Since the project has a self-reference to stackone-ai in its dev dependencies, version changes require a lockfile update.
Key changes:
- Imported
subprocessmodule to enable shell command execution - Added
uv lockcommand execution after version sync to__init__.py - Updated docstring to reflect the expanded responsibility
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Update uv.lock to reflect version change in pyproject.toml | ||
| print("Updating uv.lock...") | ||
| subprocess.run(["uv", "lock"], check=True) | ||
| print("uv.lock updated successfully") |
Copilot
AI
Dec 18, 2025
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.
The lockfile update in this script will not be committed back to the repository. The release workflow runs this script after a release is created, updates the lockfile, builds and publishes, but never commits the updated uv.lock. This means the repository will have an out-of-sync lockfile.
Consider one of these approaches:
- Run
uv lockas part of the release-please PR (before merging), not after the release - Add a git commit and push step in the workflow after running this script
- Use a GitHub Action that can amend the release commit or create a follow-up commit
The current implementation will cause the published package to be built with one lockfile while the repository contains a different one, leading to reproducibility issues.
| subprocess.run(["uv", "lock"], check=True) | ||
| print("uv.lock updated successfully") |
Copilot
AI
Dec 18, 2025
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.
While check=True will raise CalledProcessError on failure (which is good), consider adding explicit error handling with a try-except block to provide a more informative error message if the uv lock command fails. This would help diagnose issues such as uv not being installed or lockfile conflicts.
For example, catching CalledProcessError and printing the stderr output would make debugging easier in CI environments.
| subprocess.run(["uv", "lock"], check=True) | |
| print("uv.lock updated successfully") | |
| try: | |
| result = subprocess.run( | |
| ["uv", "lock"], | |
| check=True, | |
| capture_output=True, | |
| text=True, | |
| ) | |
| except FileNotFoundError as e: | |
| print("Error: 'uv' command not found. Make sure 'uv' is installed and on your PATH.") | |
| raise | |
| except subprocess.CalledProcessError as e: | |
| print("Error: 'uv lock' command failed.") | |
| if e.stderr: | |
| print("stderr from 'uv lock':") | |
| print(e.stderr) | |
| raise | |
| else: | |
| if result.stderr: | |
| # Optionally surface non-fatal warnings from uv | |
| print("Warnings from 'uv lock':") | |
| print(result.stderr) | |
| print("uv.lock updated successfully") |
glebedel
left a comment
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
Summary
Adds
uv lockexecution to the version update script to ensure the lockfile stays in sync after release-please updates pyproject.toml.What Changed
subprocessimport to run shell commandsuv lockexecution at the end ofmain()Why
Previously, when release-please updated the version in
pyproject.toml, theupdate_version.pyscript would only sync the version to__init__.py. This leftuv.lockpotentially out of sync with the new version, which could cause inconsistencies. Now the lockfile is automatically refreshed as part of the version update process.Summary by cubic
Refreshes uv.lock during version bumps by running uv lock in the update_version.py script. Prevents lockfile drift after release-please updates pyproject.toml.
Written for commit d1060d8. Summary will update automatically on new commits.