Skip to content

Commit

Permalink
Drop python 3.5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
bstaletic committed Jul 21, 2020
1 parent 321700e commit 1b40817
Show file tree
Hide file tree
Showing 18 changed files with 397 additions and 430 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ YouCompleteMe: a code-completion engine for Vim
[![Build status](https://dev.azure.com/YouCompleteMe/YCM/_apis/build/status/ycm-core.YouCompleteMe?branchName=master)](https://dev.azure.com/YouCompleteMe/YCM/_build?definitionId=3&branchName=master)
[![Coverage status](https://img.shields.io/codecov/c/github/ycm-core/YouCompleteMe/master.svg)](https://codecov.io/gh/ycm-core/YouCompleteMe)

Warning: Support for Python 3.5 will end soon
Warning: Support for Python 3.5 has ended
----

In mid 2020, YCM will drop support for Python 3.5 runtime.
In mid 2020, YCM dropped support for Python 3.5 runtime.

Why?

Expand Down Expand Up @@ -212,6 +212,7 @@ Installation

#### Quick start, installing all completers

- Install YCM plugin via [Vundle][]
- Install cmake, macvim and python; Note that the *system* vim is not supported.

 
Expand Down Expand Up @@ -303,6 +304,7 @@ that are conservatively turned off by default that you may want to turn on.

#### Quick start, installing all completers

- Install YCM plugin via [Vundle][]
- Install cmake, vim and python

 
Expand Down Expand Up @@ -404,6 +406,7 @@ that are conservatively turned off by default that you may want to turn on.

#### Quick start, installing all completers

- Install YCM plugin via [Vundle][]
- Install [Visual Studio Build Tools 2017][visual-studio-download]
- Install cmake, vim and python
- Install go, node and npm
Expand Down Expand Up @@ -460,8 +463,8 @@ Download and install the following software:
Additionally, the version of Python you install must match up exactly with
the version of Python that Vim is looking for. Type `:version` and look at the
bottom of the page at the list of compiler flags. Look for flags that look
similar to `-DDYNAMIC_PYTHON3_DLL=\"python35.dll\"`. This indicates
that Vim is looking for Python 3.5. You'll need one or the other installed,
similar to `-DDYNAMIC_PYTHON3_DLL=\"python36.dll\"`. This indicates
that Vim is looking for Python 3.6. You'll need one or the other installed,
matching the version number exactly.
- [CMake][cmake-download]. Add CMake executable to the PATH environment
variable.
Expand Down Expand Up @@ -516,6 +519,7 @@ that are conservatively turned off by default that you may want to turn on.

#### Quick start, installing all completers

- Install YCM plugin via [Vundle][]
- Install cmake

 
Expand Down
406 changes: 199 additions & 207 deletions doc/youcompleteme.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import glob

version = sys.version_info[ 0 : 3 ]
if version < ( 2, 7, 1 ) or ( 3, 0, 0 ) <= version < ( 3, 5, 1 ):
sys.exit( 'YouCompleteMe requires Python >= 2.7.1 or >= 3.5.1; '
if version < ( 3, 6, 0 ):
sys.exit( 'YouCompleteMe requires Python >= 3.6.0; '
'your version of Python is ' + sys.version )

DIR_OF_THIS_SCRIPT = p.dirname( p.abspath( __file__ ) )
Expand Down
2 changes: 1 addition & 1 deletion plugin/youcompleteme.vim
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ elseif ( v:version > 800 || ( v:version == 800 && has( 'patch1436' ) ) ) &&
\ !has( 'python3_compiled' )
echohl WarningMsg |
\ echomsg "YouCompleteMe unavailable: requires Vim compiled with " .
\ "Python (3.5.1+) support." |
\ "Python (3.6.0+) support." |
\ echohl None
call s:restore_cpo()
finish
Expand Down
4 changes: 2 additions & 2 deletions python/ycm/client/base_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,5 +304,5 @@ def MakeServerException( data ):
if data[ 'exception' ][ 'TYPE' ] == UnknownExtraConf.__name__:
return UnknownExtraConf( data[ 'exception' ][ 'extra_conf_file' ] )

return ServerError( '{0}: {1}'.format( data[ 'exception' ][ 'TYPE' ],
data[ 'message' ] ) )
return ServerError( f'{ data[ "exception" ][ "TYPE" ] }: '
f'{ data[ "message" ] }' )
3 changes: 1 addition & 2 deletions python/ycm/client/completion_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ def _OnCompleteDone_Csharp( self ):
return

if len( namespaces ) > 1:
choices = [ "{0} {1}".format( i + 1, n )
for i, n in enumerate( namespaces ) ]
choices = [ f"{ i + 1 } { n }" for i, n in enumerate( namespaces ) ]
choice = vimsupport.PresentDialog( "Insert which namespace:", choices )
if choice < 0:
return
Expand Down
41 changes: 17 additions & 24 deletions python/ycm/client/debug_info_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,58 +51,51 @@ def FormatDebugInfoResponse( response ):
def _FormatYcmdDebugInfo( ycmd ):
python = ycmd[ 'python' ]
clang = ycmd[ 'clang' ]
message = ( 'Server Python interpreter: {0}\n'
'Server Python version: {1}\n'
'Server has Clang support compiled in: {2}\n'
'Clang version: {3}\n'.format( python[ 'executable' ],
python[ 'version' ],
clang[ 'has_support' ],
clang[ 'version' ] ) )
message = (
f'Server Python interpreter: { python[ "executable" ] }\n'
f'Server Python version: { python[ "version" ] }\n'
f'Server has Clang support compiled in: { clang[ "has_support" ] }\n'
f'Clang version: { clang[ "version" ] }\n' )
extra_conf = ycmd[ 'extra_conf' ]
extra_conf_path = extra_conf[ 'path' ]
if not extra_conf_path:
message += 'No extra configuration file found\n'
elif not extra_conf[ 'is_loaded' ]:
message += ( 'Extra configuration file found but not loaded\n'
'Extra configuration path: {0}\n'.format( extra_conf_path ) )
f'Extra configuration path: { extra_conf_path }\n' )
else:
message += ( 'Extra configuration file found and loaded\n'
'Extra configuration path: {0}\n'.format( extra_conf_path ) )
f'Extra configuration path: { extra_conf_path }\n' )
return message


def _FormatCompleterDebugInfo( completer ):
message = '{0} completer debug information:\n'.format( completer[ 'name' ] )
message = f'{ completer[ "name" ] } completer debug information:\n'
for server in completer[ 'servers' ]:
name = server[ 'name' ]
if server[ 'is_running' ]:
address = server[ 'address' ]
port = server[ 'port' ]
if address and port:
message += ' {0} running at: http://{1}:{2}\n'.format( name,
address,
port )
message += f' { name } running at: http://{ address }:{ port }\n'
else:
message += ' {0} running\n'.format( name )
message += ' {0} process ID: {1}\n'.format( name, server[ 'pid' ] )
message += f' { name } running\n'
message += f' { name } process ID: { server[ "pid" ] }\n'
else:
message += ' {0} not running\n'.format( name )
message += ' {0} executable: {1}\n'.format( name, server[ 'executable' ] )
message += f' { name } not running\n'
message += f' { name } executable: { server[ "executable" ] }\n'
logfiles = server[ 'logfiles' ]
if logfiles:
message += ' {0} logfiles:\n'.format( name )
message += f' { name } logfiles:\n'
for logfile in logfiles:
message += ' {0}\n'.format( logfile )
message += f' { logfile }\n'
else:
message += ' No logfiles available\n'
if 'extras' in server:
for extra in server[ 'extras' ]:
message += ' {0} {1}: {2}\n'.format( name,
extra[ 'key' ],
extra[ 'value' ] )
message += f' { name } { extra[ "key" ] }: { extra[ "value" ] }\n'
for item in completer[ 'items' ]:
message += ' {0}: {1}\n'.format( item[ 'key' ].capitalize(),
item[ 'value' ] )
message += f' { item[ "key" ].capitalize() }: { item[ "value" ] }\n'
return message


Expand Down
8 changes: 4 additions & 4 deletions python/ycm/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'ycmd' )
WIN_PYTHON_PATH = os.path.join( sys.exec_prefix, 'python.exe' )
PYTHON_BINARY_REGEX = re.compile(
r'python(3(\.[5-9])?)?(.exe)?$', re.IGNORECASE )
r'python(3(\.[6-9])?)?(.exe)?$', re.IGNORECASE )


# Not caching the result of this function; users shouldn't have to restart Vim
Expand All @@ -44,7 +44,7 @@ def PathToPythonInterpreter():
return python_interpreter

raise RuntimeError( "Path in 'g:ycm_server_python_interpreter' option "
"does not point to a valid Python 3.5+." )
"does not point to a valid Python 3.6+." )

