Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Support %p expansion for pylint executable #62

Closed
posita opened this issue Sep 2, 2015 · 6 comments
Closed

Support %p expansion for pylint executable #62

posita opened this issue Sep 2, 2015 · 6 comments
Assignees

Comments

@posita
Copy link

posita commented Sep 2, 2015

Even with #24, it might be nice to be able to do something like this:

screen shot 2015-09-01 at 21 07 25

But right now, despite [PROJECT_DIR]/.venv/bin/pylint existing, one still gets this error:

screen shot 2015-09-01 at 21 03 23

@posita
Copy link
Author

posita commented Sep 2, 2015

It might also be nice to use the specified executable if it exists, but degrade to one found in ${PATH} if it doesn't. That would enable one to override pylint on a per project basis, but avoid errors if pylint wasn't present inside a project.

Alternately, maybe enable something like this?

[firstpathtotry]:[secondpathtotry]:...:[nthpathtotry]

Which would result in an attempt to find pylint in the following paths (in order):

  1. firstpathtotry
  2. firstpathtotry/pylint
  3. secondpathtotry
  4. secondpathtotry/pylint
  5. ...
  6. nthpathtotry
  7. nthpathtotry/pylint

When combined with %p expansion, this would allow something like:

%p/.venv/bin/pylint3:%p/.venv/bin/pylint2:%p/.venv/bin:/usr/local/bin:/usr/bin

If environment variable expansion was also available, one could do (e.g.):

${PYLINT}:${VIRTUAL_ENV}/bin:%p/.venv/bin:${PATH}

@steelbrain
Copy link
Contributor

cc @SpainTrain

@SpainTrain
Copy link
Member

it might be nice to be able to do something like this

Definitely agree.

It might also be nice to use the specified executable if it exists, but degrade to one found in ${PATH} if it doesn't.

Also agree with this. I prefer this approach to the alternative of reimplementing the priority logic of finding executables in $PATH. Plus, I suspect that one would only need to have one executable path that uses the project directory, right?

If it's reasonable, I think we will plan for %p interpolation in executable with a backup to try pylint.

@SpainTrain SpainTrain self-assigned this Sep 10, 2015
@posita
Copy link
Author

posita commented Sep 10, 2015

If it's reasonable, I think we will plan for %p interpolation in executable with a backup to try pylint [via PATH].

I think this handles all the important use cases. Even if the global pylint executable is named something weird on a particular system (e.g., pylint-2.7) a user can always do something like:

% mkdir -p "${HOME}/bin"
% ln -s "$( which pylint-2.7 )" "${HOME}/bin/pylint"
...
% export PATH="${HOME}/bin:${PATH:+:}${PATH}"

That work-around doesn't require root access. I think that covers all the bases. 👍

@posita
Copy link
Author

posita commented Sep 29, 2015

sadovnychyi/autocomplete-python has a solution (for python binaries) that seems to work well. It expands $PROJECT and allows multiple paths split by ; (e.g., $PROJECT/.venv/bin;python2.7. You might want to check out source code. It has, however (see autocomplete-python/autocomplete-python#66). 😉

It might be nice to support other variable expansion/notation as well (e.g., ${HOME}). Perhaps some collaboration is appropriate?

@SpainTrain
Copy link
Member

This should now be closed by #91

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants