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

Python .tool versions #3820

Merged
merged 2 commits into from
Jul 17, 2021
Merged

Conversation

foobarbyte
Copy link
Contributor

This pull request adds .tool_versions to the list of config files used when determining the project root directory for python projects. Both the actual files checked and the corresponding documentation have been updated.

Rationale:

A minimal python project may only be specifying a python version using a version management tool like asdf-vm, without providing other common python project configuration files. asdf-vm in particular creates a single .tool_versions file in the managed directory.

Currently, if .tool_versions is the only project config file, and any of the currently supported config files exist in a parent directory (eg: a global .pylintrc in the user's home directory), then ale will run the selected linters from that parent directory instead of the project directory. This can result in using a completely different version of python than that being used by vim itself.

By checking for .tool_versions in addition to other common python config files we ensure that python linters (whose behaviour typically depends on a particular python version) will run with the same version of python used by the project. This will also be the same python version used by vim itself when it is run from inside the project's directories.

A minimal python project may only be specifying a python version using a version management tool like asdf-vm, without providing other common python project configuration files. asdf-vm creates a single .tool_versions file in the managed directory. By checking for .tool_versions in addition to other common python config files we ensure that python linters (whose behaviour typically depends on a particular python version) will run with the same version of python used by the project. This will also be the same python version used by vim itself when it is run from inside the project's directories.
This reflects the corresponding change to autoload/ale/python.vim
Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

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

Seems reasonable. Thanks.

@hsanson hsanson merged commit 1893abd into dense-analysis:master Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants