Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 615832 - app-editors/vim: Multiple problems with py2/py3 support and plugins
Summary: app-editors/vim: Multiple problems with py2/py3 support and plugins
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 2 votes (vote)
Assignee: Vim Maintainers
URL:
Whiteboard:
Keywords:
: 678950 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-04-17 09:43 UTC by Michał Górny
Modified: 2020-01-21 16:13 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-04-17 09:43:09 UTC
I've noticed that vim plugins have multiple issues regarding Python support:

1. A number of plugins is not using python eclasses at all, and just depending on vim[python] without enforcing any supported implementation.

2. A number of plugins use python-single-r1 but do not enforce the specific implementation being used in vim. For example, if conqueterm is built with PST=2.7, and vim has 2.7+3.x, the plugin will use 3.x instead of 2.7 because of hardcoded preference.

3. Making plugins (single-r1) depend on vim (multi-r1 with ^^ in REQUIRED_USE) is an easy way to hit impossible depgraph blockers which Portage can't resolve, see 615316#c4 [1]. The only sane way of solving this is converting all plugins to pseudo-r1 with ^^ in REQUIRED_USE which sounds like a major trouble for users atm.

4. Reading vim manual, using py2 and py3 at the same time sounds like an easy way to make your system explode with symbol collisions. Upstream seems to do some hackery to avoid that but it requires that Python extensions are explicitly linked to libpython -- which we don't enforce reliably at the moment.

That said, I think it'd be better to kill the 2+3 support and take vim back to python-single-r1.

[1]:https://bugs.gentoo.org/show_bug.cgi?id=615316#c4
Comment 1 Coacher 2017-04-21 21:35:42 UTC
Why broken plugins dictate and limit Vim functionality?

Indeed you cannot utilize both py2 and py3 at the same time in Vim, but having both py2 and py3 in Vim allows e.g. working with both py2 and py3 virtualenvs.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-04-21 21:50:47 UTC
(In reply to Coacher from comment #1)
> Why broken plugins dictate and limit Vim functionality?

Because we have better things to do.

> Indeed you cannot utilize both py2 and py3 at the same time in Vim, but
> having both py2 and py3 in Vim allows e.g. working with both py2 and py3
> virtualenvs.

I have no clue what you're talking about, and I seriously doubt vim has anything to do with your virtualenvs.
Comment 3 Coacher 2017-04-21 21:59:26 UTC
(In reply to Michał Górny from comment #2)
> (In reply to Coacher from comment #1)
> > Why broken plugins dictate and limit Vim functionality?
> 
> Because we have better things to do.
Apparently this includes rebuilding Vim whenever a specific plugin with specific python version is needed.

> > Indeed you cannot utilize both py2 and py3 at the same time in Vim, but
> > having both py2 and py3 in Vim allows e.g. working with both py2 and py3
> > virtualenvs.
> 
> I have no clue what you're talking about, and I seriously doubt vim has
> anything to do with your virtualenvs.
Switch to py2 virtualenv -> vim picks up python library from venv and I can work on my py2 project and have all my beloved bells and whistles working with py2.
Then switch to py3 virtualenv and vim works now with py3 from venv.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-04-22 06:10:30 UTC
Are you volunteering to do all the necessary work, including all current plugins and possible help with future plugins?
Comment 5 Coacher 2017-04-22 22:37:25 UTC
(In reply to Michał Górny from comment #4)
> Are you volunteering to do all the necessary work, including all current
> plugins and possible help with future plugins?
Sure. If Vim Gentoo team will have me, I'll gladly help.

All the necessary work as I see it is to look through existing Vim plugins and adjust/fix python deps.

> 2. A number of plugins use python-single-r1 but do not enforce the specific
> implementation being used in vim. For example, if conqueterm is built with
> PST=2.7, and vim has 2.7+3.x, the plugin will use 3.x instead of 2.7 because
> of hardcoded preference.
$ epkginfo conqueterm
!!! No packages matching 'conqueterm'
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-04-23 07:04:04 UTC
(In reply to Coacher from comment #5)
> (In reply to Michał Górny from comment #4)
> > Are you volunteering to do all the necessary work, including all current
> > plugins and possible help with future plugins?
> Sure. If Vim Gentoo team will have me, I'll gladly help.
> 
> All the necessary work as I see it is to look through existing Vim plugins
> and adjust/fix python deps.

The necessary work is, for all plugins:

1. Convert them into python-r1 (or python-single-r1 but that's even harder on users) with REQUIRED_USE="^^ ( $(python_gen_useflags '*') )" since revdeps must not allow wider choice of implementations than vim (see bug #615316).

2. Add appropriate package.use adjustments into profile to make things work out of the box with default configuration.

3. Alter the code of each plugin that supports py2+py3 to actually enforce the user's choice -- i.e. force-false checks for py3 when py2 was selected, and the other way around.

I would like to point out that:

a. This will cause a significant pain on the users who already complain about REQUIRED_USE requiring them to play with PYTHON_TARGETS on vim -- now they will have to play on all vim plugins.

b. Your use case might not work anyway since all plugins will be bound to a specific Python version.

Finally, I would like to point out that it's probably a very bad idea for vim to use python from virtualenv. If it's built against system libraries, it should use the system libraries.

> > 2. A number of plugins use python-single-r1 but do not enforce the specific
> > implementation being used in vim. For example, if conqueterm is built with
> > PST=2.7, and vim has 2.7+3.x, the plugin will use 3.x instead of 2.7 because
> > of hardcoded preference.
> $ epkginfo conqueterm
> !!! No packages matching 'conqueterm'

It's app-vim/conque.
Comment 7 Grant Goodyear 2017-07-27 21:49:36 UTC
I just ran into this issue when I installed the nim.vim extension, and it failed to load because it tried to call 'pyfile' instead of 'py3file'. Ultimately, that's a bug in the plugin which needs to be fixed in their repo. 

Interestingly, it was only a problem with vim, and not with neovim. Reading more deeply (https://neovim.io/doc/user/provider.html#provider-python), neovim may serve the purpose that Coacher was complaining about.
Comment 8 Arfrever Frehtes Taifersar Arahesis 2019-02-28 06:46:26 UTC
*** Bug 678950 has been marked as a duplicate of this bug. ***
Comment 9 Arfrever Frehtes Taifersar Arahesis 2019-02-28 07:16:30 UTC
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=778b69c618b4e33ae5a129c9276d75c91ad3b46a

commit 778b69c618b4e33ae5a129c9276d75c91ad3b46a
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2017-04-20 19:05:13 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2017-05-27 15:19:16 +0000

    app-editors/vim: Convert to python-single-r1, #615832


https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a1c6712b550f978bd12e228557bb0b8e986c84cd

commit a1c6712b550f978bd12e228557bb0b8e986c84cd
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2017-04-20 19:16:04 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2017-05-27 15:19:17 +0000

    app-editors/gvim: Convert to python-single-r1, #615832


https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f86b5c0bf72ec0bb779a3cb90c5db4a84b3bceb2

commit f86b5c0bf72ec0bb779a3cb90c5db4a84b3bceb2
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2017-04-20 20:02:06 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2017-05-27 15:19:18 +0000

    app-vim/editorconfig-vim: Convert to python-single-r1, #615832