python_interpreter = _PathToPythonUsedDuringBuild()
if python_interpreter and utils.GetExecutable( python_interpreter ):
Expand All @@ -64,7 +64,7 @@ def PathToPythonInterpreter():
if python_interpreter:
return python_interpreter

raise RuntimeError( "Cannot find Python 3.5+. "
raise RuntimeError( "Cannot find Python 3.6+. "
"Set the 'g:ycm_server_python_interpreter' option "
"to a Python interpreter path." )

Expand All @@ -80,7 +80,7 @@ def _PathToPythonUsedDuringBuild():


def _EndsWithPython( path ):
"""Check if given path ends with a python 3.5+ name."""
"""Check if given path ends with a python 3.6+ name."""
return path and PYTHON_BINARY_REGEX.search( path ) is not None


Expand Down
29 changes: 13 additions & 16 deletions python/ycm/signature_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def UpdateSignatureHelp( state, signature_info ): # noqa
if not signatures:
if state.popup_win_id:
# TODO/FIXME: Should we use popup_hide() instead ?
vim.eval( "popup_close( {} )".format( state.popup_win_id ) )
vim.eval( f"popup_close( { state.popup_win_id } )" )
return SignatureHelpState( None, SignatureHelpState.INACTIVE )

if state.state != SignatureHelpState.ACTIVE:
Expand Down Expand Up @@ -130,7 +130,7 @@ def UpdateSignatureHelp( state, signature_info ): # noqa
# Nowhere to put it so hide it
if state.popup_win_id:
# TODO/FIXME: Should we use popup_hide() instead ?
vim.eval( "popup_close( {} )".format( state.popup_win_id ) )
vim.eval( f"popup_close( { state.popup_win_id } )" )
return SignatureHelpState( None, SignatureHelpState.INACTIVE )

if int( screen_pos[ 'curscol' ] ) <= 1:
Expand Down Expand Up @@ -160,24 +160,21 @@ def UpdateSignatureHelp( state, signature_info ): # noqa
}

