Description
Prompted by #287, I'd propose to drop big parts of pylib in a (hopefully more or less final) py 2.0 release.
Clearly nobody is interested in maintaining pylib, the current situation seems to be that a couple of pytest maintainers keep it on life-support. While we already did a lot of work to get rid of it in pytest, this is still an ongoing process.
However, pytest only uses py.path
.
Everything else in pylib is being used by an small number of projects. Some of the submodules are both high-risk and almost zero-usage (py.path.svn*
, looking at you!). Others have some real-world usage, but at some point, we should probably start deprecating those modules at least, so people can start looking for alternatives (given that pylib probably will cease to be maintained entirely after pytest is split off).
Thus, my proposal would be:
- Either vendoring
py.path
in pytest (probably going to open a separate issue in the pytest repo for this), and then deprecating pylib in it's entirety, thus archiving this repository after dropping thepy
dependency inpytest
. - Or dropping big parts of
py
(anything where we can't seem to find anything significant usage at the least, or perhaps even anything exceptpy.path
). This is what this issue will be about.
I used Sourcegraph to try and get an overview over how the remaining parts of pylib are used. Here's what I found:
py.code
Integrated into pytest with pytest 2.9.0 back in early 2016.
There's a handful of remaining real-world usage (~30 results). The most striking one is probably Intellij/PyDev monkeypatching it, but that does already account for the new _pytest._code
location anyways. Other than that I can see around 10 projects using it. Only 2 (schevo, pymtl3) seem to be outside of testsuites. The rest are testsuites doing things like their own pytest.raises
, which would probably be better off importing from pytest._code
instead.
My verdict: +0.5 for dropping
py.error
Used in a couple of places (166 results), mostly out of pytest. From what I can see, mostly used in conjunction with py.path
.
Superseded by more fine-grained OSError
exceptions in Python 3. Sadly, py.path.local
raises its own exceptions rather than those...
My verdict: -0.5 for dropping, should be kept as long as we keep py.path
around for pytest. Thankfully, it's comparatively small and simple.
py.std
Deprecated in 2017, still some usage, but from what I can tell, mostly in some old PyPy forks or something?
My verdict: Maybe needs some more investigation, but +1 for dropping, given it was deprecated before.
py.process
Imported in a couple of places. Funnily enough, the 3 or 4 projects I actually checked imported it, but never used it...
Maybe this happened due to some "automatic import" IDE feature for typo'd variables?
My verdict: +1 for dropping
py.apipkg
Zero usage. Probably needs to be kept for pylib itself, but at least not exposed publicly.
py.iniconfig
Split into separate project for pytest 6 in 2020.
Still used in tox unfortunately, 1 other usage in tox-factor.
My verdict: Probably wouldn't drop it right now, just because it's used in tox. We should coordinate with them to switch over to the split-off iniconfig
, however. Maybe also find a way to raise deprecation warnings.
py.path.local
Obviously keep. The only reason pylib is still around really...
py.path.svnwc
, py.path.svnurl
, py.path.SvnAuth
The whole reason I'm opening this issue, see #287 and #256. Complex, high-risk, and just not worth any of the trouble.
Also, unused outside of what seems like some PyPy development scripts, which are probably unused themselves, given that PyPy switched to Mercurial 12 years ago.
My verdict: Burn it with fire.
py.builtin
Used in a surprisingly high number of places, including devpi and pytest plugins.
Probably mostly from "Python 2 support" times, but at the same time, it seems to be a lot of code churn for a rather simple module
My verdict: -0.5 for removing it. Maybe find a way to raise deprecation warnings first.
py.io
Mostly used for TerminalWriter
in various projects from what it seems.
My verdict: -1 for removing it, as migration is probably more painful than e.g. for py.builtin
. Might want to raise deprecation warnings telling people to use rich
or something.
py.xml
Apparently used in various projects, especially for HTML generation.
While it's high-risk, it's also arguably the most-used part of pylib (other than py.path.local
and perhaps TerminalWriter
). Maybe raise deprecation warnings? What alternatives are there?
py.log
Used in pypy and xdist from what I can see.
As above: Probably deprecate, but do not remove.
That leaves us with:
py.code
: Drop, affected pytest monkeypatching code can switch topytest._code
py.error
: Keep, useful forpy.path
py.std
: Drop, long deprecated and moving away is trivialpy.process
: Drop (or possibly deprecate?)py.apipkg
: Drop / make privatepy.iniconfig
: Probably deprecate until tox moved awaypy.path.local
: Keep obviouslypy.path.svnwc
,py.path.svnurl
,py.path.SvnAuth
: Drop and kill it with firepy.builtin
: Probably keep, maybe deprecate?py.io
: Probably keep, maybe deprecate?py.xml
: Probably keep, maybe deprecate?py.log
: Probably keep, maybe deprecate?
@RonnyPfannschmidt @bluetech @nicoddemus what are your thoughts?