Skip to content
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

Get rid of pylib #930

Open
The-Compiler opened this issue Oct 25, 2022 · 6 comments
Open

Get rid of pylib #930

The-Compiler opened this issue Oct 25, 2022 · 6 comments

Comments

@The-Compiler
Copy link

FYI, there have been various discussions in pylib recently on how to finally get rid of it (it's been in maintenance mode for a while):

Efforts to get rid of it in pytest have been going on since ~2018, and with today's v7.2.0 release, we decided to go forward by removing it and vendoring the only remaining py.path part: pytest-dev/pytest#10396

Similarly, tox has made efforts to get rid of "py" for its v4 rewrite:

After that's released at some point, I expect devpi to be the only remaining big project depending on it (other than a couple of pytest plugins). At some point, we probably will archive the py project (from what I can gather, people would love to do that immediately, actually).

I can see various usages across the codebase:

py.builtin._basestring
py.builtin._isbytes
py.builtin._istext
py.builtin._totext
py.builtin.bytes
py.builtin.print_
py.error.EBUSY
py.error.EEXIST
py.error.ENOENT
py.iniconfig.IniConfig
py.io
py.io.BytesIO
py.io.StdCaptureFD
py.io.TerminalWriter
py.io.TextIO
py.path.local
py.path.local._gethomedir
py.path.local.make_numbered_dir
py.path.local.sysfind
py.path.local.write
py.xml
py.xml.escape
py.xml.html
  • py.builtin should be easy (Python 2 support is a thing of the past, so that might be a search/replace actually)
  • py.path.local is a bit harder, but should be replaceable entirely by pathlib, and probably shutil.which for sysfind. Not sure about make_numbered_dir, pytest seems to have added its own implementation. That should also render py.error useless.
  • py.iniconfig was split into a standalone project for pytest 6 (mid-2020)
  • Some parts of py.io are probably Python 2 compat.
  • py.io.StdCaptureFD seems to be used in tests. Maybe consider private-importing from pytest instead?
  • py.io.TerminalWriter is probably the hardest part of it all... maybe rich instead or something?
  • py.xml and py.xml.html I have no idea about. Probably needs an alternative library if you're building HTML with it.
@fschulze
Copy link
Contributor

fschulze commented Oct 25, 2022 via email

fschulze added a commit to fschulze/devpi that referenced this issue Oct 26, 2022
fschulze added a commit to fschulze/devpi that referenced this issue Oct 26, 2022
@The-Compiler
Copy link
Author

I think py.path.local will proba be the hardest, as it is used everywhere and I also like it.

Out of curiosity, what do you like about it over pathlib.Path? For almost everything I've used (though admittedly only in a testsuite, via pytest), I've found an easy 1:1 pathlib replacement. Given that pathlib is in the stdlib, and far more likely to be known by contributors already, I find it hard to find a good argument for keeping py.path.local around (other than the one-time cost of migrating, which I realize isn't exactly small - I still haven't fully gotten rid of it in the qutebrowser testsuite either!).

fschulze added a commit to fschulze/devpi that referenced this issue Nov 5, 2022
fschulze added a commit to fschulze/devpi that referenced this issue Jun 20, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Jun 20, 2023
@fschulze
Copy link
Contributor

I did some more work on this:

  • I vendored the coloring parts of TerminalWriter into devpi-common.
  • for py.error there are replacement exceptions available since Python 3.3 (ENOENT=FileNotFoundError, EEXIST=FileExistsError), but I'm not sure about EBUSY, which seems to be Windows only
  • As replacement for StdCaptureFD I'm now using this:
from _pytest import capture

        cap = capture.MultiCapture(
            in_=capture.FDCapture(0),
            out=capture.FDCapture(1),
            err=capture.FDCapture(2))

fschulze added a commit to fschulze/devpi that referenced this issue Aug 30, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 30, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 30, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 30, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 30, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 30, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 31, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 31, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 31, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 31, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 31, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 31, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 31, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Aug 31, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Oct 9, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Oct 9, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Oct 9, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Oct 11, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Oct 11, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Oct 11, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Oct 11, 2023
fschulze added a commit to fschulze/devpi that referenced this issue Oct 11, 2023
@fschulze
Copy link
Contributor

I released devpi-client and devpi-common without pylib dependencies. The remaining use of pylib is now in devpi-server and devpi-web and those will be fixed for the next major releases which still need some unrelated work before they can be released.

markmcclain pushed a commit to markmcclain/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to markmcclain/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to markmcclain/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to markmcclain/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to markmcclain/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to markmcclain/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to markmcclain/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to aristanetworks/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to aristanetworks/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to aristanetworks/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to aristanetworks/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to aristanetworks/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to aristanetworks/devpi that referenced this issue Jan 8, 2024
markmcclain pushed a commit to aristanetworks/devpi that referenced this issue Jan 8, 2024
@ofek
Copy link

ofek commented Jan 23, 2024

This is affecting us because we are now using the server as a mirror and py has a CVE which is flagging our dependency scanners:

Name Version ID Fix Versions Description
py 1.11.0 PYSEC-2022-42969 The py library through 1.11.0 for Python allows remote attackers to conduct a ReDoS (Regular expression Denial of Service) attack via a Subversion repository with crafted info data, because the InfoSvnCommand argument is mishandled.

Is there an ETA for the next release?

@fschulze
Copy link
Contributor

That part of py isn't used by devpi, so this isn't relevant in your case. The remaining usage will be removed with the next major release, but there is no ETA for that yet.

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

No branches or pull requests

3 participants