if not state.popup_win_id:
state.popup_win_id = GetIntValue( "popup_create( {}, {} )".format(
json.dumps( buf_lines ),
json.dumps( options ) ) )
state.popup_win_id = GetIntValue(
f'popup_create( { json.dumps( buf_lines ) }, '
f'{ json.dumps( options ) } )' )
else:
vim.eval( 'popup_settext( {}, {} )'.format(
state.popup_win_id,
json.dumps( buf_lines ) ) )
vim.eval( f'popup_settext( { state.popup_win_id }, '
f'{ json.dumps( buf_lines ) } )' )

# Should do nothing if already visible
vim.eval( 'popup_move( {}, {} )'.format( state.popup_win_id,
json.dumps( options ) ) )
vim.eval( 'popup_show( {} )'.format( state.popup_win_id ) )
vim.eval( f'popup_move( { state.popup_win_id }, { json.dumps( options ) } )' )
vim.eval( f'popup_show( { state.popup_win_id } )' )

syntax = utils.ToUnicode( vim.current.buffer.options[ 'syntax' ] )
active_signature = int( signature_info.get( 'activeSignature', 0 ) )
vim.eval( "win_execute( {}, 'set syntax={} cursorline | "
"call cursor( [ {}, 1 ] )' )".format(
state.popup_win_id,
utils.ToUnicode( vim.current.buffer.options[ 'syntax' ] ),
active_signature + 1 ) )
vim.eval( f"win_execute( { state.popup_win_id }, "
f"'set syntax={ syntax } cursorline | "
f"call cursor( [ { active_signature + 1 }, 1 ] )' )" )

return state
4 changes: 2 additions & 2 deletions python/ycm/tests/client/command_request_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _CheckGoToList( self,
self._request.RunPostCommandActionsIfNeeded( 'aboveleft' )

vim_eval.assert_has_exact_calls( [
call( 'setqflist( {0} )'.format( json.dumps( expected_qf_list ) ) )
call( f'setqflist( { json.dumps( expected_qf_list ) } )' )
] )
vim_command.assert_has_exact_calls( [
call( 'botright copen' ),
Expand Down Expand Up @@ -188,7 +188,7 @@ def _BasicResponseTest( command, response ):
request = CommandRequest( [ command ] )
request._response = response
request.RunPostCommandActionsIfNeeded( 'belowright' )
vim_command.assert_called_with( "echo '{0}'".format( response ) )
vim_command.assert_called_with( f"echo '{ response }'" )

_BasicResponseTest( command, response )

Expand Down
10 changes: 6 additions & 4 deletions python/ycm/tests/client/completion_request_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ def _Check( self, completion_data, expected_vim_data ):
try:
assert_that( vim_data, equal_to( expected_vim_data ) )
except Exception:
print( "Expected:\n'{}'\nwhen parsing:\n'{}'\nBut found:\n'{}'".format(
expected_vim_data,
completion_data,
vim_data ) )
print( "Expected:\n"
f"'{ expected_vim_data }'\n"
"when parsing:\n'"
f"{ completion_data }'\n"
"But found:\n"
f"'{ vim_data }'" )
raise


Expand Down
2 changes: 1 addition & 1 deletion python/ycm/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def WaitUntilReady( timeout = 5 ):
try:
if time.time() > expiration:
raise RuntimeError( 'Waited for the server to be ready '
'for {0} seconds, aborting.'.format( timeout ) )
f'for { timeout } seconds, aborting.' )
if _IsReady():
return
except requests.exceptions.ConnectionError:
Expand Down
10 changes: 5 additions & 5 deletions python/ycm/tests/paths_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@

def EndsWithPython_Good( path ):
assert_that( _EndsWithPython( path ),
'Path {0} does not end with a Python name.'.format( path ) )
f'Path { path } does not end with a Python name.' )


def EndsWithPython_Bad( path ):
assert_that( not _EndsWithPython( path ),
'Path {0} does end with a Python name.'.format( path ) )
f'Path { path } does end with a Python name.' )


@pytest.mark.parametrize( 'path', [
'python3',
'/usr/bin/python3.5',
'/home/user/.pyenv/shims/python3.5',
r'C:\Python35\python.exe'
'/usr/bin/python3.6',
'/home/user/.pyenv/shims/python3.6',
r'C:\Python36\python.exe'
] )
def EndsWithPython_Python3Paths_test( path ):
EndsWithPython_Good( path )
Expand Down
Loading

0 comments on commit 1b40817

Please sign in to comment.