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

Support for Python 3.12 #2836

Closed
1 task done
robd003 opened this issue Oct 13, 2023 · 15 comments · Fixed by #2870
Closed
1 task done

Support for Python 3.12 #2836

robd003 opened this issue Oct 13, 2023 · 15 comments · Fixed by #2870

Comments

@robd003
Copy link
Contributor

robd003 commented Oct 13, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

Currently unable to use Sanic with Python 3.12

Describe the solution you'd like

uvloop 0.18.0 was just released and supports Python 3.12

It'd be great to get support for Python 3.12 on the next release of Sanic along with the 2022.12 LTS release

Additional context

No response

@Tronic
Copy link
Member

Tronic commented Oct 14, 2023

Making this the tracking issue for Python 3.12 compatibility. Please post any incompatibilities found here. We probably need to update some dependencies, and add 3.12 testing to our CI. Rarely have any Python updates (other than asyncio loop argument removal) prompted for changes in Sanic itself.

@iAndriy
Copy link
Contributor

iAndriy commented Dec 5, 2023

@ahopkins Is this feature something what is okay to pick up into progress by someone whom isn't part of the core maintainers group ?

@Tronic
Copy link
Member

Tronic commented Dec 6, 2023

@iAndriy Feel free to hack it, PRs from anyone are welcome here! And core developers are quite overloaded already =)

@ahopkins
Copy link
Member

ahopkins commented Dec 6, 2023

A good start would be to just add to the CI, open a PR, mark it as draft and list out all the errors you encountered.

First and foremost add it to tox.ini and run the tests.

tox -e py312

@iAndriy
Copy link
Contributor

iAndriy commented Dec 6, 2023

A good start would be to just add to the CI, open a PR, mark it as draft and list out all the errors you encountered.

First and foremost add it to tox.ini and run the tests.

tox -e py312

@ahopkins thanks for suggestion

iAndriy added a commit to iAndriy/sanic that referenced this issue Dec 6, 2023
iAndriy added a commit to iAndriy/sanic that referenced this issue Dec 7, 2023
iAndriy added a commit to iAndriy/sanic that referenced this issue Dec 7, 2023
iAndriy added a commit to iAndriy/sanic that referenced this issue Dec 7, 2023
@iAndriy
Copy link
Contributor

iAndriy commented Dec 7, 2023

Some of upstreams libraries used by sanic doesn't support Python 3.12:

The failure of test suite for py312 in #2870 is related to errors caused from by CIMultiDict

@iAndriy
Copy link
Contributor

iAndriy commented Dec 7, 2023

@ahopkins @Tronic Looks like we need to wait a bit, so upstream libraries would catch up with latest python.
Related MR: #2870, see test execution for python 3.12 + comment above for more details.
How do you usually overcome such use cases ?

@ahopkins
Copy link
Member

ahopkins commented Dec 7, 2023

This is usually what prevents the upgrade for us.Usually it's uvloop we have to wait for.

We can ping @aaugustin to ask when he plans to add 3.12 to websockets.

@aaugustin
Copy link
Contributor

websockets works on Python 3.12 without any code changes. There's even Python 3.12 wheels for websockets 12.0 on PyPI.

Only the Python 3.12 trove classifier is missing on PyPI. I will add it; however, I believe this metadata is indicative and doesn't affect whether pip & friends will accept to install a library. This shouldn't prevent you from moving forwards.

If I'm missing something here and the missing classifier is actually a blocker, then I can do a quick 12.0.1 release just to fix that!

@ahopkins
Copy link
Member

Thanks @aaugustin! @iAndriy can you take a look? I don't think the lack of classifier would hold us back.

@iAndriy
Copy link
Contributor

iAndriy commented Dec 14, 2023

@aaugustin Thanks for getting back and closing this metadata thing.

@ahopkins
Yeah, let me circle back on this one.

@iAndriy
Copy link
Contributor

iAndriy commented Dec 17, 2023

@ahopkins I've updated MR, issues seems to be in the CIMultiDict call flow. For python3.12 the following call results in Segmentation Fault ( see screenshot), nonetheless it works if no kwargs used.
Screenshot 2023-12-17 at 17 12 45

@JoeriHermans
Copy link

Experiencing the same issue as @iAndriy Through websocket endpoints though.

iAndriy added a commit to iAndriy/sanic that referenced this issue Dec 17, 2023
@iAndriy
Copy link
Contributor

iAndriy commented Dec 17, 2023

Relevant issue within multidict: aio-libs/multidict#898

  • no error present when kwargs aren't used.

@JoeriHermans It seems to work without kwargs passing.

iAndriy added a commit to iAndriy/sanic that referenced this issue Dec 17, 2023
ahopkins pushed a commit that referenced this issue Dec 21, 2023
* Support for Python 3.12 #2836

* Extended test suite to meet required coverage.
@wieczorek1990
Copy link
Contributor

wieczorek1990 commented Jun 24, 2024

Bump.
Please continue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants