toga icon indicating copy to clipboard operation
toga copied to clipboard

Version inconsistency? python 3.8 vs 3.9?

Open th3w1zard1 opened this issue 1 year ago • 3 comments

Describe the bug

pre-commit is failing with the following error:

(.venv) PS C:\GitHub\toga> pre-commit run    
[INFO] Installing environment for https://github.com/asottile/pyupgrade.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('C:\\Users\\boden\\.cache\\pre-commit\\repo3thdqgvs\\py_env-python3.8\\Scripts\\python.EXE', '-mpip', 'install', '.')
return code: 1
stdout:
    Processing c:\users\boden\.cache\pre-commit\repo3thdqgvs
      Preparing metadata (setup.py): started
      Preparing metadata (setup.py): finished with status 'done'
    Collecting tokenize-rt>=5.2.0 (from pyupgrade==3.17.0)
      Using cached tokenize_rt-6.0.0-py2.py3-none-any.whl.metadata (4.1 kB)
    INFO: pip is looking at multiple versions of pyupgrade to determine which version is compatible with other requirements. This could take a while.
stderr:
    ERROR: Package 'pyupgrade' requires a different Python: 3.8.10 not in '>=3.9'
Check the log at C:\Users\boden\.cache\pre-commit\pre-commit.log

however toga documentation clearly states it should support 3.8? image https://github.com/beeware/toga#minimum-requirements

Expected behavior

pre-commit runs successfully, without complaining about my python version

Environment

  • Windows 10 x64
  • Python version: Python 3.8.10 (also happens on 3.8.18)
  • Software versions:
    • Toga: master

Logs

(.venv) PS C:\GitHub\toga> pre-commit run    
[INFO] Installing environment for https://github.com/asottile/pyupgrade.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('C:\\Users\\boden\\.cache\\pre-commit\\repo3thdqgvs\\py_env-python3.8\\Scripts\\python.EXE', '-mpip', 'install', '.')
return code: 1
stdout:
    Processing c:\users\boden\.cache\pre-commit\repo3thdqgvs
      Preparing metadata (setup.py): started
      Preparing metadata (setup.py): finished with status 'done'
    Collecting tokenize-rt>=5.2.0 (from pyupgrade==3.17.0)
      Using cached tokenize_rt-6.0.0-py2.py3-none-any.whl.metadata (4.1 kB)
    INFO: pip is looking at multiple versions of pyupgrade to determine which version is compatible with other requirements. This could take a while.
stderr:
    ERROR: Package 'pyupgrade' requires a different Python: 3.8.10 not in '>=3.9'
Check the log at C:\Users\boden\.cache\pre-commit\pre-commit.log

Additional context

Putting all this information together I'm understanding that Toga contributors are required to have python 3.9, however if I'm testing and working around python 3.8 limitations, am I expected to test in 3.8, and then test again in 3.9, running pre-commit, before contributing a solution??

th3w1zard1 avatar Aug 30 '24 05:08 th3w1zard1

Thanks for the report, and apologies for the confusion around this.

Right now, Toga needs to be tested on Python 3.8; but that doesn't mean pre-commit needs to be run on Python 3.8. It looks like one of the recent releases of pre-commit has dropped Python 3.8 support; as a result, the pre-commit checks can't currently be run in a Python 3.8 environment

So - at least for the moment, the virtual environment where you perform your commits (or run pre-commit) needs to be Python 3.9 or later. However, you can use this Python3.9 environment to run tox -e py38, which will peform tests in the 3.8 environment.

That said - Toga's support for Python 3.8 support in Toga is not long for this world - we'll be dropping it before the end of October when 3.8 hits EOL.

I'll leave this ticket open as a guide for others; the "fix" is to finalise the deprecation of Python 3.8 in Toga.

freakboy3742 avatar Aug 30 '24 05:08 freakboy3742

Ah that's too bad, I wasn't aware it was hitting EOL so soon. FWIW I believe Python 3.8 is the last python version supported on windows 7.

th3w1zard1 avatar Aug 30 '24 05:08 th3w1zard1

That's a bit of a moot point from Toga's perspective, as Windows 7 is also EOL, and Toga doesn't support it.

freakboy3742 avatar Aug 30 '24 05:08 freakboy3742

Fixed in #2888.

mhsmith avatar Feb 04 '25 13:02 mhsmith