-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,13 +11,14 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| import re | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import subprocess | ||||||||||||||||||||||||||||||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| import tomli | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| def main() -> None: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| """Update version in __init__.py to match pyproject.toml.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| """Update version in __init__.py to match pyproject.toml and refresh uv.lock.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # Read version from pyproject.toml | ||||||||||||||||||||||||||||||||||||||||||||||||||
| pyproject_path = Path("pyproject.toml") | ||||||||||||||||||||||||||||||||||||||||||||||||||
| init_path = Path("stackone_ai/__init__.py") | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -36,6 +37,11 @@ def main() -> None: | |||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| print(f"Version in {init_path} already matches {version}") | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # 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") | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+40
to
+43
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| 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") |
Uh oh!
There was an error while loading. Please reload this page.
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. Ifuvis not installed or the command fails, users will see an unhelpful traceback.Prompt for AI agents