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

Allow RUFF_NO_CACHE environment variable (like RUFF_CACHE_DIR) #8538

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

akx
Copy link
Contributor

@akx akx commented Nov 7, 2023

Summary

Being able to set --no-cache without touching the command line makes comparing formatter speed with e.g. Hyperfine a lot easier; Black allows one to set BLACK_CACHE_DIR=/dev/null, but setting RUFF_CACHE_DIR=/dev/null has Ruff choke:

error: Failed to initialize cache at /dev/null: Not a directory (os error 20)
error: Failed to initialize cache at /dev/null: Not a directory (os error 20)
warning: Failed to open cache file '/dev/null/0.1.4/18160934645386409287': Not a directory (os error 20)

Alternately, we could make a /dev/null (or nul on Windows) cache directory imply --no-cache?

Test Plan

None yet.

@akx akx force-pushed the no-cache-envvar branch from 7f7d1b7 to 86137ed Compare November 7, 2023 12:58
Copy link
Contributor

github-actions bot commented Nov 7, 2023

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@dhruvmanila dhruvmanila added the cli Related to the command-line interface label Nov 7, 2023
@zanieb zanieb merged commit 7dabc45 into astral-sh:main Nov 7, 2023
17 checks passed
@MichaReiser
Copy link
Member

You can use --parameter-list and set e.g. CACHE to --no-cache or an empty string. That's how I did cached/uncached comparisons in the past. I'm not sure if that's more or less convenient than what you use.

I'm a bit hesitant from adding environment variables only for profiling. They are a source of confusion and introduce some complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command-line interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants