Skip to content

Commit

Permalink
[DOP-9653] Test Python 3.12 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Dec 12, 2023
1 parent 9615e68 commit 89e9a38
Show file tree
Hide file tree
Showing 30 changed files with 49 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- master

env:
DEFAULT_PYTHON: '3.11'
DEFAULT_PYTHON: '3.12'

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:
cancel-in-progress: true

env:
DEFAULT_PYTHON: '3.11'
DEFAULT_PYTHON: '3.12'

jobs:
linters:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/clickhouse/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ min: &min

max: &max
spark-version: 3.5.0
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/core/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ min: &min

max: &max
spark-version: 3.5.0
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/data/ftp/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ min: &min
os: ubuntu-latest

max: &max
python-version: '3.11'
python-version: '3.12'
os: ubuntu-latest

matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/data/ftps/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ min: &min
os: ubuntu-latest

max: &max
python-version: '3.11'
python-version: '3.12'
os: ubuntu-latest

matrix:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/hdfs/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ min: &min
max: &max
hadoop-version: hadoop3-hdfs
spark-version: 3.5.0
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
hadoop-version: hadoop3-hdfs
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/hive/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ min: &min

max: &max
spark-version: 3.5.0
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/kafka/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ min: &min
max: &max
kafka-version: 3.5.1
spark-version: 3.5.0
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
kafka-version: latest
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/local-fs/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ min_excel: &min_excel

max: &max
spark-version: 3.5.0
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/mongodb/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ min: &min

max: &max
spark-version: 3.4.1
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/mssql/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ min: &min

max: &max
spark-version: 3.5.0
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/mysql/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ min: &min

max: &max
spark-version: 3.5.0
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/oracle/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ min: &min

max: &max
spark-version: 3.5.0
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/postgres/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ min: &min

max: &max
spark-version: 3.5.0
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/s3/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ min: &min
max: &max
minio-version: 2023.7.18
spark-version: 3.5.0
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
minio-version: latest
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/data/samba/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ min: &min
os: ubuntu-latest

max: &max
python-version: '3.11'
python-version: '3.12'
os: ubuntu-latest

matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/data/sftp/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ min: &min
os: ubuntu-latest

max: &max
python-version: '3.11'
python-version: '3.12'
os: ubuntu-latest

matrix:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/data/teradata/matrix.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
max: &max
spark-version: 3.5.0
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

latest: &latest
spark-version: latest
python-version: '3.11'
python-version: '3.12'
java-version: 20
os: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/data/webdav/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ min: &min
os: ubuntu-latest

max: &max
python-version: '3.11'
python-version: '3.12'
os: ubuntu-latest

matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:

env:
DEFAULT_PYTHON: '3.11'
DEFAULT_PYTHON: '3.12'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/get-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ on:
value: ${{ jobs.get-matrix.outputs.matrix-webdav }}

env:
DEFAULT_PYTHON: '3.11'
DEFAULT_PYTHON: '3.12'

jobs:
get-matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
cancel-in-progress: true

env:
DEFAULT_PYTHON: '3.11'
DEFAULT_PYTHON: '3.12'

jobs:
get-matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- '[0-9]+.[0-9]+.[0-9]+'

env:
DEFAULT_PYTHON: '3.11'
DEFAULT_PYTHON: '3.12'

jobs:
release:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true

env:
DEFAULT_PYTHON: '3.11'
DEFAULT_PYTHON: '3.12'

jobs:
get-matrix:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"

python:
install:
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Non-goals

Requirements
------------
* **Python 3.7 - 3.11**
* **Python 3.7 - 3.12**
* PySpark 2.3.x - 3.5.x (depends on used connector)
* Java 8+ (required by Spark, see below)
* Kerberos libs & GCC (required by ``Hive``, ``HDFS`` and ``SparkHDFS`` connectors)
Expand Down Expand Up @@ -177,9 +177,9 @@ Compatibility matrix
+--------------------------------------------------------------+-------------+-------------+-------+
| `3.3.x <https://spark.apache.org/docs/3.3.3/#downloading>`_ | 3.7 - 3.10 | 8u201 - 17 | 2.12 |
+--------------------------------------------------------------+-------------+-------------+-------+
| `3.4.x <https://spark.apache.org/docs/3.4.1/#downloading>`_ | 3.7 - 3.11 | 8u362 - 20 | 2.12 |
| `3.4.x <https://spark.apache.org/docs/3.4.1/#downloading>`_ | 3.7 - 3.12 | 8u362 - 20 | 2.12 |
+--------------------------------------------------------------+-------------+-------------+-------+
| `3.5.x <https://spark.apache.org/docs/3.5.0/#downloading>`_ | 3.8 - 3.11 | 8u371 - 20 | 2.12 |
| `3.5.x <https://spark.apache.org/docs/3.5.0/#downloading>`_ | 3.8 - 3.12 | 8u371 - 20 | 2.12 |
+--------------------------------------------------------------+-------------+-------------+-------+

.. _pyspark-install:
Expand Down
1 change: 1 addition & 0 deletions docs/changelog/next_release/167.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add Python 3.12 compatibility.
7 changes: 5 additions & 2 deletions onetl/impl/local_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@
# limitations under the License.

import os
import sys
from pathlib import Path, PurePosixPath, PureWindowsPath


class LocalPath(Path):
def __new__(cls, *args, **kwargs):
if cls is LocalPath:
cls = LocalWindowsPath if os.name == "nt" else LocalPosixPath
self = cls._from_parts(args)
return self # noqa: WPS331
if sys.version_info < (3, 12):
return cls._from_parts(args)
else:
return object.__new__(cls) # noqa: WPS503


class LocalPosixPath(LocalPath, PurePosixPath):
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def parse_requirements(file: Path) -> list[str]:
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Java Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand Down

0 comments on commit 89e9a38

Please sign in to comment.