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

[READY] Make python binary specifiable by the user #295

Merged
merged 9 commits into from
Jan 18, 2016

Conversation

vheon
Copy link
Contributor

@vheon vheon commented Jan 7, 2016

I'm starting this PR as WIP because it lacks tests and I wanted to ask for suggestion about that. What do you think would be the best approach? I was thinking about configuring the user_option and check how the utils.SafePopen was called but in general I'm not a fan of this kind of tests, so I'm open to suggestion 😃

Review on Reviewable

@Valloric
Copy link
Member

Valloric commented Jan 9, 2016

I don't see anything wrong with this approach. :)


Review status: 0 of 2 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.


ycmd/completers/python/jedi_completer.py, line 75 [r1] (raw file):
binary_path is a bit too generic. Perhaps _python_binary_path? Similar for binary variable in other function params/locals.


ycmd/completers/python/jedi_completer.py, line 78 [r1] (raw file):
Why not just self._UpdatePythonBinary( user_options.get(...) )


ycmd/completers/python/jedi_completer.py, line 91 [r1] (raw file):
This isn't binary specific; maybe CheckFileExists?


Comments from the review on Reviewable.io

@vheon
Copy link
Contributor Author

vheon commented Jan 9, 2016

Ok, then I will try it.


Review status: 0 of 2 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.


ycmd/completers/python/jedi_completer.py, line 91 [r1] (raw file):
IIRC the Tern completer have the same function for the same purpose (mocking it during the test), what do you think of refactor it into a common module? maybe the utils module.


Comments from the review on Reviewable.io

@vheon
Copy link
Contributor Author

vheon commented Jan 9, 2016

Review status: 0 of 2 files reviewed at latest revision, 3 unresolved discussions.


ycmd/completers/python/jedi_completer.py, line 75 [r1] (raw file):
Done.


ycmd/completers/python/jedi_completer.py, line 78 [r1] (raw file):
Done.


Comments from the review on Reviewable.io

@lithammer
Copy link

Review status: 0 of 2 files reviewed at latest revision, 5 unresolved discussions, some commit checks failed.


ycmd/completers/python/jedi_completer.py, line 38 [r2] (raw file):
*interpreter
*specify


ycmd/completers/python/jedi_completer.py, line 91 [r2] (raw file):
*testing


Comments from the review on Reviewable.io

@vheon
Copy link
Contributor Author

vheon commented Jan 9, 2016

Review status: 0 of 2 files reviewed at latest revision, 5 unresolved discussions.


ycmd/completers/python/jedi_completer.py, line 38 [r2] (raw file):
ops, thanks!


Comments from the review on Reviewable.io

@vheon
Copy link
Contributor Author

vheon commented Jan 9, 2016

Review status: 0 of 2 files reviewed at latest revision, 5 unresolved discussions.


ycmd/completers/python/jedi_completer.py, line 91 [r2] (raw file):
Done.


Comments from the review on Reviewable.io

@Valloric
Copy link
Member

Valloric commented Jan 9, 2016

Reviewed 1 of 2 files at r1, 1 of 1 files at r3.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


ycmd/completers/python/jedi_completer.py, line 91 [r1] (raw file):
Sure.


Comments from the review on Reviewable.io

@homu
Copy link
Contributor

homu commented Jan 9, 2016

☔ The latest upstream changes (presumably #303) made this pull request unmergeable. Please resolve the merge conflicts.

@vheon
Copy link
Contributor Author

vheon commented Jan 10, 2016

I've added the tests for the user defined python binary path. I will add the tests for RestartServer tomorrow (it is pretty late here 😝 ).

A note: to test the user defined option I created the UserOption function which will clean itself up after the test is done (supporting the strategy suggested by @puremourning in #246 (comment)) and I liked how it would read in the test, so I went and replace the only usage of ChangeSpecificOption with that, I hope you agree with me on this.


Review status: 1 of 8 files reviewed at latest revision, 1 unresolved discussion.


ycmd/completers/python/jedi_completer.py, line 91 [r1] (raw file):
I've actually change my mind about because the purpose of that method is to be patched in the tests, so I believe it has to be as clear as possible what is going on during the test; if I change it to CheckFileExists then from the test I could not know that that method is actually called only for checking if a passed binary path exists. The same would be true if I move the method into the utils module: would it be clear that that method is only called for my purpose? I am certain that I will not mock things that I shouldn't? So for said reasons I would prefer to keep it as it is.


Comments from the review on Reviewable.io

@Valloric
Copy link
Member

:lgtm: Thanks for doing this!


Review status: 1 of 8 files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


ycmd/tests/handlers_test.py, line 54 [r4] (raw file):
I like this, good idea!


Comments from the review on Reviewable.io

@puremourning
Copy link
Member

Reviewable is failing for me, so can't make line comments, but had 2 thoughts:

  • could the option be confused with the the other 'path to Python executable' that's used by Vim client? Should we prefix it with JeditHTTP ?
  • in the message, it's worth including the value if even just in the log file, it just helps debugging :)

Reviewed 1 of 2 files at r1, 7 of 7 files at r4.
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


Comments from the review on Reviewable.io

@puremourning
Copy link
Member

Also. Csharp tests are failing :/


Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


Comments from the review on Reviewable.io

@vheon
Copy link
Contributor Author

vheon commented Jan 10, 2016

Also. Csharp tests are failing :/

There were a test in Csharp subcommands and in clang get_completion which used _ChangeSpecificOption. I used the new GoToReferences to get all usage of if but apparently it didn't work as I expected :(

could the option be confused with the the other 'path to Python executable' that's used by Vim client? Should we prefix it with JeditHTTP ?

I was thinking about it myself, and you may be right 😕 I didn't want to mention JediHTTP since is an implementation detail but could be the most sensible solution.

in the message, it's worth including the value if even just in the log file, it just helps debugging :)

You mean the value the user gives us which is not an existing one?


Review status: 8 of 10 files reviewed at latest revision, 1 unresolved discussion.


Comments from the review on Reviewable.io

@puremourning
Copy link
Member

You mean the value the user gives us which is not an existing one?

Yeah, sorry to be clear, i've added a line comment now


Reviewed 2 of 2 files at r5.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


ycmd/completers/python/jedi_completer.py, line 85 [r5] (raw file):
It might be useful to include the value of binary in this message for debugging purposes.


Comments from the review on Reviewable.io

@puremourning
Copy link
Member

Anyway, LGTM with those small comments. :)


Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from the review on Reviewable.io

@micbou
Copy link
Collaborator

micbou commented Jan 10, 2016

UserOption should be renamed UserOptions and take a dictionary instead of only one key/value pair (like the ChangeSpecificOptions function that it replaces). This way, we avoid nested with blocks if we need to set multiple options. I would also prefer if it could be used as a decorator to avoid the with indentation but it's a matter of taste.


Reviewed 2 of 2 files at r1.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from the review on Reviewable.io

@vheon
Copy link
Contributor Author

vheon commented Jan 10, 2016

UserOption should be renamed UserOptions and take a dictionary instead of only one key/value pair (like the ChangeSpecificOptions function that it replaces). This way, we avoid nested with blocks if we need to set multiple options. I would also prefer if it could be used as a decorator to avoid the with indentation but it's a matter of taste.

I agree that the "with" vs. "decorator" approach is a matter of taste. For the UserOptions I don't really like the dictionary approach, maybe play with a kwargs and make it like:

with self.UserOptions( user_option_one = 'one_value', user_option_two = 'two_value' ):
  ...

But I think it doesn't make sense to make it accept multiple user_options until we actually need it.


Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from the review on Reviewable.io

@puremourning
Copy link
Member

But I think it doesn't make sense to make it accept multiple user_options until we actually need it.

Agreed. No YAGNI :)

I agree that the "with" vs. "decorator" approach

Me too, though I also prefer decorator (for the same reasons as @micbou), but in order to support that easily without pain, you have to require contextlib2 in python 2.6. I did this a while back if you remember but we ditched it because we replaced it with setUp/tearDown methods.


Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from the review on Reviewable.io

@puremourning
Copy link
Member

:lgtm:


Reviewed 2 of 2 files at r6.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from the review on Reviewable.io

@vheon
Copy link
Contributor Author

vheon commented Jan 10, 2016

Me too, though I also prefer decorator (for the same reasons as @micbou), but in order to support that easily without pain, you have to require contextlib2 in python 2.6. I did this a while back if you remember but we ditched it because we replaced it with setUp/tearDown methods.

Yes I remember and for me depends of the usage of it; for this particular case I prefer the with approach because it reads better: "with those user options the behaviour is ....". Anyway if it will bother us in the future we can still change it.


Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from the review on Reviewable.io

@vheon
Copy link
Contributor Author

vheon commented Jan 10, 2016

Review status: all files reviewed at latest revision, 1 unresolved discussion.


ycmd/completers/python/jedi_completer.py, line 85 [r5] (raw file):
Done.


Comments from the review on Reviewable.io

@puremourning
Copy link
Member

Yeh, this is totally fine :)


Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from the review on Reviewable.io

@puremourning
Copy link
Member

is this [ready] now ?


Review status: all files reviewed at latest revision, all discussions resolved, some commit checks pending.


Comments from the review on Reviewable.io

@vheon
Copy link
Contributor Author

vheon commented Jan 10, 2016

I wanted to add the tests for the RestartServer, but I don't know If I'm able to do it tonight.


Review status: all files reviewed at latest revision, all discussions resolved, some commit checks pending.


Comments from the review on Reviewable.io

@vheon vheon force-pushed the basic-any-python branch 2 times, most recently from a09b36e to cf9bbb3 Compare January 17, 2016 19:21
@vheon vheon changed the title [WIP] Make python binary specifiable by the user [READY] Make python binary specifiable by the user Jan 18, 2016
@vheon
Copy link
Contributor Author

vheon commented Jan 18, 2016

I've pushed the tests for the RestartServer. I would love if someone else could test this.

@reinhrst if you some spare time to test this would be great! Basically there is a user option for specify which python should be used to spawn the JediHTTP server to get completion from. We still have the problem that you specified with https://github.com/reinhrst/jedi-working-directory-example but that was a pre-existing problem so I think it would be one of the next things to tackle.

When this is merged I'm going to update the YCM docs.

@puremourning
Copy link
Member

:LGTM:


Reviewed 1 of 1 files at r7.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from the review on Reviewable.io

@puremourning
Copy link
Member

Fail, Jackson. Try again: :lgtm:


Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from the review on Reviewable.io

@micbou
Copy link
Collaborator

micbou commented Jan 18, 2016

I tested g:ycm_python_binary_path option and :YcmCompleter RestartServer command. It works like expected. With this PR, we have now Python3 support in ycmd. Excellent work!

I just added a (pedantic) comment but this is :lgtm:


Reviewed 5 of 7 files at r4, 2 of 2 files at r5, 1 of 2 files at r6.
Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful.


ycmd/tests/python/user_defined_python_test.py, line 40 [r7] (raw file):
Missing capital letter.


Comments from the review on Reviewable.io

@vheon
Copy link
Contributor Author

vheon commented Jan 18, 2016

Review status: 9 of 10 files reviewed at latest revision, 1 unresolved discussion.


ycmd/tests/python/user_defined_python_test.py, line 40 [r7] (raw file):
Done.


Comments from the review on Reviewable.io

@puremourning
Copy link
Member

Woo! Python 3 in ycmd.

@homu r+

Nice one! A lot went into getting here, so thanks @vheon. I think python 3 support is one of (if not, the) most requested feature


Reviewed 1 of 1 files at r8.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from the review on Reviewable.io

@homu
Copy link
Contributor

homu commented Jan 18, 2016

📌 Commit 5b48d5f has been approved by puremourning

@homu
Copy link
Contributor

homu commented Jan 18, 2016

⌛ Testing commit 5b48d5f with merge fb0e959...

homu added a commit that referenced this pull request Jan 18, 2016
[READY] Make python binary specifiable by the user

I'm starting this PR as WIP because it lacks tests and I wanted to ask for suggestion about that. What do you think would be the best approach? I was thinking about configuring the `user_option` and check how the `utils.SafePopen` was called but in general I'm not a fan of this kind of tests, so I'm open to suggestion 😃

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/295)
<!-- Reviewable:end -->
@vheon
Copy link
Contributor Author

