Skip to content

added function to find project root#66

Closed
christopherpickering wants to merge 2 commits into
SublimeLinter:masterfrom
christopherpickering:master
Closed

added function to find project root#66
christopherpickering wants to merge 2 commits into
SublimeLinter:masterfrom
christopherpickering:master

Conversation

@christopherpickering

Copy link
Copy Markdown

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

kaste commented Oct 14, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Author

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

@christopherpickering

Copy link
Copy Markdown
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