Skip to content

Add option to reinstall project before running - #2447

Open
medioalanum wants to merge 1 commit into
pypa:masterfrom
medioalanum:issue-2138-fresh-environment
Open

medioalanum wants to merge 1 commit into
pypa:masterfrom
medioalanum:issue-2138-fresh-environment

Conversation

@medioalanum

Copy link
Copy Markdown

Closes #2138

Summary

Add a --reinstall option to hatch run and hatch env run for existing non-editable environments. The option reinstalls the project wheel before running the command without deleting or recreating the virtual environment.

Implementation

  • Propagates --reinstall through the run command flow.
  • Reinstalls only when the environment already existed, dev-mode = false, and skip-install = false.
  • Adds a regression test covering source changes between two runs.

This is an initial interpretation of the use case discussed in #2138 and the feedback on PR #2356. I would appreciate maintainer feedback on the option name, placement, and whether dependency synchronization or build-hook handling should be adjusted.

Testing

  • Targeted regression test passes with the build dependencies available.
  • CLI help test passes.
  • Full tests/cli/run/test_run.py run: 45 passed, 2 skipped, 3 environment-dependent failures.

AI disclosure

This change was developed with assistance from OpenAI Codex. I reviewed and understand the implementation and tests.

@medioalanum
medioalanum marked this pull request as ready for review October 8, 2026 15:48

This branch has not been deployed

No deployments
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.

Add flag for fresh Environment

1 participant