mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-12-03 15:04:08 +03:00
Add support for Python 3.13 (#9527)
* Add support for Python 3.13 * Fix extracting tox env with -dev Python versions * Fix view description inspection in Python 3.13 Python 3.13 introduced docstrings for None: https://github.com/python/cpython/pull/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.
This commit is contained in:
parent
a59aa2dfe1
commit
b25028ac8f
3
.github/workflows/main.yml
vendored
3
.github/workflows/main.yml
vendored
|
@ -19,6 +19,7 @@ jobs:
|
|||
- '3.10'
|
||||
- '3.11'
|
||||
- '3.12'
|
||||
- '3.13-dev'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
@ -36,7 +37,7 @@ jobs:
|
|||
run: python -m pip install --upgrade codecov tox
|
||||
|
||||
- name: Run tox targets for ${{ matrix.python-version }}
|
||||
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .)
|
||||
run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d . | cut -f 1 -d '-')
|
||||
|
||||
- name: Run extra tox targets
|
||||
if: ${{ matrix.python-version == '3.9' }}
|
||||
|
|
|
@ -88,7 +88,7 @@ continued development by **[signing up for a paid plan][funding]**.
|
|||
REST framework requires the following:
|
||||
|
||||
* Django (4.2, 5.0, 5.1)
|
||||
* Python (3.8, 3.9, 3.10, 3.11, 3.12)
|
||||
* Python (3.8, 3.9, 3.10, 3.11, 3.12, 3.13)
|
||||
|
||||
We **highly recommend** and only officially support the latest patch release of
|
||||
each Python and Django series.
|
||||
|
|
|
@ -79,8 +79,9 @@ class ViewInspector:
|
|||
view = self.view
|
||||
|
||||
method_name = getattr(view, 'action', method.lower())
|
||||
method_docstring = getattr(view, method_name, None).__doc__
|
||||
if method_docstring:
|
||||
method_func = getattr(view, method_name, None)
|
||||
method_docstring = method_func.__doc__
|
||||
if method_func and method_docstring:
|
||||
# An explicit docstring on the method or action.
|
||||
return self._get_description_section(view, method.lower(), formatting.dedent(smart_str(method_docstring)))
|
||||
else:
|
||||
|
|
1
setup.py
1
setup.py
|
@ -102,6 +102,7 @@ setup(
|
|||
'Programming Language :: Python :: 3.10',
|
||||
'Programming Language :: Python :: 3.11',
|
||||
'Programming Language :: Python :: 3.12',
|
||||
'Programming Language :: Python :: 3.13',
|
||||
'Programming Language :: Python :: 3 :: Only',
|
||||
'Topic :: Internet :: WWW/HTTP',
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue
Block a user