From 2dede85b14b55e7b8f5fdde40f0ea48a0c604628 Mon Sep 17 00:00:00 2001 From: Fabiana <30911746+fabclmnt@users.noreply.github.com> Date: Fri, 6 Sep 2024 17:56:42 +0100 Subject: [PATCH] feat: support for python 3.12 (#123) * feat: support for python 3.11 and 3.12 * chore: update wk yaml files * fix(linting): code formatting * chore: fix yaml files definition * chore: update flake version * fix: add setuptools * chore: upgrade pycln * chore: add ignore for type imports This error is not relevant as ydata-sdk only support python version >=3.8 * fix(linting): code formatting --------- Co-authored-by: Azory YData Bot --- .github/workflows/docs.yaml | 2 +- .github/workflows/pull-request.yaml | 7 ++++--- .github/workflows/release.yaml | 4 ++-- .pre-commit-config.yaml | 6 ++++-- README.md | 2 +- pyproject.toml | 2 +- src/ydata/sdk/common/client/client.py | 3 ++- src/ydata/sdk/common/exceptions.py | 3 ++- src/ydata/sdk/common/types.py | 2 +- src/ydata/sdk/datasources/datasource.py | 2 +- 10 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 754194e9..3ec4ca95 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -65,7 +65,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.12" - name: Cache pip dependencies id: cache diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 16ea90fb..6cb41148 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -34,7 +34,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.12" - name: Cache pip dependencies id: cache @@ -46,6 +46,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + python -m pip install setuptools make install-all - name: Validate code formatting @@ -80,7 +81,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.12" - name: Cache pip dependencies id: cache @@ -108,7 +109,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.12" - name: Cache pip dependencies id: cache diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b8668456..7ca657ec 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,7 +20,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.12" - uses: actions/cache@v3 name: Cache pip dependencies @@ -54,7 +54,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] needs: package diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a8a32d27..24f63a5a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,9 +49,10 @@ repos: - id: python-check-blanket-noqa name: Enforce specifc code for noqua annotation - repo: https://github.com/hadialqattan/pycln - rev: v2.1.1 + rev: v2.4.0 hooks: - id: pycln + additional_dependencies: [setuptools] args: [--all] name: Remove unused imports (pycln) - repo: https://github.com/pre-commit/mirrors-autopep8 @@ -60,9 +61,10 @@ repos: - id: autopep8 name: Code Formatter (autopep8) - repo: https://github.com/pycqa/flake8 - rev: 4.0.1 + rev: 6.1.0 hooks: - id: flake8 + additional_dependencies: [flake8-typing-imports==1.15.0] args: ["--max-line-length=88", "--extend-ignore=N803,N806,E501,Q000,W605"] name: Code checker (flake8) - repo: https://github.com/pycqa/isort diff --git a/README.md b/README.md index 0e29145d..6a992a89 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

[![pypi](https://img.shields.io/pypi/v/ydata-sdk)](https://pypi.org/project/ydata-sdk) -![Pythonversion](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10-blue) +![Pythonversion](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue) [![downloads](https://pepy.tech/badge/ydata-sdk/month)](https://pepy.tech/project/ydata-sdk) --- diff --git a/pyproject.toml b/pyproject.toml index 4b905974..3c9384f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ authors = [ ] description = "YData SDK allows to use the *Data-Centric* tools from the YData ecosystem to accelerate AI development" readme = "README.md" -requires-python = ">=3.8,<3.11" +requires-python = ">=3.8,<3.13" classifiers = [ "License :: OSI Approved :: MIT License", 'Development Status :: 5 - Production/Stable', diff --git a/src/ydata/sdk/common/client/client.py b/src/ydata/sdk/common/client/client.py index 15d26775..8bd3fe6b 100644 --- a/src/ydata/sdk/common/client/client.py +++ b/src/ydata/sdk/common/client/client.py @@ -169,7 +169,8 @@ def get_static_file( from urllib.parse import urlparse url_data = self.__build_url(endpoint, project=project) url_parse = urlparse(self._base_url) - url_data['url'] = f'{url_parse.scheme}://{url_parse.netloc}/static-content{endpoint}' + url_data['url'] = f'{ + url_parse.scheme}://{url_parse.netloc}/static-content{endpoint}' response = self._http_client.get(**url_data) if response.status_code != Client.codes.OK and raise_for_status: diff --git a/src/ydata/sdk/common/exceptions.py b/src/ydata/sdk/common/exceptions.py index c9729bbc..3bb63930 100644 --- a/src/ydata/sdk/common/exceptions.py +++ b/src/ydata/sdk/common/exceptions.py @@ -43,7 +43,8 @@ class ClientCreationError(ClientException): def __init__(self, message=None): from ydata.sdk.common.client.client import HELP_TEXT if message is None: - message = f"Could not initialize a client. It usually means that no token could be found or the token needs to be refreshed.\n{HELP_TEXT}" + message = f"Could not initialize a client. It usually means that no token could be found or the token needs to be refreshed.\n{ + HELP_TEXT}" super().__init__(message) diff --git a/src/ydata/sdk/common/types.py b/src/ydata/sdk/common/types.py index 510be05a..084d54b8 100644 --- a/src/ydata/sdk/common/types.py +++ b/src/ydata/sdk/common/types.py @@ -1,4 +1,4 @@ -from typing import NewType +from typing import NewType # noqa: TYP001 Project = NewType('Project', str) UID = NewType('UID', str) diff --git a/src/ydata/sdk/datasources/datasource.py b/src/ydata/sdk/datasources/datasource.py index c40a4755..4d457349 100644 --- a/src/ydata/sdk/datasources/datasource.py +++ b/src/ydata/sdk/datasources/datasource.py @@ -1,5 +1,5 @@ from time import sleep -from typing import Dict, Optional, Type, Union +from typing import Dict, Optional, Type, Union # noqa: TYP001 from uuid import uuid4 from ydata.sdk.common.client import Client