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

Read user configuration from ~/.config/ruff/ruff.toml on macOS #11115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Apr 23, 2024

Summary

This PR moves Ruff's user-specific configuration from ~/Library/Application Support/ruff/ruff.toml to ~/.config/ruff/ruff.toml.

Many other tools do this. On my machine alone: dagger, zed, gatsby, gh, wandb, etc.

I also polled Twitter and it won in a landslide:

Screenshot 2024-04-23 at 4 07 19 PM

Let's ship this in v0.5.0, along with a deprecation warning (so we'll continue to respect ~/Library/Application Support/ruff/ruff.toml, but log a warning).

Closes #10739.

Test Plan

  • Created a file with an unused import.
  • Ran cargo check foo.py.
  • Verified that the deprecated configuration was loaded and respected, with a warning:
warning: Reading configuration from `~/Library/Application Support` is deprecated. Please move your configuration to `/Users/crmarsh/.config/ruff/ruff/ruff.toml`.
[2024-04-23][16:09:10][ruff::resolve][DEBUG] Using configuration file (via cwd) at: /Users/crmarsh/Library/Application Support/ruff/ruff.toml
  • Created ~/.config/ruff/ruff.toml.
  • Verified that the new configuration was loaded:
[2024-04-23][16:10:23][ruff::resolve][DEBUG] Using configuration file (via cwd) at: /Users/crmarsh/.config/ruff/ruff.toml

@charliermarsh charliermarsh added this to the v0.5.0 milestone Apr 23, 2024
@charliermarsh charliermarsh added breaking Breaking API change configuration Related to settings and configuration and removed breaking Breaking API change labels Apr 23, 2024
@@ -34,6 +34,7 @@ crossbeam = { version = "0.8.4" }
dirs = { version = "5.0.0" }
drop_bomb = { version = "0.1.5" }
env_logger = { version = "0.11.0" }
etcetera = { version = "0.8.0" }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@konstin suggested this crate, and it does what we want across Windows and Linux / macOS, but open to other suggestions.

@@ -34,6 +34,7 @@ crossbeam = { version = "0.8.4" }
dirs = { version = "5.0.0" }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove dirs in a future release, but it stays around for now for backwards compatibility.

Copy link

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@MichaReiser
Copy link
Member

MichaReiser commented Apr 24, 2024

Sooo, we're doing twitter driven development now 😂

@konstin
Copy link
Member

konstin commented Apr 24, 2024

I would change the reasoning/description: Follow the XDG specification on all Unix platforms. Ruff will now use the XDG config directory to read user-level configuration (default: ~/.config/ruff/ruff.toml) over Library/Application Support/ruff/ruff.toml on macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Related to settings and configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Global Config Discovery: use $XDG_CONFIG_HOME on macOS
3 participants