Skip to content

feat(provider)!: remove support for python2 and python3.[3-6] #17222

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
merged 1 commit into from
Jan 29, 2022

Conversation

bfredl
Copy link
Member

@bfredl bfredl commented Jan 28, 2022

These versions of python has reached End-of-life. getting rid of python2 support removes a lot of logic to support two
incompatible python versions in the same version.

Note: this is a draft but not marked as such because I want to see all mayhem this causes in CI at once.

Note: as currently has("python") will return false while has("python3") and has("pythonx") will return true when available. I am inclined to not change this as this is the only way plugins can check that python2 is not supported without new special logic for neovim 0.7+ only. However if the user/plugin uses :python / pyeval() without checking has() we will give them python, that is python3, as they asked, as python now unambiguously means python3.

@fsouza
Copy link
Contributor

fsouza commented Jan 28, 2022

3.6 is technically EOL too, but I guess that's too soon?

@bfredl
Copy link
Member Author

bfredl commented Jan 28, 2022

@fsouza perhaps we should. I was just going by neovim/pynvim#492 at this point :]

@bfredl bfredl force-pushed the babajpy2 branch 3 times, most recently from 4902eaf to 7a1c844 Compare January 29, 2022 12:03
@bfredl bfredl changed the title [WIP] feat(provider)!: remove support for python2 and python3.[3-5] feat(provider)!: remove support for python2 and python3.[3-6] Jan 29, 2022
@bfredl bfredl force-pushed the babajpy2 branch 6 times, most recently from 2cad9c3 to b5eb3b7 Compare January 29, 2022 17:57
@bfredl
Copy link
Member Author

bfredl commented Jan 29, 2022

Tests are updated and doc reviews addressed.

These versions of python has reached End-of-life. getting rid
of python2 support removes a lot of logic to support two
incompatible python versions in the same version.
Copy link
Member

@clason clason left a comment

Choose a reason for hiding this comment

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

Minor docnits, otherwise LGTM. (Love those diffstats :])

@mckellygit
Copy link

mckellygit commented Jan 30, 2022

@bfredl, hi
With this commit I now see this on every startup -

Error detected while processing function provider#pythonx#Detect[1]..provider#pythonx#DetectByModule[1]..<SNR>28_get_python_executable_from_host_var:
line    1:
E605: Exception not caught: unsupported
Press ENTER or type command to continue

But I think my python is ok ?

## Python 3 provider (optional)
  - INFO: Using: g:python3_host_prog = "/usr/bin/python3.8"
  - INFO: Executable: /usr/bin/python3.8
  - INFO: Python version: 3.8.10
  - INFO: pynvim version: 0.4.3
  - OK: Latest pynvim is installed.

## Python virtualenv
  - OK: no $VIRTUAL_ENV

and

% python --version
Python 3.8.10
% python3 --version
Python 3.8.10

This seems to be from pythonx.vim -

function! s:get_python_executable_from_host_var(major_version) abort
  return expand(get(g:, 'python'.(a:major_version == 3 ? '3' : execute("throw 'unsupported'")).'_host_prog', ''), v:true)
endfunction

Do you know where the major_version could be getting set (to 2) ?
Is it a plugin I have that might be looking for python2 ?
Do I need to remove all python2 from my system ?
thx,
-m

@mckellygit
Copy link

ok, I think its the vimade plugin. I will look into that and work with that developer.
thx again for nvim,
-m

@yaegassy
Copy link

yaegassy commented Jan 31, 2022

I am using "vim-plug" as my plugin manager. Since this PR was merged, I can't use :PlugInstall or :PlugUpdate with "vim-plug".

I found out that it is because has('python') raises an error the first time it is executed.

There may be a situation where all plugins that use has('python') are broken. :(

DEMO (mp4):

nvim -u NONE

Kapture.2022-01-31.at.11.29.28.mp4

@bfredl
Copy link
Member Author

bfredl commented Jan 31, 2022

You might need to clean out stale runtime files like this suggests. #17252 (comment)

@yaegassy
Copy link

I always build Neovim with CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$HOME/neovim" CMAKE_BUILD_TYPE=Release. I deleted $HOME/neovim and built it, and the problem was solved.

@mckellygit
Copy link

Thanks so much.
I also just now did a rm -rf /usr/local/share/nvim/runtime before a make install and no longer see the issue.
-m

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.

6 participants