feat(doctor): make doctor diagnostic for venv drift - #13
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every time
uv syncruns (directly or viauv run's auto-sync), the GPU-coupled installs fromconstraints/serve.txtandconstraints/eval.txtget silently unwound — and the nextmake rehearsefails several seconds deep into a vLLM import with a confusing transformers/huggingface-hub error.This burned ~20 minutes during the post-merge validation pass alone.
make doctorcatches it in one second instead.What it checks
8 checks against the active venv:
constraints/serve.txtpackages installed at compatible versions (vllm + transformers)transformers ↔ huggingface-hubinvariant (transformers 4.x needs huggingface-hub <1.0)vllmexecutable on PATHconstraints/eval.txtpackages (lm-eval + transformers pin)lm-evalexecutable on PATHEach fail prints an actionable fix command, e.g.:
Usage
Implementation
scripts/doctor.py— pure Python (no shelling out), usespackaging.requirementsto parse the constraint files so the diagnostic stays in lockstep with what uv would install.tests/test_doctor.py— 17 tests covering each check type, the constraint-file parser, version mismatches, missing executables, thetransformers/huggingface-hubinvariant, and the CLI exit codes.Makefile—make doctortarget.pyproject.toml— declarepackagingas a direct dep (it was already transitive but the import is direct).Tests
127 total (17 new), 87% coverage, lint+format+mypy clean.
Test plan
make doctorexits 0 on a healthy venvmake doctorflags missing/mispinned packages with a working fix command