-
Notifications
You must be signed in to change notification settings - Fork 105
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
Plan for dropping/deprecating submodules of py
and releasing v2.0
#288
Comments
Hi @The-Compiler, Thanks a lot for the extensive research and detailed proposal! Let me play devils advocate though: why the need to do this at all? I mean, another option is to just wait until we drop |
I see a couple of reasons:
All in all, I feel like we need to have a proper deprecation plan for pylib before we get fully rid of it, whether we want to or not. I think dropping some ~unused code and deprecating some lightly used one would be a big first step towards that. |
Hmm, I'd rather just put pylib in unmaintained state |
@RonnyPfannschmidt I don't realistically see that happen before we drop it from pytest (as until then, it likely won't prevent such situations from repeating themselves again, thus declaring pytest as "unsafe", whether we like it or not). It also seems like a questionable move without a good way to make projects like tox or devpi aware of it. One of the best tools we have to do that is deprecation warnings. |
In that case, apipkg has a own project, iniconfig as well, and time to drom/alias /deprecate As for py. Io, I'd like to eventually separate it together with terminalwriter and pytests io capture, but the time horizon for that is too large |
I see, thanks @The-Compiler. Those are compelling arguments. I think the way to go is to vendor When the time comes for pytest to drop About the other libraries, I don't see much point in dropping any of them, we should just deprecate everything except |
@nicoddemus based on the cost of py.code vendoring and the to expect breakages of the api location changes i'm strictly opposed to vendoring py.path.local , id much rather see us move the support code into a temporaryly my plugin that will eventually turn a extra dependency and finally be phased out |
my progression recommendation would be to
|
we could probably get away with vendoring and a little |
i'd prefer to keep it outside the pytest codebase if feasible |
I don't think there's much cost involved in vendoring
I agree, except with "dropping" anything: we really won't gain much by dropping stuff, given that we will just archive |
maybe I'm overlooking things, but I think we could do something like: # pytest/py/__init__.py
try:
import py.path
except ImportError:
sys.modules['py'] = sys.modules[__name__]
else:
warnings.warn(FutureWarning, 'py lib is deprecated, please remove the dependency and use `pytest.py.path` instead, or better yet pathlib blah blah')
sys.modules['pytest.py'] = py |
What we will gain is killing the noise of "security" advisories against pytest. This won't go away by deprecating things (we'd still be forced to fix it if we want people to not see security alerts for pytest). It will only go away by either dropping the If we don't do either one or the other, the problem prompting me to open this issue won't be solved. |
@nicoddemus the drop would bascially jsut add stuff like iniconfig and apipkg back to the dependency lsit instead of keeping a vendored copy |
I put together a proof of concept: pytest-dev/pytest#10396 |
OK, I agree. 👍 |
ok so I've basically got the tests passing minus flake8 / mypy complaining -- the vendor hack actually doesn't seem that terrible? (it'll use |
If the hack @asottile created goes in, we can probably just move pylib to obsolete |
re py.process - pytest-xdist depends pytest-forked which does use the module |
yep, we'll be removing |
PR open: pytest-dev/pytest-xdist#821 👍 |
FWIW, outside of pytest + plugins, I expect the biggest consumers of pylib to be other ex-hpk42-and-friends projects:
|
Regarding devpi:
|
I strongly recommend against vendoring of local path as long term solution, pytest intents to drop it as soon as possible |
…` lib - from pytest 7.2.0 changelog: pytest no longer depends on the py library...If you need other py.* modules, continue to install the deprecated py library separately, otherwise it can usually be removed as a dependency. - additional notes here pytest-dev/py#288
Starting with pytest 7.2.0(?) py.test.raises only works if py is also installed. Given pytest-dev/py#288 it is probably easiest to just use pytest directly if possible
Starting with pytest 7.2.0(?) py.test.raises only works if py is also installed. Given pytest-dev/py#288 it is probably easiest to just use pytest directly if possible
FWIW, I use py.io.StdCaptureFD to capture output from a C process launched via pybind11 which may hang. I've found nothing else that could replace it, but I'm open to exploring alternatives. I'm willing to be wrong, but I don't think rich has anything like it. |
As replacement for StdCaptureFD I'm now using this:
|
@fschulze That's all well and good if you happen to be using this for the purposes of pytest. |
I personally do not know anything that implements An option might be for someone to fork |
Can anyone tell me what |
I see this reference in the code: Line 28 in 6b21973
|
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:
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
.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 ownpytest.raises
, which would probably be better off importing frompytest._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 userich
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 perhapsTerminalWriter
). 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?
The text was updated successfully, but these errors were encountered: