pypa/hatch

Add flag for fresh Environment

開放

#2,138 建立於 2025年12月9日

 (3 則留言) (0 個反應) (0 位負責人)Python (240 個分叉)batch import
enhancementgood first issue

倉庫指標

星標
 (4,451 顆星)
PR 合併指標
 (平均合併 71天 21小時) (30 天內合併 10 個 PR)

描述

Description

Currently, the environment is reused between runs. What I want is a flag that uses its own fresh environment for each specific run.

Use case/motivation

dev-mode = false installs the project as non-editable whl mode, so when you do update the project code, the environment doesn't pick it up, and we need to first hatch env remove [environment-name] then run the code. If we had a flag for fresh env, that would go well with dev-mode = false

Related issues

https://github.com/pypa/hatch/issues/2134#issuecomment-3622375564 Another way to approach this problem is by checking if the project whl needs to be reinstalled (uninstalled then installed) This requires

  1. Check the src dir for changes
  2. Check BuildHook for changes
  3. Check MetadataHook for changes If yes, reinstall!

This is actually more performant than having to recreate the whole environment. But I figure it'd be harder to implement.

Thus, a clean-env flag for now would do, as it only requires making a time-based hashed env for each session.

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

貢獻者指南