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

added function to find project root #66

Closed

Conversation

christopherpickering
Copy link

This is intended to address #57. It correctly finds the project root, but somehow pylint is still not using the settings from pyproject.toml....

@kaste do you have any ideas what is up?

Normally I have to add a init.py file to my project root, but in this case where we are linting one file, the pylint docs say this "should" work: https://pylint.pycqa.org/en/latest/user_guide/usage/run.html

@kaste
Copy link
Contributor

kaste commented Oct 14, 2022

Hm. I don't see that directly in their docs. What's the passage I should read?

Btw there is no pathlib generally available - we're running on Python 3.3 😋 - you have that installed from somewhere, somehow.

But you also checked that the working dir follows and is correct after your patch? A typical pylint complication is that we provide files (paths) to it but it really wants the dotted package.module thing so that could be in play here. See #52

@christopherpickering
Copy link
Author

Hey thanks :)
Here's the docs I was referring too:
image

Oh shucks, I wonder why it was running w/ path lib then? lol
It was setting the project_dir correctly. I'll switch to os.path and see what happens.

@christopherpickering
Copy link
Author

@kaste the var self.context["project_root"] is set correctly, but how do I verify sublimelinter is using it?

I just added a print(self.context["project_root"]) after setting it, but thats not a good way to check it..

@christopherpickering
Copy link
Author

Here's the console output from the linter. Should I be setting working_dir instead of project_root?
image

@christopherpickering
Copy link
Author

feeling dumb.... I had a settings override for the pylint working_dir "working_dir": "${file_path}". I removed that and it works!

It is using my root pyproject now. Thanks :)

kaste added a commit to SublimeLinter/SublimeLinter that referenced this pull request Feb 7, 2023
Fixes #1883
Fixes SublimeLinter/SublimeLinter-pylint#57
Closes SublimeLinter/SublimeLinter-mypy#53
Closes SublimeLinter/SublimeLinter-pylint#66
Ref #1890

- Detect the typical name "venv" as a virtual environment candidate
- Search for typical files/names and set `project_root` accordingly.
  This will in turn affect the `working_dir` we use unless overridden
  by the user.
kaste added a commit to SublimeLinter/SublimeLinter that referenced this pull request Feb 7, 2023
Fixes #1883
Fixes SublimeLinter/SublimeLinter-pylint#57
Closes SublimeLinter/SublimeLinter-mypy#53
Closes SublimeLinter/SublimeLinter-pylint#66
Ref #1890

- Detect the typical name "venv" as a virtual environment candidate
- Search for typical files/names and set `project_root` accordingly.
  This will in turn affect the `working_dir` we use unless overridden
  by the user.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants