Skip to content

Sync requirements.txt with pyproject.toml runtime deps - #1085

Merged
emeryberger merged 3 commits into
masterfrom
fix/requirements-sync-pydantic
Jul 5, 2026
Merged

Sync requirements.txt with pyproject.toml runtime deps#1085
emeryberger merged 3 commits into
masterfrom
fix/requirements-sync-pydantic

Conversation

@emeryberger

Copy link
Copy Markdown
Member

Problem

A user hit ModuleNotFoundError: No module named 'pydantic' when running Scalene. requirements.txt is missing three runtime dependencies that are declared in pyproject.toml:

  • pydantic>=2.6
  • pyyaml>=6.0
  • numpy (version-gated on Python version)

pip install scalene uses pyproject.toml, so most users are unaffected. But anyone installing via pip 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 pydantic BaseModel classes (scalene_json.py), and the LineNumber type is defined as NewType("LineNumber", PositiveInt) in scalene_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) from pyproject.toml.

Verified pip install --dry-run -r requirements.txt resolves cleanly.

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.
@emeryberger
emeryberger merged commit c2e9e17 into master Jul 5, 2026
41 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.

1 participant