Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pythontest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -29,7 +29,7 @@ jobs:
max-parallel: 4
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Requirements
``td-client`` supports the following versions of Python.


* Python 3.5+
* Python 3.10+
* PyPy

Install
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "td-client"
version = "1.5.0"
description = "Treasure Data API library for Python"
readme = {file = "README.rst", content-type = "text/x-rst; charset=UTF-8"}
requires-python = ">=3.8"
requires-python = ">=3.10"
license = {text = "Apache Software License"}
authors = [{name = "Treasure Data, Inc.", email = "support@treasure-data.com"}]
urls = {homepage = "http://treasuredata.com/"}
Expand All @@ -18,11 +18,11 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Topic :: Internet",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
Expand All @@ -31,7 +31,6 @@ dependencies = [
"python-dateutil",
"msgpack>=0.6.2",
"urllib3",
"typing-extensions>=4.0.0",
]

[project.optional-dependencies]
Expand All @@ -46,6 +45,7 @@ tdclient = ["py.typed"]

[tool.ruff]
line-length = 88
target-version = "py310"

[tool.ruff.lint]
select = [
Expand All @@ -66,7 +66,7 @@ known-third-party = ["dateutil","msgpack","pkg_resources","pytest","setuptools",
include = ["tdclient"]
exclude = ["**/__pycache__", "tdclient/test", "docs"]
typeCheckingMode = "basic"
pythonVersion = "3.9"
pythonVersion = "3.10"
pythonPlatform = "All"
reportMissingTypeStubs = false
reportUnknownMemberType = false
Expand Down
2 changes: 0 additions & 2 deletions tdclient/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import datetime
import time
from typing import Any
Expand Down
6 changes: 2 additions & 4 deletions tdclient/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python

from __future__ import annotations

import contextlib
import csv
import email.utils
Expand Down Expand Up @@ -33,7 +31,7 @@
from tdclient.schedule_api import ScheduleAPI
from tdclient.server_status_api import ServerStatusAPI
from tdclient.table_api import TableAPI
from tdclient.types import BytesOrStream
from tdclient.types import BytesOrStream, StreamBody
from tdclient.user_api import UserAPI
from tdclient.util import (
csv_dict_record_reader,
Expand Down Expand Up @@ -534,7 +532,7 @@ def send_request(
method: str,
url: str,
fields: dict[str, Any] | None = None,
body: bytes | bytearray | memoryview | array[int] | IO[bytes] | None = None,
body: StreamBody = None,
headers: dict[str, str] | None = None,
**kwargs: Any,
) -> urllib3.BaseHTTPResponse:
Expand Down
12 changes: 3 additions & 9 deletions tdclient/bulk_import_api.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
#!/usr/bin/env python

from __future__ import annotations

import collections
import contextlib
import gzip
import io
import os
from collections.abc import Iterator
from typing import TYPE_CHECKING, Any
from contextlib import AbstractContextManager
from typing import IO, Any

import msgpack

if TYPE_CHECKING:
from contextlib import AbstractContextManager
from typing import IO

import urllib3
import urllib3

from tdclient.types import BulkImportParams, BytesOrStream, DataFormat, FileLike
from tdclient.util import create_url
Expand Down
6 changes: 2 additions & 4 deletions tdclient/bulk_import_model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python

from __future__ import annotations

import time
from collections.abc import Callable, Iterator
from typing import TYPE_CHECKING, Any
Expand All @@ -23,7 +21,7 @@ class BulkImport(Model):
STATUS_COMMITTING = "committing"
STATUS_COMMITTED = "committed"

def __init__(self, client: Client, **kwargs: Any) -> None:
def __init__(self, client: "Client", **kwargs: Any) -> None:
super().__init__(client)
self._feed(kwargs)

Expand Down Expand Up @@ -116,7 +114,7 @@ def perform(
wait_interval: int = 5,
wait_callback: Callable[[], None] | None = None,
timeout: float | None = None,
) -> Job:
) -> "Job":
"""Perform bulk import

Args:
Expand Down
4 changes: 1 addition & 3 deletions tdclient/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python

from __future__ import annotations

import datetime
import json
from collections.abc import Iterator
Expand All @@ -27,7 +25,7 @@ class Client:
def __init__(self, *args: Any, **kwargs: Any) -> None:
self._api = api.API(*args, **kwargs)

def __enter__(self) -> Client:
def __enter__(self) -> "Client":
return self

def __exit__(
Expand Down
14 changes: 6 additions & 8 deletions tdclient/connection.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#!/usr/bin/env python

from __future__ import annotations

from typing import TYPE_CHECKING, Any, Callable
from collections.abc import Callable
from types import TracebackType
from typing import TYPE_CHECKING, Any

from tdclient import api, cursor, errors
from tdclient.types import Priority

if TYPE_CHECKING:
from types import TracebackType

from tdclient.cursor import Cursor


Expand All @@ -22,7 +20,7 @@ def __init__(
priority: Priority | None = None,
retry_limit: int | None = None,
wait_interval: int | None = None,
wait_callback: Callable[[Cursor], None] | None = None,
wait_callback: Callable[["Cursor"], None] | None = None,
**kwargs: Any,
) -> None:
cursor_kwargs = dict()
Expand All @@ -43,7 +41,7 @@ def __init__(
self._api = api.API(**kwargs)
self._cursor_kwargs = cursor_kwargs

def __enter__(self) -> Connection:
def __enter__(self) -> "Connection":
return self

def __exit__(
Expand All @@ -67,5 +65,5 @@ def commit(self) -> None:
def rollback(self) -> None:
raise errors.NotSupportedError

def cursor(self) -> Cursor:
def cursor(self) -> "Cursor":
return cursor.Cursor(self._api, **self._cursor_kwargs)
10 changes: 3 additions & 7 deletions tdclient/connector_api.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#!/usr/bin/env python

from __future__ import annotations

import json
from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from contextlib import AbstractContextManager
from contextlib import AbstractContextManager
from typing import Any

import urllib3
import urllib3

from tdclient.util import create_url, normalize_connector_config

Expand Down
11 changes: 5 additions & 6 deletions tdclient/cursor.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env python

from __future__ import annotations

import time
from typing import TYPE_CHECKING, Any, Callable
from collections.abc import Callable
from typing import TYPE_CHECKING, Any

from tdclient import errors

Expand All @@ -14,9 +13,9 @@
class Cursor:
def __init__(
self,
api: API,
api: "API",
wait_interval: int = 5,
wait_callback: Callable[[Cursor], None] | None = None,
wait_callback: Callable[["Cursor"], None] | None = None,
**kwargs: Any,
) -> None:
self._api = api
Expand All @@ -30,7 +29,7 @@ def __init__(
self.wait_callback = wait_callback

@property
def api(self) -> API:
def api(self) -> "API":
return self._api

@property
Expand Down
10 changes: 3 additions & 7 deletions tdclient/database_api.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#!/usr/bin/env python

from __future__ import annotations
from contextlib import AbstractContextManager
from typing import Any

from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from contextlib import AbstractContextManager

import urllib3
import urllib3

from tdclient.util import create_url, get_or_else, parse_date

Expand Down
12 changes: 5 additions & 7 deletions tdclient/database_model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python

from __future__ import annotations

import datetime
from typing import TYPE_CHECKING, Any

Expand All @@ -19,7 +17,7 @@ class Database(Model):
PERMISSIONS = ["administrator", "full_access", "import_only", "query_only"]
PERMISSION_LIST_TABLES = ["administrator", "full_access"]

def __init__(self, client: Client, db_name: str, **kwargs: Any) -> None:
def __init__(self, client: "Client", db_name: str, **kwargs: Any) -> None:
super().__init__(client)
self._db_name = db_name
self._tables: list[Table] | None = kwargs.get("tables")
Expand Down Expand Up @@ -57,7 +55,7 @@ def name(self) -> str:
"""
return self._db_name

def tables(self) -> list[Table]:
def tables(self) -> list["Table"]:
"""
Returns:
a list of :class:`tdclient.model.Table`
Expand All @@ -67,7 +65,7 @@ def tables(self) -> list[Table]:
assert self._tables is not None
return self._tables

def create_log_table(self, name: str) -> Table:
def create_log_table(self, name: str) -> "Table":
"""
Args:
name (str): name of new log table
Expand All @@ -77,7 +75,7 @@ def create_log_table(self, name: str) -> Table:
"""
return self._client.create_log_table(self._db_name, name)

def table(self, table_name: str) -> Table:
def table(self, table_name: str) -> "Table":
"""
Args:
table_name (str): name of a table
Expand All @@ -95,7 +93,7 @@ def delete(self) -> bool:
"""
return self._client.delete_database(self._db_name)

def query(self, q: str, **kwargs: Any) -> Job:
def query(self, q: str, **kwargs: Any) -> "Job":
"""Run a query on the database

Args:
Expand Down
10 changes: 3 additions & 7 deletions tdclient/export_api.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#!/usr/bin/env python

from __future__ import annotations
from contextlib import AbstractContextManager
from typing import Any

from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from contextlib import AbstractContextManager

import urllib3
import urllib3

from tdclient.types import ExportParams
from tdclient.util import create_url
Expand Down
11 changes: 3 additions & 8 deletions tdclient/import_api.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
#!/usr/bin/env python

from __future__ import annotations

import contextlib
import os
from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from contextlib import AbstractContextManager
from typing import IO
from contextlib import AbstractContextManager
from typing import IO, Any

import urllib3
import urllib3

from tdclient.types import BytesOrStream, DataFormat, FileLike
from tdclient.util import create_url
Expand Down
Loading