Update installed dependencies in an environment #594
-
Is there a way to update or install new dependencies in an environment without blowing it away and reinstalling everything from scratch? If I run Unless I've missed something, could there be a |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 17 replies
-
No update, but they are guaranteed to be in sync https://hatch.pypa.io/dev/environment/#dependencies |
Beta Was this translation helpful? Give feedback.
-
@ofek Probably, but it would be convenient to add a command for syncing. A typical use case is adding a dependency to a virtual environment used by the user's IDE. To have the dependencies installed, the user could sync the packages using |
Beta Was this translation helpful? Give feedback.
-
Being in sync doesn't mean automatically updating to the latest version though, or does it? E.g. if I depend on This is unfortunate, because to make sure I test my code against the latest versions of the dependencies, I always need to recreate the environments. Or am I missing something? |
Beta Was this translation helpful? Give feedback.
-
Is there a way to force hatch to update environment dependencies (not project dependencies)? We constantly run in the issue that our CI uses a newer The dependency declaration is the default-generated |
Beta Was this translation helpful? Give feedback.
-
On this page:
[tool.hatch.envs.hatch-static-analysis]
dependencies = ["ruff==X.Y.Z"] ...so I added : [tool.hatch.envs.hatch-static-analysis]
dependencies = ["ruff>=0.4.2"] Then I found the hidden static analysis env for my checked out repo called "myproj" $ ls -l /home/vscode/.local/share/hatch/env/.internal/hatch-static-analysis/
drwxr-xr-x 3 vscode vscode 4096 Apr 30 15:38 myproj
$ ls -l /home/vscode/.local/share/hatch/env/.internal/hatch-static-analysis/myproj
drwxr-xr-x 3 vscode vscode 4096 Apr 30 15:48 REtfwipp
$ ls -l /home/vscode/.local/share/hatch/env/.internal/hatch-static-analysis/hgraph/REtfwipp/
drwxr-xr-x 4 vscode vscode 4096 Apr 30 15:48 hatch-static-analysis and then confirmed the version of $ ls -l /home/vscode/.local/share/hatch/env/.internal/hatch-static-analysis/myproj/REtfwipp/hatch-static-analysis/lib/python3.11/site-packages
[...others..]
drwxr-xr-x 3 vscode vscode 4096 Apr 30 15:48 ruff
drwxr-xr-x 3 vscode vscode 4096 Apr 30 15:48 ruff-0.1.8.dist-info So by default [tool.hatch.envs.hatch-static-analysis]
dependencies = ["ruff>=0.4.2"] ...but that's not how it worked - I still see $ ls -l /home/vscode/.local/share/hatch/env/.internal/hatch-static-analysis/hgraph/REtfwipp/hatch-static-analysis/lib/python3.11/site-packages
[...other files...]
drwxr-xr-x 3 vscode vscode 4096 Apr 30 16:01 ruff
drwxr-xr-x 3 vscode vscode 4096 Apr 30 16:01 ruff-0.1.8.dist-info So there doesn't appear to be a way to upgrade |
Beta Was this translation helpful? Give feedback.
No update, but they are guaranteed to be in sync https://hatch.pypa.io/dev/environment/#dependencies