Skip to content

Support Python 3.13 and drop Python 3.9 #157

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

Closed
2 tasks done
tyralla opened this issue Oct 22, 2024 · 8 comments
Closed
2 tasks done

Support Python 3.13 and drop Python 3.9 #157

tyralla opened this issue Oct 22, 2024 · 8 comments

Comments

@tyralla
Copy link
Member

tyralla commented Oct 22, 2024

I checked our dependencies, and we still have to wait for suitable NetCDF4 binaries (but they are already in preparation, NetCDF4 issue 1370). Hence, the following to-do list is only preliminary:

@tyralla
Copy link
Member Author

tyralla commented Oct 23, 2024

Proper NetCDF4 wheels are now available. However, we must wait for Python 3.13.1 because of the bug reported here.

@tyralla
Copy link
Member Author

tyralla commented Oct 24, 2024

I hoped that PEP 667 would allow us to manipulate the (optimised) namespaces of functions, too, so that patterns like this became possible:

from hydpy.models.hland_96 import *

simulationstep("1h")
parameterstep("1d")

def add_rconcmodel(main):
    with main.add_rconcmodel_v1("rconc_uh"):
        uh("triangle", tb=0.36728)

add_rconcmodel(model)

The error under Python 3.12 is: NameError: name 'uh' is not defined.

The (current) error under Python 3.13.0 is: AttributeError: 'FrameLocalsProxy' object has no attribute 'pop'.

The latter message will likely change under Python 3.13.1 due to PR 125616.

However, adding and removing names from optimised scopes will still not be supported, so everything will stay as is from the user's perspective. (We might need to adapt HydPy's source code, but I expect at most minor changes.).

@tyralla
Copy link
Member Author

tyralla commented Oct 24, 2024

I completed the above two tasks and a little more refurbishing (with the help of PyUpdater) and pushed everything into the branch feature/python_3.13.

That's it for now. I will wait for Python 3.13.1, which can apparently be expected for December.

@tyralla
Copy link
Member Author

tyralla commented Dec 4, 2024

@tyralla
Copy link
Member Author

tyralla commented Dec 6, 2024

Hopefully, Python 3.13.1 is now well-supported. Unfortunately, it seems not to be installed on Travis-CI so far. Additionally, on AppVeyor, we get the following strange error:

Finished generating code
Traceback (most recent call last):
  File "C:\projects\hydpy-hep1s\prepare_build.py", line 258, in <module>
    main()  # pylint: disable=no-value-for-parameter
    ~~~~^^
  File "C:\Python313-x64\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Python313-x64\Lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "C:\Python313-x64\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python313-x64\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\projects\hydpy-hep1s\prepare_build.py", line 251, in main
    _convert_interfaces(fast_cython=fast_cython, profile_cython=profile_cython)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\projects\hydpy-hep1s\prepare_build.py", line 91, in _convert_interfaces
    from hydpy import config
  File "C:\projects\hydpy-hep1s\hydpy\__init__.py", line 21, in <module>
    from hydpy.core import pubtools
  File "C:\projects\hydpy-hep1s\hydpy\core\pubtools.py", line 10, in <module>
    from hydpy.core import exceptiontools
  File "C:\projects\hydpy-hep1s\hydpy\core\exceptiontools.py", line 10, in <module>
    from hydpy.core import objecttools
  File "C:\projects\hydpy-hep1s\hydpy\core\objecttools.py", line 18, in <module>
    import black
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 921, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 819, in module_from_spec
  File "<frozen importlib._bootstrap>", line 797, in _init_module_attrs
SystemError: extension module 'black' is already cached
Command exited with code 1

So we better wait a little longer...

@tyralla
Copy link
Member Author

tyralla commented Dec 14, 2024

@holgeralbert: Travis-CI still uses Python 3.13.0 and AppVeyor an older release candidate (if I am not mistaken). Is there something we can do? (select another image, create a custom one, or so)

@tyralla
Copy link
Member Author

tyralla commented Jan 6, 2025

No progress on AppVeyor and Travis-CI, but at least an explanation for the extension module 'black' is already cached error: psf/black/issues/4544

@tyralla
Copy link
Member Author

tyralla commented Jan 7, 2025

The AppVeyor maintainers already responded and fixed the problem. So, at least on AppVeyor, we can run our test suit with Python 3.13 and build the corresponding wheels for Windows. Using Python 3.12. instead of 3.13 on Travis CI should make no relevant difference because, besides testing, this job is only responsible for creating and deploying the online documentation.

@tyralla tyralla closed this as completed Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant