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

Add support for Python 3.13 #9527

Merged
merged 3 commits into from
Sep 11, 2024
Merged

Add support for Python 3.13 #9527

merged 3 commits into from
Sep 11, 2024

Conversation

browniebroke
Copy link
Contributor

@browniebroke browniebroke commented Sep 10, 2024

Description

  • Add Python 3.13-dev to the CI
  • Declare support in the docs and in package metadata
  • Fix issue(s)

Issues found

1. Fix view description inspection

Python 3.13 introduced docstrings for the None singletong: python/cpython#117813

In Python 3.12, this is an empty string:

 ➜ python3.12
Python 3.12.6 (main, Sep 10 2024, 19:06:17) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> d = None
>>> d.__doc__
>>>

In Python 3.13, it's no longer empty:

 ➜ python3.13
Python 3.13.0rc2+ (heads/3.13:660baa1, Sep 10 2024, 18:57:50) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> d = None
>>> d.__doc__
'The type of the None singleton.'
>>>

The fix: added a check in the inspector that get the view description out the view function docstring to catch this edge case.

Python 3.13 introduced docstrings for None: python/cpython#117813

In Python 3.12, this is an empty string:

```
 ➜ python3.12
Python 3.12.6 (main, Sep 10 2024, 19:06:17) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> d = None
>>> d.__doc__
>>>
```

In Python 3.13, it's no longer empty:

```
 ➜ python3.13
Python 3.13.0rc2+ (heads/3.13:660baa1, Sep 10 2024, 18:57:50) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> d = None
>>> d.__doc__
'The type of the None singleton.'
>>>
```

Adding a check in the inspector that get the view description out the view function docstring to catch this edge case.
@browniebroke browniebroke marked this pull request as ready for review September 10, 2024 20:36
@@ -4,6 +4,7 @@ envlist =
{py310}-{django42,django50,django51,djangomain}
{py311}-{django42,django50,django51,djangomain}
{py312}-{django42,django50,django51,djangomain}
{py313}-{django51,djangomain}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python 3.13 will be supported only by Django 5.1 and above: https://forum.djangoproject.com/t/backport-python-3-13-support-in-django-5-0/34671/2

@auvipy auvipy merged commit b25028a into encode:master Sep 11, 2024
8 checks passed
@browniebroke browniebroke deleted the python-3.13 branch September 11, 2024 11:25
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