Skip to content

fix(deps): correct optional-dependency groups + clean errors for missing extras (0.6.1)#7

Open
Sahil170595 wants to merge 2 commits into
mainfrom
fix/0.6.1-deps-httpx
Open

fix(deps): correct optional-dependency groups + clean errors for missing extras (0.6.1)#7
Sahil170595 wants to merge 2 commits into
mainfrom
fix/0.6.1-deps-httpx

Conversation

@Sahil170595

Copy link
Copy Markdown
Owner

What & why

A dependency audit (AST scan of the shipped package vs the declared extras) surfaced cruft, a gap, and a UX bug where a missing extra produced a raw traceback.

Dependency corrections

Change Reason
[bench]psutil, pyyaml, structlog none imported by the shipped package (only banterhearts, which isn't packaged)
[bench] + pynvml used in bench/metrics.py for GPU env metadata (guarded) but undeclared → [bench] silently lacked it
[refit] + platformdirs used by refit's output-path resolution (was only in [bench])
[all]dev end users installing [all] were getting pytest/ruff; CI now installs .[all,dev]

Clean errors (httpx)

The serving backends import httpx at module load, so bench / measure / safety (and plan --measure) raised a raw ModuleNotFoundError traceback when [bench]/[safety] wasn't installed — violating the repo's "fail loud, no raw tracebacks" standard.

  • New require_extra() (commands/_deps.py) checks availability via importlib without importing and fails loud-and-clean with an install hint.
  • Install hints no longer have their [extra] swallowed by Rich markup (the resolver hint rendered as pip install chimeraforge, dropping [resolve]) — dynamic error text is now escaped.

Verification

Reproduced in a core-only (no-httpx) venv before/after:

Command Before After
bench / measure raw ModuleNotFoundError + traceback Error: this command needs the 'bench' extra … pip install "chimeraforge[bench]" (exit 1, 0 tracebacks)
safety raw traceback clean hint → chimeraforge[safety]
plan --model <hf-repo> hint showed pip install chimeraforge hint shows chimeraforge[resolve]
  • 486 tests pass (+3 new require_extra regressions in test_cli_fail_loud.py); lint + format clean.
  • Bumped to v0.6.1 + CHANGELOG.

Note

README/docs improvements already on main (product-first re-center, docs/archive/) plus these dep fixes only reach the PyPI page on the next release — this PR is the 0.6.1 candidate.

…ing extras (0.6.1)

Dependency audit (AST scan of the shipped package vs declared extras):
- [bench] dropped psutil, pyyaml, structlog -- none are imported by the
  packaged code (only banterhearts, which is not shipped).
- [bench] added pynvml -- it IS used (bench/metrics.py GPU env metadata,
  try/except-guarded) but was undeclared, so [bench] silently lacked it.
- [refit] added platformdirs -- used by refit's output-path resolution.
- [all] no longer pulls dev tools (pytest/ruff) onto end users; CI now
  installs .[all,dev].

Clean errors (httpx):
- The serving backends import httpx at module load, so bench/measure/safety
  (and plan --measure) raised a raw ModuleNotFoundError traceback without the
  extra. Added require_extra() (commands/_deps.py), which checks availability
  via importlib without importing and fails loud-and-clean with an install hint.
- Install hints no longer have their [extra] swallowed by Rich markup (the
  resolver hint rendered as "pip install chimeraforge", dropping [resolve]);
  dynamic error text is now escaped.

Verified in a core-only (no-httpx) env: bench/measure/safety exit 1 with clean
"install chimeraforge[bench|safety]" messages (0 tracebacks) and plan --model
<hf-repo> shows chimeraforge[resolve]. 486 tests pass; lint/format clean.
CI (clean install) caught what my stale local env hid: test_monitoring.py
exercises the banterhearts monitoring subsystem, which hard-imports psutil
(system_profiler/performance_monitor) and structlog (logging). They are
correctly out of [bench] (the shipped chimeraforge package never imports
them) but ARE test-time deps, so they belong in [dev]. pyyaml stays removed
(nothing imports it). Verified in a clean .[dev] venv: test_monitoring +
test_cli_fail_loud pass.
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