vheon commented Jan 18, 2016

Apparently in my fork one of the test failed due to the typescript Request sequence mismatch error. We should look into that 😢

https://travis-ci.org/vheon/ycmd/jobs/103223744

@puremourning
Copy link
Member

that's been happening a bit recently - we're still not sure if it is a bug in the completer or in tsserver. all we know is that it only started happening recently and we don't fix the version of tsserver in travis

@puremourning puremourning mentioned this pull request Jan 18, 2016
@homu
Copy link
Contributor

homu commented Jan 18, 2016

☀️ Test successful - status

@homu homu merged commit 5b48d5f into ycm-core:master Jan 18, 2016
@reinhrst
Copy link

Very cool to see this working 👍

Would be nice to search the PATH for the executable. That way one could just use python as executable (perhaps this should just be the default), and it will automatically get the one in the virtualenv you were in when you started vim. Right now I need to put this in my .vimrc to achieve this: let g:ycm_python_binary_path=substitute(system("which python"), "\n$", "", "")

When testing (in a python3 virtualenv), it worked partly.

import urllib
urllib.

indeed only gives me the completions for python3.

However

import asyncio
asyncio.

results in a crash. Didn't really have time to dive into it, but these are the logs (this is with master (d05bf55) of YouCompleteMe, master (bf256b2) or ycmd, all dependencies on the suggested version):

ycmd stderr:

2016-01-23 14:01:50,975 - INFO - Received event notification
2016-01-23 14:01:50,978 - INFO - Received completion request
2016-01-23 14:01:50,979 - INFO - Starting new HTTP connection (1): 127.0.0.1
2016-01-23 14:01:50,985 - ERROR - Exception from semantic completer (using general): Traceback (most recent call last):
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 104, in GetCompletions
    .ComputeCandidates( request_data ) )
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 168, in ComputeCandidates
    candidates = self._GetCandidatesFromSubclass( request_data )
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 184, in _GetCandidatesFromSubclass
    raw_completions = self.ComputeCandidatesInner( request_data )
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 240, in ComputeCandidatesInner
    for completion in self._JediCompletions( request_data ) ]
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 244, in _JediCompletions
    return self._GetResponse( '/completions', request_data )[ 'completions' ]
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 191, in _GetResponse
    response.raise_for_status()
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/models.py", line 837, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1:49973/completions

jedihttp stderr:

Traceback (most recent call last):
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/cache.py", line 200, in load_parser
    parser_cache_item = parser_cache[path]
KeyError: '/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/__init__.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/bottle/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/bottle/bottle.py", line 1732, in wrapper
    rv = callback(*a, **ka)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/jedihttp/hmac_plugin.py", line 58, in wrapper
    body = callback( *args, **kwargs )
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/jedihttp/handlers.py", line 63, in completions
    } for completion in script.completions() ]
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/__init__.py", line 188, in completions
    completion_names = get_completions(user_stmt, b)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/__init__.py", line 174, in get_completions
    completion_names += self._simple_complete(path, dot, like)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/__init__.py", line 250, in _simple_complete
    scopes = list(self._prepare_goto(path, True))
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/__init__.py", line 294, in _prepare_goto
    scopes = self._evaluator.eval_element(eval_stmt)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/cache.py", line 41, in wrapper
    rv = function(obj, *args, **kwargs)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/__init__.py", line 169, in eval_element
    return self._eval_atom(element)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/__init__.py", line 230, in _eval_atom
    return self.find_types(scope, atom, stmt.start_pos, search_global=True)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/__init__.py", line 120, in find_types
    return f.find(scopes, search_global)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/debug.py", line 52, in wrapper
    result = func(*args, **kwargs)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/finder.py", line 87, in find
    types = self._names_to_types(names, search_global)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/finder.py", line 233, in _names_to_types
    new_types = _name_to_types(self._evaluator, name, self.scope)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/cache.py", line 41, in wrapper
    rv = function(obj, *args, **kwargs)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/finder.py", line 282, in _name_to_types
    types += imports.ImportWrapper(evaluator, name).follow()
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/cache.py", line 41, in wrapper
    rv = function(obj, *args, **kwargs)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/imports.py", line 94, in follow
    types = importer.follow()
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/cache.py", line 41, in wrapper
    rv = function(obj, *args, **kwargs)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/imports.py", line 252, in follow
    return self._do_import(self.import_path, self.sys_path_with_modifications())
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/imports.py", line 347, in _do_import
    module = _load_module(self._evaluator, module_path, source, sys_path)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/imports.py", line 449, in _load_module
    cached = cache.load_parser(path)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/cache.py", line 210, in load_parser
    return ParserPickling.load_parser(path, p_time)
  File "/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/cache.py", line 267, in load_parser
    parser_cache_item = pickle.load(f)
