Skip to content

Commit

Permalink
feat: support for python 3.12 (#123)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
fabclmnt and azory-ydata committed Sep 6, 2024
1 parent 70bcc82 commit 2dede85
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p></p>

[![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)

---
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion src/ydata/sdk/common/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/ydata/sdk/common/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/ydata/sdk/common/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import NewType
from typing import NewType # noqa: TYP001

Project = NewType('Project', str)
UID = NewType('UID', str)
2 changes: 1 addition & 1 deletion src/ydata/sdk/datasources/datasource.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 2dede85

Please sign in to comment.