From 8be9c6f0bc3c6c5113eef9615804442e5be39d7a Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Fri, 22 Dec 2023 12:52:23 +0400 Subject: [PATCH] 33 update for 312 (#34) * lock file * test with 3.12 * typing * typing * Update ci.yml * union --- .github/workflows/ci.yml | 6 ++---- cvx/bson/file.py | 2 +- cvx/bson/io.py | 6 +++--- poetry.lock | 5 +++-- pyproject.toml | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf54eff3..716e1b61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,7 @@ name: "ci" on: - push: - branches: - - main + push jobs: test: @@ -13,7 +11,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest, windows-latest, macos-latest ] - python-version: ['3.9', '3.10', '3.11'] # '3.12.0-rc.3' pyarrow fails to build for 3.12 + python-version: ['3.9', '3.10', '3.11', '3.12'] # '3.12.0-rc.3' pyarrow fails to build for 3.12 # Steps represent a sequence of tasks that will be executed as part of the job steps: diff --git a/cvx/bson/file.py b/cvx/bson/file.py index 6ba114ab..27883dd3 100644 --- a/cvx/bson/file.py +++ b/cvx/bson/file.py @@ -29,7 +29,7 @@ from cvx.bson.io import decode, encode FILE = Union[str, bytes, PathLike] -MATRIX: TypeAlias = npt.NDArray[Any] | pd.DataFrame +MATRIX: TypeAlias = Union[npt.NDArray[Any], pd.DataFrame] MATRICES = Dict[str, MATRIX] diff --git a/cvx/bson/io.py b/cvx/bson/io.py index 22589384..367f86a0 100644 --- a/cvx/bson/io.py +++ b/cvx/bson/io.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. from io import BytesIO -from typing import Any +from typing import Any, Union import numpy as np import pandas as pd import pyarrow as pa -def encode(data: np.ndarray | pd.DataFrame) -> Any: +def encode(data: Union[np.ndarray, pd.DataFrame]) -> Any: """ Encode a numpy array or a pandas DataFrame @@ -40,7 +40,7 @@ def encode(data: np.ndarray | pd.DataFrame) -> Any: raise TypeError(f"Invalid Datatype {type(data)}") -def decode(data: bytes) -> np.ndarray | pd.DataFrame: +def decode(data: bytes) -> Union[np.ndarray, pd.DataFrame]: """ Decode the bytes back into numpy array or pandas DataFrame diff --git a/poetry.lock b/poetry.lock index ad4204e9..8c629554 100644 --- a/poetry.lock +++ b/poetry.lock @@ -309,6 +309,7 @@ files = [ numpy = [ {version = ">=1.22.4,<2", markers = "python_version < \"3.11\""}, {version = ">=1.23.2,<2", markers = "python_version == \"3.11\""}, + {version = ">=1.26.0,<2", markers = "python_version >= \"3.12\""}, ] python-dateutil = ">=2.8.2" pytz = ">=2020.1" @@ -654,5 +655,5 @@ dev = ["black (>=19.3b0)", "pytest (>=4.6.2)"] [metadata] lock-version = "2.0" -python-versions = ">=3.9,<3.12" -content-hash = "6ea571d80db8978e9dee37b13b7fbd65e77e38994d31cd97975f1fcaae3f05bf" +python-versions = ">=3.9,<3.13" +content-hash = "e7eeeeaf423d505d4ae44acaf56914d0b966d355f25607dceec24067055c7f34" diff --git a/pyproject.toml b/pyproject.toml index 78353b81..b8a867a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ packages = [{include = "cvx"}] homepage = "https://www.cvxgrp.org/cvxbson" [tool.poetry.dependencies] -python = ">=3.9,<3.12" +python = ">=3.9,<3.13" numpy = "*" numpyencoder = "*" pandas = "*"