← Back to Pull requests

Install changed dependencies automatically before dev, run and test #363

Closed
unknown closed this pull request without merging on Oct 09, 2026 11:36 UTC
View on GitHub
unknown unknown commented on Oct 09, 2026 06:16 UTC
Author

Stacked on #359 (uv-managed and externally managed venvs): merge that first. This PR reuses its _python_requirements_stale, so uv projects (uv.lock, installer: "uv") and [tool.pyronaut.python] manage-dependencies = false are not reported stale after every install.

pyronaut dev, run and test now run the install step automatically when the project dependencies changed since the last pyronaut install, so editing pyproject.toml no longer needs a manual install first.

How staleness is detected (managed projects)


  • Java dependencies: after every successful install (explicit or automatic) the CLI records a SHA-256 of the [tool.pyronaut] table plus the Pyronaut version in __pyronaut__/install-state.json. Missing classpath manifests, a different table, or a Pyronaut upgrade run pyronaut install. The check reads parsed TOML, so the schema directive install prepends and edits outside [tool.pyronaut] (description, version…) do not trigger a reinstall.

  • Python dependencies: the declarations install last applied are compared with .venv/.pyronaut-requirements.json. For pip that means [project].dependencies, [dependency-groups] and requirements.txt; for uv it means uv.lock (the shared check from #359). A self-managed .venv is never stale. A Python-only change refreshes .venv without running the Java resolver.

  • Projects installed before this change have no recorded state and are trusted as they are. The first install afterwards records the state. (A timestamp fallback did not work: install itself rewrites pyproject.toml.)

  • Gradle/Maven projects are unchanged, because their build tool owns resolution and run/test already install there.
  • Output


    One line before the install renders its own progress:
    • [tool.pyronaut] settings changed since the last install; running pyronaut install before dev
    

    Dev mode


    pyproject.toml was already watched. On a dependency change the restart loop now stops the application first, then installs, processes, validates and restarts. Restarts without a dependency change keep the existing parallel stop/refresh. This follows the one-writer-per-terminal rule: the application's shutdown output and the installer's progress never interleave.

    Opt-out


    From highest to lowest precedence:
  • --no-install on a single dev/run/test invocation. The CLI strips the flag before delegating; after -- it stays an application argument.

  • PYRONAUT_AUTO_INSTALL=false (true overrides the settings file).

  • Per user, in ~/.pyronaut/settings.toml:

  •   [install]
      auto = false
      

    With auto-install off, the command still warns that dependencies are stale and names the setting that skipped the install. An invalid value fails the command with a clear message.

    Tests


  • New auto_install_test.py (23 tests, isolated from the developer's own settings and environment) covers: fresh state, changed deps, missing manifests, Pyronaut upgrade, metadata-only edits, legacy installs, --no-install (and after --), the settings/env opt-outs and their precedence and validation, uv projects and self-managed venvs not being reinstalled, Python-only changes, failed install, test, explicit install recording state, external builds, and the dev restart order process, start, stop, install, process, start.

  • Full *_test.py discovery on top of #359: 534 tests OK (CPython 3.13). auto_install_test also passes on GraalPy. No native-image builds were run.
  • Docs: a new "Automatic install" section in the CLI guide, the opt-outs documented, --no-install added to dev/run/test, and the doctor note updated.

    Fixes #142

    Diff: 457 lines (+342 / -115) across 5 files Reviewer: alvarosanchez Review duration: 319m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 457 lines diff across 5 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.367
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #363"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.5% (MEDIUM) · Higher = larger blast radius
    45.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.0% · Safe to merge
    18.0%