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

Use a relative path for ruff executable in the configuration file #343

Open
clement-escolano opened this issue Dec 26, 2023 · 6 comments
Open
Labels
enhancement New feature or request

Comments

@clement-escolano
Copy link

Is your feature request related to a problem? Please describe.
In the project I am currently working on, we all use PyCharm and share some of the IDE configurations (stored in the .idea folder). We would like to share the configuration of the Ruff plugin but this is not possible currently as not all developers installed Python in the same way and the path of ruff executable is not the same for everyone and this path is written in the ruff.xml configuration file.

Describe the solution you'd like
A way to share the ruff.xml file with people that don't have the same path to ruff. Some ideas (I don't know if there are feasible):

  • store the path with a variable to the current Python path (the path would look like $PYTHONHOME/bin/ruff)
  • only store the path in the file if it is in a non-default place
  • have an option to store the path in the Ruff plugin

Describe alternatives you've considered
Not having the path in the file works (the plugin auto-detects it probably) but from time to time (mostly when opening the Ruff plugin in the settings modal), the ruff.xml file is modified to add the path which makes it cumbersome to the other people.

Additional context
None

@koxudaxi
Copy link
Owner

@clement-escolano
I'm sorry for my late reply.
Thank you for your creating the issue.
OK, I will check your suggestion to see whether I can implement it.

@koxudaxi koxudaxi added the enhancement New feature or request label Jan 12, 2024
@KotlinIsland
Copy link
Contributor

This is a very important issue that needs addressing. I am willing to implement a fix. Could you point me in the right direction?

@koxudaxi
Copy link
Owner

@KotlinIsland
I'm sorry. I haven't looked into it yet, I will investigate this weekend.

@KotlinIsland
Copy link
Contributor

@koxudaxi This field isn't editable (#379), Can we just not save it to the XML file?

@koxudaxi
Copy link
Owner

@KotlinIsland
detectRuffExecutable writes the python path in the xml file by using RuffConfigService.
I can see the path in the xml.

fun detectRuffExecutable(project: Project, ruffConfigService: RuffConfigService, lsp: Boolean): File? {

@State(name = "RuffConfigService", storages = [Storage("ruff.xml")])

image

image

@KotlinIsland
Copy link
Contributor

I would recommend against using $PROJECT_DIR$ and instead use $PyInterpreterDirectory$, it would be highly unlikely that a project would include an exe for ruff outside the venv, and some venvs are not within the project dir (poetry)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants