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

common/reloader: import reload from importlib (Python 3.12 compatibility) #2093

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

Bastian-Krause
Copy link
Contributor

@Bastian-Krause Bastian-Krause commented Aug 24, 2023

The imp module is deprecated since Python 3.4 [1]. The import was added even after it was deprecated in [2]. In Python 3.12 the imp module will be removed.

Use the reload function from importlib, which is the designated replacement [1].

With #2091 and this change, crossbar master can be installed and run on Python 3.12 with:

  • numpy>=1.26.0b1
  • wsaccel @ git+https://github.com/methane/[email protected] (assuming cython>=3.0.0 is installed, tarball from pypi won't work [3])
  • AIOHTTP_NO_EXTENSIONS=1 provided for pip install, needed until aiohttp 4.0.0 is released to pypi.

[1] https://docs.python.org/3.11/library/imp.html
[2] 21910b0
[3] methane/wsaccel#30

The imp module is deprecated since Python 3.4 [1]. The import was added
even after it was deprecated in [2]. In Python 3.12 the imp module will
be removed.

Use the reload function from importlib, which is the designated
replacement [1].

With crossbario#2091 and this change, crossbar can be installed and run on
Python 3.12 with:
- numpy>=1.26.0b1
- wsaccel @ git+https://github.com/methane/[email protected] (assuming
  cython>=3.0.0 is installed, tarball from pypi won't work [3])

[1] https://docs.python.org/3.11/library/imp.html
[2] crossbario@21910b0
[3] methane/wsaccel#30
@oberstet
Copy link
Contributor

thanks a lot for the detailed infos in the PR!

so just to be sure: crossbar supports python 3.7+ (

"Programming Language :: Python :: 3.7",
), this change is expected to just work, and hence shouldn't break stuff, right?

if so, I'd just merge it - the CI won't run on GH because of #2092

@Bastian-Krause
Copy link
Contributor Author

so just to be sure: crossbar supports python 3.7+ (

"Programming Language :: Python :: 3.7",

), this change is expected to just work, and hence shouldn't break stuff, right?

Right, importlib.reload is part of the Python standard library since 3.4. No breakage expected.

if so, I'd just merge it - the CI won't run on GH because of #2092

Alright.

@oberstet oberstet merged commit 0089c1e into crossbario:master Aug 24, 2023
2 of 7 checks passed
@Bastian-Krause Bastian-Krause deleted the bst/reloader-importlib branch August 24, 2023 15:50
@threexc
Copy link

threexc commented Dec 12, 2023

@oberstet do you know if there will be a new release soon containing these changes? Fedora 39 is having issues, as will any other distros that start shipping Python 3.12.

@oberstet
Copy link
Contributor

@threexc here is the long explanation: there definitely will be a new release, and Python 3.12 will definitely be fully supported of course. as will be PyPy. and ARM64. and development will continue (e.g. I'm also involved in WAMP spec level work and new and polished things there).

the main work tbd here isn't in the unmerged PRs, but in again fixing the CI. the reason why this has turned out to be a significant source of work over the years is: the amount and breadth of dependencies this package includes, the fact that it is quite a non-trivial package, and the deficiencies in Python dependency management in general (which is IMO one of the biggest language/run-time level issues remaining after the move to Unicode and async) in the ecosystem, but that's only a personal opinion and side note.

the latter has over the years quite disillusioned myself in any hope that someone (eg myself) would be able to fix all this once and for all in whatever big effort required. once and for all. If I would believe in such a possibility, I might get my act and motivation together and just do it. contrary I do know it is significant, nerve wrecking work and it will remain so. sadly I am not paid for it and unfortunately I am living in a world where I have to pay bills, so I am busy with other things that do in fact earn bucks.

at some point I will personally feel the pain and get fed up by lack of Python 3.12, and then I will fix it no matter what.
since I personally run Crossbar.io on either vanilla upstream Python source, Docker or snaps, on both x86 and ARM, I am not bound to any distro cycles though. IOW: I cannot give you a date. sorry.

Bastian-Krause pushed a commit to Bastian-Krause/labgrid that referenced this pull request Dec 13, 2023
crossbar is not compatible with Python 3.12, yet: [1] and [2] are not
part of a release. A release will probably take some more time [3][4].

Since this is the last remaining issue before we can advertise Python
3.12 support, let's mark these tests as XFAIL for now.

[1] crossbario/crossbar#2091
[2] crossbario/crossbar#2093
[3] crossbario/crossbar#2093 (comment)
[4] crossbario/crossbar#2091 (comment)

Signed-off-by: Bastian Krause <[email protected]>
Bastian-Krause added a commit to Bastian-Krause/labgrid that referenced this pull request Dec 13, 2023
crossbar is not compatible with Python 3.12, yet: [1] and [2] are not
part of a release. A release will probably take some more time [3][4].

We shouldn't advertise Python 3.12 support until that happens. But we
can make sure that everything else keeps working fine with Python 3.12
by running the test suite. A previous commit marked the failing crossbar
tests as XFAIL for 3.12.

[1] crossbario/crossbar#2091
[2] crossbario/crossbar#2093
[3] crossbario/crossbar#2093 (comment)
[4] crossbario/crossbar#2091 (comment)

Signed-off-by: Bastian Krause <[email protected]>
Bastian-Krause added a commit to Bastian-Krause/labgrid that referenced this pull request Dec 13, 2023
crossbar is not compatible with Python 3.12, yet: [1] and [2] are not
part of a release. A release will probably take some more time [3][4].

Since this is the last remaining issue before we can advertise Python
3.12 support, let's mark these tests as XFAIL for now.

[1] crossbario/crossbar#2091
[2] crossbario/crossbar#2093
[3] crossbario/crossbar#2093 (comment)
[4] crossbario/crossbar#2091 (comment)

Signed-off-by: Bastian Krause <[email protected]>
Bastian-Krause added a commit to Bastian-Krause/labgrid that referenced this pull request Dec 13, 2023
crossbar is not compatible with Python 3.12, yet: [1] and [2] are not
part of a release. A release will probably take some more time [3][4].

We shouldn't advertise Python 3.12 support until that happens. But we
can make sure that everything else keeps working fine with Python 3.12
by running the test suite. A previous commit marked the failing crossbar
tests as XFAIL for 3.12.

[1] crossbario/crossbar#2091
[2] crossbario/crossbar#2093
[3] crossbario/crossbar#2093 (comment)
[4] crossbario/crossbar#2091 (comment)

Signed-off-by: Bastian Krause <[email protected]>
Bastian-Krause added a commit to Bastian-Krause/labgrid that referenced this pull request Dec 13, 2023
crossbar is not compatible with Python 3.12, yet: [1] and [2] are not
part of a release. A release will probably take some more time [3][4].

Since this is the last remaining issue before we can advertise Python
3.12 support, let's mark these tests as XFAIL for now.

[1] crossbario/crossbar#2091
[2] crossbario/crossbar#2093
[3] crossbario/crossbar#2093 (comment)
[4] crossbario/crossbar#2091 (comment)

Signed-off-by: Bastian Krause <[email protected]>
Bastian-Krause added a commit to Bastian-Krause/labgrid that referenced this pull request Dec 13, 2023
crossbar is not compatible with Python 3.12, yet: [1] and [2] are not
part of a release. A release will probably take some more time [3][4].

We shouldn't advertise Python 3.12 support until that happens. But we
can make sure that everything else keeps working fine with Python 3.12
by running the test suite. A previous commit marked the failing crossbar
tests as XFAIL for 3.12.

[1] crossbario/crossbar#2091
[2] crossbario/crossbar#2093
[3] crossbario/crossbar#2093 (comment)
[4] crossbario/crossbar#2091 (comment)

Signed-off-by: Bastian Krause <[email protected]>
@threexc
Copy link

threexc commented Dec 13, 2023

@threexc here is the long explanation: there definitely will be a new release, and Python 3.12 will definitely be fully supported of course. as will be PyPy. and ARM64. and development will continue (e.g. I'm also involved in WAMP spec level work and new and polished things there).

the main work tbd here isn't in the unmerged PRs, but in again fixing the CI. the reason why this has turned out to be a significant source of work over the years is: the amount and breadth of dependencies this package includes, the fact that it is quite a non-trivial package, and the deficiencies in Python dependency management in general (which is IMO one of the biggest language/run-time level issues remaining after the move to Unicode and async) in the ecosystem, but that's only a personal opinion and side note.

the latter has over the years quite disillusioned myself in any hope that someone (eg myself) would be able to fix all this once and for all in whatever big effort required. once and for all. If I would believe in such a possibility, I might get my act and motivation together and just do it. contrary I do know it is significant, nerve wrecking work and it will remain so. sadly I am not paid for it and unfortunately I am living in a world where I have to pay bills, so I am busy with other things that do in fact earn bucks.

at some point I will personally feel the pain and get fed up by lack of Python 3.12, and then I will fix it no matter what. since I personally run Crossbar.io on either vanilla upstream Python source, Docker or snaps, on both x86 and ARM, I am not bound to any distro cycles though. IOW: I cannot give you a date. sorry.

No worries, thank you for the summary!

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.

3 participants