chore: python3.13 support (#28624)

* chore: python3.13 support

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* chore: bump pydantic

```
  error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)
        = help: please check if an updated version of PyO3 is available. Current version: 0.21.2
        = help: set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 to suppress this check and build anyway using the stable ABI
```

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* chore: bump uuid-utils

https://katb.in/ahaqabugefo

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* chore: bump RestrictedPython

7.4 has support for py3.13
https://restrictedpython.readthedocs.io/en/latest/changes.html#id1

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* fix(deprecation_dumpster): import functools uncondtionally

Used here: 60f0b1d5c7/frappe/deprecation_dumpster.py (L177C10-L177C19)

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* chore(docref): improve error message

* fix: error on unability to hash; TypeError expected

* fix: migrate from 3.10 onwards

---------

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Co-authored-by: David <dgx.arnold@gmail.com>
This commit is contained in:
Akhil Narang 2024-12-04 21:05:06 +05:30 committed by GitHub
parent 5c4dc84bad
commit a390992408
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 28 additions and 22 deletions

View file

@ -74,7 +74,7 @@ jobs:
source ${GITHUB_WORKSPACE}/env/bin/activate
echo "Updating to version ${version:-$head_ref}"
# Fetch and checkout branches
for app in ${GITHUB_WORKSPACE}/apps/*/; do
app_name=$(basename "$app")

View file

@ -9,7 +9,7 @@ on:
python-version:
required: false
type: string
default: '3.12'
default: '3.13'
node-version:
required: false
type: number

View file

@ -5,7 +5,7 @@ on:
python-version:
required: false
type: string
default: '3.12.6'
default: '3.13.0'
jobs:
typecheck:

View file

@ -9,7 +9,7 @@ on:
python-version:
required: false
type: string
default: '3.12'
default: '3.13'
node-version:
required: false
type: number

View file

@ -25,7 +25,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
- name: Run script to update POT file
run: |

View file

@ -41,7 +41,7 @@ jobs:
- name: 'Setup Environment'
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.13'
- uses: actions/checkout@v4
- name: Validate Docs
@ -60,7 +60,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.13'
cache: pip
- name: Download Semgrep rules
@ -78,7 +78,7 @@ jobs:
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.13'
- uses: actions/checkout@v4
@ -106,6 +106,6 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.13'
cache: pip
- uses: pre-commit/action@v3.0.1

View file

@ -26,7 +26,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.13'
- name: Set up bench and build assets
run: |
npm install -g yarn

View file

@ -19,7 +19,7 @@ jobs:
node-version: 20
- uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.13'
- name: Set up bench and build assets
run: |
npm install -g yarn

View file

@ -74,7 +74,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
- name: Setup Node
uses: actions/setup-node@v4

View file

@ -15,6 +15,7 @@ Remember, deprecated doesn't mean useless - it just means these functions are en
Enjoy your stay in the Deprecation Dumpster, where every function gets a second chance to shine (or at least, to not break everything).
"""
import functools
import inspect
import os
import re
@ -117,7 +118,6 @@ try:
# since python 3.13, PEP 702
from warnings import deprecated as _deprecated
except ImportError:
import functools
import warnings
from collections.abc import Callable
from typing import Optional, TypeVar, Union, overload

View file

@ -1,3 +1,5 @@
from typing import Union
from typing_extensions import override
@ -13,11 +15,15 @@ class DocRef:
return self.name
@override
def __hash__(self) -> int:
if self.name:
return hash(self.doctype + self.name)
else:
raise ValueError("Only named documents can be hashed; maybe the document is unsaved.")
def __hash__(self: Union[type, "DocRef"]) -> int:
if isinstance(self, DocRef):
if self.name:
return hash(self.doctype + self.name)
else:
raise TypeError(
f"Only named documents can be hashed; maybe the document ({self.doctype}) is unsaved."
)
raise TypeError("Only document instances can be hashed.")
@override
def __str__(self) -> str:

View file

@ -4,7 +4,7 @@ authors = [
{ name = "Frappe Technologies Pvt Ltd", email = "developers@frappe.io"}
]
description = "Metadata driven, full-stack low code web framework"
requires-python = ">=3.10,<3.13"
requires-python = ">=3.10,<3.14"
readme = "README.md"
dynamic = ["version"]
dependencies = [
@ -24,7 +24,7 @@ dependencies = [
"PyPika==0.48.9",
"PyQRCode~=1.2.1",
"PyYAML~=6.0.1",
"RestrictedPython~=7.0",
"RestrictedPython~=7.4",
"WeasyPrint==59.0",
"pydyf==0.10.0",
"Werkzeug~=3.0.1",
@ -54,7 +54,7 @@ dependencies = [
"psutil~=5.9.5",
"psycopg2-binary~=2.9.1",
"pyOpenSSL~=24.2.1",
"pydantic~=2.7.0",
"pydantic~=2.10.2",
"pyotp~=2.8.0",
"python-dateutil~=2.8.2",
"pytz==2023.3",
@ -75,7 +75,7 @@ dependencies = [
"traceback-with-variables~=2.0.4",
"typing_extensions>=4.6.1,<5",
"tomli~=2.0.1",
"uuid-utils~=0.6.1",
"uuid-utils~=0.10.0",
"xlrd~=2.0.1",
"zxcvbn~=4.4.28",
"markdownify~=0.11.6",