Skip to content

Add configurable flake8 executable #821

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

Merged

Conversation

ruhulio
Copy link
Contributor

@ruhulio ruhulio commented Jun 20, 2020

The context for this change:

  • I'm using virtural envs with different versions of Python so each of them has their own install of pyls and dependencies.

  • I'm using Sublime Text with Sublime LSP configured to use the pyls from the project's virtual env.

    Example configuration
    {
      "settings": {
        "LSP": {
          "pyls": {
            "enabled": true,
            "command": [
              "/virtualenvs/important-project/bin/pyls"
            ],
            "settings": {
              "pyls": {
                "plugins": {
                  "flake8": {
                    "enabled": true,
                    "config": "/work/code/important-project/.flake8"
                  }
                }
              }
            }
          }
        }
      }
    }

Within that context, the flake8_lint plugin tries to start flake8 via a process; either directly or as a module. In both cases, this happens outside of the virtual env so it does not pick up the correct flake8 executable or module.

This change allows for adding an optional explicit executable configuration for flake8 that can point directly to the virtual env's installed version.

This change should be backwards compatible as it defaults to the previous behavior when there is no executable provided in the configuration.

The other plugin's do not have a similar issue as they do not use a separate process.

@palantirtech
Copy link
Member

Thanks for your interest in palantir/python-language-server, @ruhulio! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@ccordoba12 ccordoba12 added this to the 0.33.4 milestone Jun 30, 2020
Copy link
Contributor

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @ruhulio!

@ccordoba12 ccordoba12 merged commit 5fa7ae9 into palantir:develop Jun 30, 2020
@ruhulio ruhulio deleted the ruhul/configurable-flake8-executable branch June 30, 2020 22:34
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.

3 participants