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 pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ readme = "README.md"
license = { text = "MIT" }
keywords = ["graph", "database"]
version = "0.0.1"
requires-python = ">=3.10,<3.15"
requires-python = ">=3.11,<3.16"

[project.urls]
Homepage = "https://ladybugdb.com/"
Expand All @@ -20,7 +20,7 @@ dev = [
"pandas~=2.2",
"polars~=1.30",
"pyarrow>=25",
"pybind11~=2.13",
"pybind11>=2.13",
"pytest",
"pytest-asyncio~=1.0",
"pytest-xdist~=3.0",
Expand Down
14 changes: 7 additions & 7 deletions src_py/_lbug_capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ def _logical_type_to_str(logical_type: _LbugLogicalType) -> str:

def _to_datetime_from_micros(value: int, *, tz_aware: bool = False) -> dt.datetime:
seconds = value / 1_000_000
utc_dt = dt.datetime.fromtimestamp(seconds, tz=dt.timezone.utc)
utc_dt = dt.datetime.fromtimestamp(seconds, tz=dt.UTC)
if tz_aware:
return utc_dt
return utc_dt.replace(tzinfo=None)
Expand Down Expand Up @@ -1074,7 +1074,7 @@ def _value_from_python(value: Any) -> ctypes.POINTER(_LbugValue):
if value.tzinfo is not None:
micros = int(value.timestamp() * 1_000_000)
return _LIB.lbug_value_create_timestamp_tz(_LbugTimestamp(value=micros))
micros = int(value.replace(tzinfo=dt.timezone.utc).timestamp() * 1_000_000)
micros = int(value.replace(tzinfo=dt.UTC).timestamp() * 1_000_000)
return _LIB.lbug_value_create_timestamp(_LbugTimestamp(value=micros))
if isinstance(value, dt.timedelta):
total_seconds = value.days * 86400 + value.seconds
Expand Down Expand Up @@ -1828,7 +1828,7 @@ def _convert_value(self, value: _LbugValue) -> Any:
"Failed to read timestamp_ms",
)
return dt.datetime.fromtimestamp(
int(out.value) / 1000, tz=dt.timezone.utc
int(out.value) / 1000, tz=dt.UTC
).replace(tzinfo=None)
if type_id == _LBUG_TIMESTAMP_SEC:
out = _LbugTimestamp()
Expand All @@ -1838,9 +1838,9 @@ def _convert_value(self, value: _LbugValue) -> Any:
),
"Failed to read timestamp_sec",
)
return dt.datetime.fromtimestamp(
int(out.value), tz=dt.timezone.utc
).replace(tzinfo=None)
return dt.datetime.fromtimestamp(int(out.value), tz=dt.UTC).replace(
tzinfo=None
)
if type_id == _LBUG_TIMESTAMP_NS:
out = _LbugTimestamp()
_check_state(
Expand All @@ -1850,7 +1850,7 @@ def _convert_value(self, value: _LbugValue) -> Any:
"Failed to read timestamp_ns",
)
return dt.datetime.fromtimestamp(
int(out.value) / 1_000_000_000, tz=dt.timezone.utc
int(out.value) / 1_000_000_000, tz=dt.UTC
).replace(tzinfo=None)
if type_id == _LBUG_INTERVAL:
out = _LbugInterval()
Expand Down
7 changes: 1 addition & 6 deletions src_py/async_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@
from .prepared_statement import PreparedStatement

if TYPE_CHECKING:
import sys
from types import TracebackType
from typing import Self

from .database import Database
from .query_result import QueryResult

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self


class AsyncConnection:
"""AsyncConnection enables asynchronous execution of queries with a pool of connections and threads."""
Expand Down
7 changes: 1 addition & 6 deletions src_py/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@
from .types import ArrowRelTableLayout

if TYPE_CHECKING:
import sys
from collections.abc import Callable
from types import TracebackType
from typing import Self

from .database import Database
from .types import Type

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self


def _capi_value_signature(value: Any) -> tuple:
"""
Expand Down
7 changes: 1 addition & 6 deletions src_py/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from .types import Type

if TYPE_CHECKING:
import sys
from types import TracebackType
from typing import Self

from numpy.typing import NDArray
from torch_geometric.data.feature_store import IndexType
Expand All @@ -19,11 +19,6 @@
from .torch_geometric_feature_store import LbugFeatureStore
from .torch_geometric_graph_store import LbugGraphStore

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self


class Database:
"""Lbug database instance."""
Expand Down
8 changes: 1 addition & 7 deletions src_py/query_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,16 @@
from .types import Type

if TYPE_CHECKING:
import sys
from collections.abc import Iterator
from types import TracebackType
from typing import Any
from typing import Any, Self

import networkx as nx
import pandas as pd
import polars as pl
import pyarrow as pa
import torch_geometric.data as geo

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self


class QueryResult:
"""QueryResult stores the result of a query execution."""
Expand Down
Loading