AttributeError: Can't get attribute 'ParserWithRecovery' on <module 'jedi.parser' from '/Users/reinoud/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/parser/__init__.py'>

Python executable is /Users/reinoud/Envs/tmp-c195d4c4ce39463/bin/python, which is a symlink to python3.4

@vheon
Copy link
Contributor Author

vheon commented Jan 23, 2016

Would be nice to search the PATH for the executable

We could think of passing the PATH env to the Popen; it should work then 👍

When testing (in a python3 virtualenv), it worked partly.

I don't like the crash, but from the logs it appears to be a jedi issue, am I wrong? maybe I need to use the dev branch instead of master?

@reinhrst
Copy link

We could think of passing the PATH env to the Popen; it should work then 👍

It seems to do that automatically but there are some issues (especially on Windows): http://stackoverflow.com/a/5659249/1207489 . In addition, _CheckBinaryExists() needs some work then.

I don't like the crash, but from the logs it appears to be a jedi issue, am I wrong? maybe I need to use the dev branch instead of master?

I just checked, indeed it crashes on master of jedi. @davidhalter , which branch/tag/sha makes most sense to use? See davidhalter/jedi#685

@vheon
Copy link
Contributor Author

vheon commented Jan 23, 2016

It seems to do that automatically but there are some issues (especially on Windows): http://stackoverflow.com/a/5659249/1207489 . In addition, _CheckBinaryExists() needs some work then.

So is more complicated than I thought 😕

@reinhrst
Copy link

This may do the trick, e.g. making _CheckBinaryExists() into _FindBinary() : http://stackoverflow.com/a/377028/1207489

@reinhrst
Copy link

Just for reference, using the following 2 lines give a really nice experience

let g:ycm_python_binary_path=substitute(system("which python"), "\n$", "", "")
let $PYTHONPATH=getcwd() . ":" . $PYTHONPATH

First makes sure the python is used from the current virtual env. Seconds adds the directory in which vim was started to the pythonpath, allowing completions from files and packages in that directory.

@vheon
Copy link
Contributor Author

vheon commented Jan 23, 2016

Just for reference, using the following 2 lines give a really nice experience

I'm glad that we could finally improve (even if slightly) the python experience 😃

First makes sure the python is used from the current virtual env. Seconds adds the directory in which vim was started to the pythonpath, allowing completions from files and packages in that directory.

I will try to came up with a solution for those two problems.

@puremourning
Copy link
Member

Does which work/exist in Windows?

On 23 Jan 2016, at 20:54, Claude notifications@github.com wrote:

Just for reference, using the following 2 lines give a really nice experience

let g:ycm_python_binary_path=substitute(system("which python"), "\n$", "", "")
let $PYTHONPATH=getcwd() . ":" . $PYTHONPATH
First makes sure the python is used from the current virtual env. Seconds adds the directory in which vim was started to the pythonpath, allowing completions from files and packages in that directory.


Reply to this email directly or view it on GitHub.

@reinhrst
Copy link

Does which work/exist in Windows?

Don't know. I'm not suggesting my line to be a generic solution, just might help some people testing / adapting this to their own situation. I agree with @vheon that this should be solved in some generic way.

@micbou
Copy link
Collaborator

micbou commented Jan 23, 2016

Does which work/exist in Windows?

Not natively. However, there is the where command.

@vheon vheon deleted the basic-any-python branch February 28, 2016 11:15
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.

7 participants