Skip to content

Commit

Permalink
#171 Merge pull request from astropenguin/astropenguin/issue170
Browse files Browse the repository at this point in the history
Support Python 3.12 and 3.13
  • Loading branch information
astropenguin authored Dec 9, 2024
2 parents a84dde2 + 8983a6a commit 8a080d6
Show file tree
Hide file tree
Showing 15 changed files with 900 additions and 912 deletions.
11 changes: 0 additions & 11 deletions .devcontainer/Dockerfile

This file was deleted.

9 changes: 5 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "pandas-dataclasses",
"build": {
"context": "..",
"dockerfile": "Dockerfile"
},
"image":"python:3.13",
"onCreateCommand": "pip install poetry==1.8.5",
"postCreateCommand": "poetry install",
"containerEnv": {
"POETRY_VIRTUALENVS_CREATE": "false"
},
"customizations": {
"vscode": {
"extensions": [
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
env:
POETRY_VIRTUALENVS_CREATE: false
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.13"
- name: Install project dependencies
run: pip install poetry && poetry install
- name: Build docs
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
with:
python-version: "3.11"
python-version: "3.13"
- name: Publish package to PyPI
run: pip install poetry && poetry publish --build
run: pip install poetry==1.8.5 && poetry publish --build
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11"]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install project dependencies
run: pip install poetry && poetry install
run: pip install poetry==1.8.5 && poetry install
- name: Test code's formatting (Black)
run: black --check docs tests pandas_dataclasses
- name: Test code's typing (Pyright)
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ message: "If you use this software, please cite it as below."

title: "pandas-dataclasses"
abstract: "pandas data creation made easy by dataclass"
version: 0.12.0
date-released: 2023-02-26
version: 0.13.0
date-released: 2024-12-09
license: "MIT"
doi: "10.5281/zenodo.6127352"
url: "https://github.com/astropenguin/pandas-dataclasses"
Expand Down
2 changes: 1 addition & 1 deletion pandas_dataclasses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"core",
"extras",
]
__version__ = "0.12.0"
__version__ = "0.13.0"


# submodules
Expand Down
30 changes: 10 additions & 20 deletions pandas_dataclasses/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@


@overload
def aspandas(obj: DataClassOf[TPandas, PAny], *, factory: None = None) -> TPandas:
...
def aspandas(obj: DataClassOf[TPandas, PAny], *, factory: None = None) -> TPandas: ...


@overload
def aspandas(obj: DataClass[PAny], *, factory: Callable[..., TPandas]) -> TPandas:
...
def aspandas(obj: DataClass[PAny], *, factory: Callable[..., TPandas]) -> TPandas: ...


def aspandas(obj: Any, *, factory: Any = None) -> Any:
Expand Down Expand Up @@ -81,18 +79,15 @@ def aspandas(obj: Any, *, factory: Any = None) -> Any:


@overload
def asframe(obj: DataClassOf[TFrame, PAny], *, factory: None = None) -> TFrame:
...
def asframe(obj: DataClassOf[TFrame, PAny], *, factory: None = None) -> TFrame: ...


@overload
def asframe(obj: DataClass[PAny], *, factory: Callable[..., TFrame]) -> TFrame:
...
def asframe(obj: DataClass[PAny], *, factory: Callable[..., TFrame]) -> TFrame: ...


@overload
def asframe(obj: DataClass[PAny], *, factory: None = None) -> pd.DataFrame:
...
def asframe(obj: DataClass[PAny], *, factory: None = None) -> pd.DataFrame: ...


def asframe(obj: Any, *, factory: Any = None) -> Any:
Expand Down Expand Up @@ -136,18 +131,15 @@ def asframe(obj: Any, *, factory: Any = None) -> Any:


@overload
def asseries(obj: DataClassOf[TSeries, PAny], *, factory: None = None) -> TSeries:
...
def asseries(obj: DataClassOf[TSeries, PAny], *, factory: None = None) -> TSeries: ...


@overload
def asseries(obj: DataClass[PAny], *, factory: Callable[..., TSeries]) -> TSeries:
...
def asseries(obj: DataClass[PAny], *, factory: Callable[..., TSeries]) -> TSeries: ...


@overload
def asseries(obj: DataClass[PAny], *, factory: None = None) -> "pd.Series[Any]":
...
def asseries(obj: DataClass[PAny], *, factory: None = None) -> "pd.Series[Any]": ...


def asseries(obj: Any, *, factory: Any = None) -> Any:
Expand Down Expand Up @@ -265,13 +257,11 @@ def items(field: Field) -> Iterable[tuple[Hashable, Any]]:


@overload
def name(fields: Field) -> Hashable:
...
def name(fields: Field) -> Hashable: ...


@overload
def name(fields: Fields) -> Optional[Hashable]:
...
def name(fields: Fields) -> Optional[Hashable]: ...


def name(fields: Any) -> Any:
Expand Down
6 changes: 2 additions & 4 deletions pandas_dataclasses/core/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class DataClass(Protocol[PAny]):

__dataclass_fields__: ClassVar[dict[str, Field[Any]]]

def __init__(self, *args: PAny.args, **kwargs: PAny.kwargs) -> None:
...
def __init__(self, *args: PAny.args, **kwargs: PAny.kwargs) -> None: ...


class DataClassOf(Protocol[TPandas, PAny]):
Expand All @@ -60,8 +59,7 @@ class DataClassOf(Protocol[TPandas, PAny]):
__dataclass_fields__: ClassVar[dict[str, Field[Any]]]
__pandas_factory__: Callable[..., TPandas]

def __init__(self, *args: PAny.args, **kwargs: PAny.kwargs) -> None:
...
def __init__(self, *args: PAny.args, **kwargs: PAny.kwargs) -> None: ...


def is_union(tp: Any) -> bool:
Expand Down
Loading

0 comments on commit 8a080d6

Please sign in to comment.