pwntools icon indicating copy to clipboard operation
pwntools copied to clipboard

Use UV as a faster pip implementation

Open Arusekk opened this issue 9 months ago • 9 comments

Closes #2490

Arusekk avatar Feb 28 '25 15:02 Arusekk

Okay: for some reason this breaks PLT emulation (so unicorn?), breaks it consistently, and only breaks it on py3.10.

Why? No idea yet.

Arusekk avatar Mar 03 '25 09:03 Arusekk

>>> import unicorn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/.venv/lib/python3.10/site-packages/unicorn/__init__.py", line 4, in <module>
    from .unicorn import Uc, ucsubclass, uc_version, uc_arch_supported, version_bind, debug, UcError, __version__
  File "/.venv/lib/python3.10/site-packages/unicorn/unicorn.py", line 14, in <module>
    from .unicorn_py3 import *
  File "/.venv/lib/python3.10/site-packages/unicorn/unicorn_py3/__init__.py", line 1, in <module>
    from .unicorn import *
  File "/.venv/lib/python3.10/site-packages/unicorn/unicorn_py3/unicorn.py", line 236, in <module>
    uclib = __load_uc_lib()
  File "/.venv/lib/python3.10/site-packages/unicorn/unicorn_py3/unicorn.py", line 123, in __load_uc_lib
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

Arusekk avatar Mar 03 '25 10:03 Arusekk

Okay, this is a thing probably on Unicorn's side: https://github.com/unicorn-engine/unicorn/pull/2122

Arusekk avatar Mar 03 '25 10:03 Arusekk

Huh?

https://github.com/astral-sh/uv/blob/83f1b8b0f13713f2413ae9b96c64da0cedcf5fb8/crates/uv/src/commands/venv.rs#L354-L365

        // Resolve the seed packages.
        let requirements = if interpreter.python_tuple() >= (3, 12) {
            vec![Requirement::from(
                uv_pep508::Requirement::from_str("pip").unwrap(),
            )]
        } else {
            // Include `setuptools` and `wheel` on Python <3.12.
            vec![
                Requirement::from(uv_pep508::Requirement::from_str("pip").unwrap()),
                Requirement::from(uv_pep508::Requirement::from_str("setuptools").unwrap()),
                Requirement::from(uv_pep508::Requirement::from_str("wheel").unwrap()),
            ]
        };

It seems venv does seed itself, but not venv-less things.

Arusekk avatar Mar 03 '25 13:03 Arusekk

Blocked: waiting for Unicorn 2.1.4.

Arusekk avatar Mar 24 '25 12:03 Arusekk

Please fix git conflicts.

cclauss avatar Nov 06 '25 08:11 cclauss

Note setup-uv@v6 brought a usability impairment (https://github.com/astral-sh/setup-uv/pull/381).

Arusekk avatar Nov 06 '25 09:11 Arusekk

Nope, still blocked, waiting for unicorn 2.1.5 (2.1.4 has broken MIPS).

Arusekk avatar Nov 06 '25 09:11 Arusekk

ModuleNotFoundError: No module named 'pkg_resources'

Some of the pkg_resources code is still available in modern setuptools. % uvx --with=unicorn python3.14 -c 'import unicorn' % uvx --with=setuptools,unicorn python3.14 -c 'import unicorn'

cclauss avatar Nov 06 '25 11:11 cclauss