Add caching and don't clear environments all the time#134
Merged
Conversation
This prevents users from using binaries, etc., that are already installed on the environment.
Need to add envs after we clear_env!
konstantinoscs
approved these changes
Nov 19, 2025
Contributor
konstantinoscs
left a comment
There was a problem hiding this comment.
Generally looks ok to me
| cache_dir: Option<PathBuf>, | ||
|
|
||
| // protected_mode is a flag that indicates whether the UV instance is in protected mode. | ||
| // In protected mode, the UV instance do things like clear the environment variables before |
Contributor
There was a problem hiding this comment.
Suggested change
| // In protected mode, the UV instance do things like clear the environment variables before | |
| // In protected mode, the UV instance does things like clear the environment variables before |
| // that you don't have to create underlying directory, uv will do that automagically for us. | ||
| pub fn default_cache_dir() -> PathBuf { | ||
| let dir = dirs::data_local_dir().unwrap(); | ||
| dir.join("tower").join("cache") |
Contributor
There was a problem hiding this comment.
I wonder if this should be a hidden folder (prefixed with .)
Contributor
Author
There was a problem hiding this comment.
Typically it ends up in the .local dir in your home directory (which is way data_local_dir resolves to in this package) so it's kinda hidden.
| // cache_dir is the directory that dependencies should be cached in. | ||
| cache_dir: Option<PathBuf>, | ||
|
|
||
| // protected_mode is a flag that indicates whether the UV instance is in protected mode. |
Contributor
There was a problem hiding this comment.
Is protected mode something that comes from UV itself or our own terminology?
Contributor
Author
There was a problem hiding this comment.
It's my own fancy new term :) We'll need to iterate on this a bit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clearing the environment isolates the process too much from the host. This makes it difficult to do things like use pre-installed assets on the relevant host.