Skip to content

Allow runner help and tests without uv - #156

Merged
dpranke merged 2 commits into
dpranke:mainfrom
jwalith4418-Mj:fix/runner-without-uv
Nov 2, 2026
Merged

dpranke merged 2 commits into
dpranke:mainfrom
jwalith4418-Mj:fix/runner-without-uv

Conversation

@jwalith4418-Mj

Copy link
Copy Markdown
Contributor

Without uv installed, python run help and python run tests currently crash in Runner.init: self.args is still None when the uv check reads self.args.command. These commands are explicitly exempt from requiring uv.

Check the requirement after parsing arguments, avoid the automatic uv-launch path when uv is unavailable, and handle verbose output without an active virtual environment. Commands requiring uv keep the existing explanatory message and status 2.

The patch changes only run. Following the feedback on #146, no package tests or runner restructuring were added.

Executed verification:

  • Original code: actual help/tests/checks commands all fail with AttributeError when PATH is empty and UV/VIRTUAL_ENV are unset.
  • Windows/Python 3.14 after: --help/help succeed, tests and verbose tests each pass all 96 tests, and checks reports the uv requirement with status 2 and no traceback.
  • Ubuntu/Python 3.10, empty PATH: all 96 tests pass through run tests.
  • Normal development environment with uv: Ruff, pylint, mypy and formatting checks pass. Other Python versions and hosted CI have not been verified locally.

Prepared with AI assistance. The contributor confirmed reviewing and vetting this commit before upload.

Check parsed arguments before deciding whether uv is required. Avoid launching uv for commands that support running without it, and handle verbose output outside a virtual environment.

Prepared with AI assistance; contributor review is required before upload.
Comment thread run Outdated
@@ -62,9 +62,6 @@ class Runner:
sys.exit(1)

self.uv_path = shutil.which('uv')

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Just set uv_path to None here, and populate it done on line 78.

@dpranke dpranke left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looks pretty good, just one minor tweak, if that's okay.

@dpranke

dpranke commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Oops, must've broken this. Good catch. Of course, now that I've said we don't need tests for run we're going to keep finding more and more breakages there ... :).

[ Note for any future readers: I do not expect run to be bulletproof, please don't go testing it just to see what weird things you can find. Feel free to file bugs and enhancements for things that might actually be useful, though. This case definitely meets that criteria ].

Address the maintainer's review on dpranke#156. Prepared with AI assistance.

@dpranke dpranke left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looks good, thank you!

@dpranke
dpranke merged commit abd0302 into dpranke:main Nov 2, 2026
9 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.

2 participants