Repository navigation
ENH: ship our own copy of six 1.9.0 - #4501
matthew-brett wants to merge 1 commit into
Conversation
Six seems to be the external dependency that is most likely to cause problems, and it is a small standalone .py file that is designed for projects to ship in their source tree. Shipping has the following advantages: * Reduces pip dependencies by one; * Makes mpl less vulnerable to upstream changes in six. At present, it is possible for six to change upstream in pypi and break matplotlib installs, requiring a new mpl release; It does mean that we don't get the lastest six, but I believe this is an advantage for the reason above. Now we are so far into the Python 3 era, six should be rather stable.
|
I am firmly 👎 on this.
I also thought we cleaned up the setup.py to automatically install six if needed. I just ran the test of starting with a bare conda enviroment running The things with |
|
Would you mind saying what you think the disadvantage will be? Is it worth me going back over the issues and mailing list reports of problems with six in order to persuade you? Or are you resolved on this already? |
|
What are the install methods for either 1.4.3 or master which result in matplotlib being installed without As a community we should be moving towards many small packages/libraries, bundling easily installable dependencies feels like it is moving the wrong direction. I just ran the same install experiment with a bare system venv and it worked correctly. |
|
Projects shipping six or portions of six:
Numpy and sympy went with taking only the bits of six they needed. I haven't seen any six or python 3 compatibility problems with these projects. On the other hand, six-related problems seem to be rather common on the matplotlib lists. I can see the advantage in general of going towards independent packages, but that does have a limit, In the case of six - which is one single .py file - there is - to my eye - no advantage at all for keeping the external dependency - and only disadvantages - of which we have seen fairly common examples. Can you see another advantage other than the general idea that small independent packages are a good thing? |
|
I think it's hard to argue the problem has already been solved, on the basis of the fairly frequent emails and issues reporting problems with six - is it worth me collecting those? |
|
The issues have to be with 1.4.3 or master and be from install methods we officially support (if some third party package manager is doing a bad job of capturing dependencies that should not be our problem). Trolling the SO posts at http://stackoverflow.com/search?q=[matplotlib]+No+module+named+six makes me think that the problem is really with our binary windows installers, not with the source. attn @cgohlke |
|
I can not see anything wrong on Windows. The bdist_wininst installers don't include or automatically install any dependencies so the user is expected to install them in addition to matplotlib. This is documented at https://github.com/matplotlib/matplotlib/blob/master/INSTALL#L51. After numpy is installed manually (no wheels are available on pypi), |
|
Btw, python-dateutil requires six. With this PR, parts of matplotlib will still fail if the six package is not installed. |
|
Christoph - thanks for checking - but I think six gets pulled in with the python-dateutils install, so mpl should not fail (and doesn't on travis): |
|
I agree - looking back a lot of the problems seem to be people installing from windows exe installers where they will be missing other dependencies. Thomas - I think you may be making the more general statement that it is not worth fixing problems for non-standard install mechanisms - but it seems reasonable to make failure less likely, if the cost is small, as it is here. |
|
Independent of the install dependency problem, I think this PR is useful because it makes matplotlib not vulnerable to upstream bug-fixes in six.py. I still haven't got a full understanding of when people run into trouble with the six dependency. It is possible that there is no practical way of installing matplotlib in a usable form without correctly installing the six package, but I guess I will have to go back over the previous error reports to understand whether that is the case. |
|
The issue that I think has happened is when other projects bring in an I am +0 on this. In theory, we shouldn't need it, but in practice, it would On Mon, Jun 8, 2015 at 3:33 AM, Matthew Brett [email protected]
|
|
A lot of these problems are related to the general issues with python packaging and general dysfunction of windows. I have come to the view that the way to deal with windows is to tell windows users to install one of the all-in-on distributions and push that entire mess off to companies that pay people to deal with it. At least is the case of c2fff54 I am still convinced that the problem is that other libraries are shipping their own version (or by some other mechanism the user is ending up with multiple versions of six installed and which one is found depends on what gets imported first (and this is probably related to relative vs absolute import?)) and I don't see how installing yet another version of six will help. I will not merge this and think it is a bad idea, but will not protest any more than I already have if someone else does. I think a far better solution is to make sure the documentation on how to install is super clear (particularly on windows). Once we start bundling six, we might as well bundle pytz and pyparsing and .... which leads down the road of becoming yet another packaging project which is madness. |
|
Did I persuade you that there is no way that this version of six can interact with the install for any other package? I realize that these problems should not happen, if pip was perfect, but it's not very surprising that they do happen sometimes, pip is working in a much more variable environment than all-in-one environments like Anaconda. I don't think the slippery slope argument applies here. pytz and pyparsing are substantial libraries in their own right, and the authors quite reasonably have no intention that you should ship them. Six on the other hand is specifically a code support file, and is specifically designed to be shipped with your project. |
|
I don't know enough about the guts of the import process to be sure that this won't conflict. I believe we will always get the version we think, but not that every other library will always get the version they think. It is clear that this can be done wrong and mpl should be a good citizen in the community. I also find @cgohlke 's point that even with this, mpl will still be broken is six is not install where python-dateutils can see it, compelling. This PR needs feed back from other devs. |
|
Python will treat At the moment mpl is not as good a citizen as it can be, through no fault of its own, in that it can run into problems with other installs, and this PR would improve that. six is designed to be used this way, so the more of us that do that, the fewer problems we are likely to have. |
|
Indeed, the need for six for python-dateutils would severely limit the There was a time that I thought I fully understood the import process, but On Fri, Jun 12, 2015 at 3:31 PM, Thomas A Caswell [email protected]
|
|
Given that the project itself mentions the possibility of including the code in the source, I think it's fine to do so. I also don't see huge benefits to getting the latest version of a compatibility layer; either matplotlib works on both Python 2 and 3, or it doesn't. I haven't paid enough attention to import/windows problems to evaluate benefits, but I don't see any downsides. |
|
Merged with 8fe495a. |
|
Packagers will not like bundled libraries, so is there an official method sanctioned for removing six? |
|
No, not that I know of. That would defeat the purpose of bundling six, which we are doing, somewhat reluctantly, as an exception to our usual pattern. I would hope that packagers would respect this and leave it alone. If this is not the case, then I would advocate that we revert this PR. Overall, I lean toward @tacaswell's view of it. |
|
As I said up in #4501 (comment) - several other big libraries ship six. It's not really a package, it's (deliberately) a single Python file, intended for shipping with other projects. So, the packager would have to be unusually pedantic to object in this case I think. |
|
I think the key distinction here is that what package maintainers hate is when a package installs other packages as part of the install process, possibly causing conflicts with existing installs of that package. What we are doing and simply including the source of six within our codebase. It is accessible only from within our namespace, and it looks like any other part of matplotlib. |
|
A bundled library is bundled whether or not it conflicts with existing ones. The argument could be made that Of the three examples given above:
The shim in scikit-learn is also used in Astropy (where it originated) and VisPy. |
|
Thanks for the clarifications. I didn't know there was an explicit thing called a 'copylib', but six clearly qualifies in intent, as per the quote from the six documentation at the top of the PR. I argued above that upgrading six at the whim of the six packager is a bad idea. For some background on why this level of package splitting is a bad idea in general: http://vagabond.github.io/rants/2013/06/21/z_packagers-dont-know-best/ So I guess the three options are :
I think 2 is a terrible idea, and I have a vague preference for 3 over 1, but I won't be offended either way. |
|
I am not at all convinced by those rants with regards to |
|
Sure - those links were probably distracting from the particular case here, I'm sorry for that. |
Six seems to be the external dependency that is most likely to cause problems,
and it is a small standalone .py file that is designed for projects to ship in
their source tree.
Shipping has the following advantages:
is possible for six to change upstream in pypi and break matplotlib
installs, requiring a new mpl release.
It does mean that we don't get the lastest six, but I believe this is an
advantage for the reason above. Now we are so far into the Python 3 era, six
should be rather stable.
Projects like Debian can be aggressive about separating dependencies, but in
this case, I believe this would be severe overkill - six is specifically
designed for shipping inside other projects. Quoting from:
http://pythonhosted.org/six/
"six consists of only one Python file, so it is painless to copy into a
project."