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

Drop Python 2.7 support / Require Python 3.10 #2519

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

peace-maker
Copy link
Member

Only test on Python 3 and bump minimal required Python version to 3.10. Stop testing on Python 2.7.

The support plan for Python versions looks like it's worth to support 3.10 if we're dropping support for Python versions which reached end-of-life anyways. Is 3.10 ok or should we support lower Python 3 versions? If we keep the required-python pyproject.toml field in sync, older Python versions should just install an older pwntools version automatically.

And so it begins @Arusekk

Refs #2495

Only test on Python 3 and bump minimal required python version to 3.10.
@peace-maker peace-maker added this to the 5.0.0 milestone Jan 15, 2025
@peace-maker peace-maker requested a review from Arusekk January 15, 2025 22:05
@Arusekk
Copy link
Member

Arusekk commented Jan 17, 2025

I guess we can use 3.4 for the machine-readable requirements, since we're just dropping these select workarounds. But we can state 3.10 in readme, that's okay. (3.10 supported vs 3.4 required)

@peace-maker
Copy link
Member Author

We'd need to test on 3.4 though since we might start using newer Python3 features now like f-strings or type-hints to make sure we stay compatible. Otherwise we'll drift away from 3.4 unnoticed. We can postpone that decision once we are at the point of wanting to use newer features that aren't backported of course. Do you have other reasons to stay at 3.4 or some other earlier Python3 version?

vermin can help to monitor our minimum required version. Right now we're already requiring 3.5 at minimum on some code paths:

vermin --target=3.4 --exclude-regex 'pwnlib/data' -vvv pwnlib | grep '3\
.5'
2.7, 3.5     /home/jannik/tools/pwntools/pwnlib/fmtstr.py
  L946: bytes `%` formatting or `str` synonym requires 2.6, 3.5
  L980: bytes `%` formatting or `str` synonym requires 2.6, 3.5
!2, 3.5      /home/jannik/tools/pwntools/pwnlib/gdb.py
  L346: bytes `%` formatting or `str` synonym requires 2.6, 3.5
  L348: bytes `%` formatting or `str` synonym requires 2.6, 3.5
  L1130: bytes `%` formatting or `str` synonym requires 2.6, 3.5
2.6, 3.5     /home/jannik/tools/pwntools/pwnlib/protocols/adb/__init__.py
  L48: bytes `%` formatting or `str` synonym requires 2.6, 3.5
  L534: bytes `%` formatting or `str` synonym requires 2.6, 3.5
2.7, 3.5     /home/jannik/tools/pwntools/pwnlib/tubes/ssh.py
  L89: bytes `%` formatting or `str` synonym requires 2.6, 3.5
  L1482: bytes `%` formatting or `str` synonym requires 2.6, 3.5
  L1594: bytes `%` formatting or `str` synonym requires 2.6, 3.5
!2, 3.5      /home/jannik/tools/pwntools/pwnlib/util/misc.py
  L350: 'subprocess.run' member requires !2, 3.5
2.6, 3.5     /home/jannik/tools/pwntools/pwnlib/util/sh_string.py
  L488: bytes `%` formatting or `str` synonym requires 2.6, 3.5
Minimum required versions: 3.5

@Arusekk
Copy link
Member

Arusekk commented Jan 17, 2025

Sure, we can do 3.8 as well (introduced some major parts of type hints)

@peace-maker
Copy link
Member Author

After some discussion on Discord the suggestion was setting the required version to install as low as possible and only update the minimum version once we really want to use some language feature. I'd be fine with starting with 3.4 and see if that helps cleanup the code at all. But state 3.4 as the minimum required version in the docs too so contributers know what to expect.

We should setup vermin in CI to monitor when we change our target version. I can fix those few occurences of 3.5 features for now.

@peace-maker
Copy link
Member Author

Hm, it wasn't possible to install pwntools on Python < 3.6 since version 4.11 for over a year now due to requiring unix_ar and nobody complained. Download stats on pypi show some usage on Python 3.4 and 3.5 though so I'd assume an older version is pinned there. Maybe 3.6 is a compromise to start on then? We'll have to see if this really helps with the maintenance work since it's EOL too for 3 years -.-
grafik

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

Successfully merging this pull request may close these issues.

2 participants