Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UV_CACHE_DIR not used for Python installation #9749

Closed
jheiselman opened this issue Dec 9, 2024 · 11 comments
Closed

UV_CACHE_DIR not used for Python installation #9749

jheiselman opened this issue Dec 9, 2024 · 11 comments
Labels
needs-decision Undecided if this should be done

Comments

@jheiselman
Copy link

On Windows, when running a uv python install while having UV_CACHE_DIR set, does not result in uv using that cache location. It instead uses the default location %APPDATA%\uv\python.cache.

uv python install should respect UV_CACHE_DIR. This is especially useful when using a DevDrive and have security tools set to either ignore or be more lenient with DevDrives.

Platform: Windows 10
uv version: 0.5.7

Debug log attached. It doesn't show it, but my UV_CACHE_DIR is set to E:\Cache\uv

uv-debug.log

@charliermarsh
Copy link
Member

@zanieb -- Should I change this?

@charliermarsh charliermarsh added the needs-decision Undecided if this should be done label Dec 9, 2024
@zanieb
Copy link
Member

zanieb commented Dec 9, 2024

We changed this in #6043 because of #6036

We don't really cache installs right now, this is just the location we download to to ensure the install is idempotent. Can you explain a bit more why this matters to you?

I would like to cache downloads anyway (per #8025) in which we'd use the UV_CACHE_DIR but then we'd also presumably need to switch to hardlinking and a copy fallback rather than renaming.

@charliermarsh
Copy link
Member

Totally forgot about that change, whoops.

@jheiselman
Copy link
Author

It matters for two reasons.

  1. As already stated, with DevDrives being a thing, cache location is becoming important for security tool configuration.
  2. As a matter of the tool acting in an intuitive manner, I assumed, and figure others might as well, that if I set the cache directory it is used for any and all caching. It is counterintuitive, to me at least, that should not be respected and caused me some troubleshooting time tracking down what I may have done wrong.

@zanieb
Copy link
Member

zanieb commented Dec 10, 2024

It's not a cache though, we are just downloading the file there and moving it into the install location. There is no persistence or caching. It's a misnomer.

@charliermarsh
Copy link
Member

Yeah it's more like a scratch directory.

@zanieb
Copy link
Member

zanieb commented Dec 10, 2024

Regardless, can you expand on

cache location is becoming important for security tool configuration

I still don't follow what precise issue you're talking about here. Why is it important? What happens?

@jheiselman
Copy link
Author

I’m not sure how familiar you are with the concept of DevDrives has Microsoft had defined them, but they are mountable volume within Windows where you would keep code caches, git repo clones, and other things that may trigger a lot of churn with enterprise security tools (AV, heuristic scanners, IDS, etc…). They are then pitching to desktop security teams to have all developers keep things isolated to these DevDrives so that they can simplify exceptions and whatnot to these locations.

Since uv downloads a copy of python, it may be a good fit to have it also use the DevDrives system. Maybe not. In either case, the confusion of having it named cache is what threw me off. If it’s not really a cache, then perhaps this issue should become about changing the name of the directory to avoid confusion.

@zanieb
Copy link
Member

zanieb commented Dec 10, 2024

Yep we're familiar with DevDrives (we use them in CI to improve the GitHub Actions perf!)

Since uv downloads a copy of python, it may be a good fit to have it also use the DevDrives system.

Makes sense, I think you want to change UV_PYTHON_INSTALL_DIR instead.

I've changed the name of the directory in #9756

@jheiselman
Copy link
Author

Excellent! Thank you. I’ll give it a try tomorrow.

zanieb added a commit that referenced this issue Dec 10, 2024
@jheiselman
Copy link
Author

This works for me. Thank you.

@zanieb zanieb closed this as completed Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-decision Undecided if this should be done
Projects
None yet
Development

No branches or pull requests

3 participants