Sync requirements.txt with pyproject.toml runtime deps - #1085
Merged
Conversation
requirements.txt was missing pydantic, pyyaml, and numpy, which are all declared runtime dependencies in pyproject.toml. pip install uses pyproject.toml so most users were unaffected, but anyone installing via 'pip install -r requirements.txt' (dev/CI setups) would hit 'ModuleNotFoundError: No module named pydantic' at runtime. pydantic underpins the JSON output schema (scalene_json.py) and the LineNumber type in scalene_statistics.py, so it is a hard dependency.
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.
Problem
A user hit
ModuleNotFoundError: No module named 'pydantic'when running Scalene.requirements.txtis missing three runtime dependencies that are declared inpyproject.toml:pydantic>=2.6pyyaml>=6.0numpy(version-gated on Python version)pip install scaleneusespyproject.toml, so most users are unaffected. But anyone installing viapip install -r requirements.txt(dev setups, some CI, some downstream packagers) gets an incomplete environment and hits the error at runtime.Why these are hard dependencies
pydantic— the entire JSON output schema is built from pydanticBaseModelclasses (scalene_json.py), and theLineNumbertype is defined asNewType("LineNumber", PositiveInt)inscalene_statistics.py.pyyaml— used for YAML config file loading.numpy— used throughout profiling.Change
Add the three missing deps to
requirements.txt, mirroring the version specifiers (including the Python-version-gated numpy markers) frompyproject.toml.Verified
pip install --dry-run -r requirements.txtresolves cleanly.