From 2e719411e5994f8386318cc246df91f2d904e299 Mon Sep 17 00:00:00 2001 From: Federico Busetti <729029+febus982@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:43:03 +0000 Subject: [PATCH 1/2] Support python 3.12 --- .github/workflows/github-pages.yml | 4 +-- .github/workflows/python-3.12.yml | 33 +++++++++++++++++++++++++ .github/workflows/python-code-style.yml | 4 +-- .github/workflows/python-lint.yml | 4 +-- .github/workflows/python-publish.yml | 4 +-- .github/workflows/python-quality.yml | 4 +-- README.md | 1 + pyproject.toml | 2 +- 8 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/python-3.12.yml diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index b21dc4b..884ab66 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -30,10 +30,10 @@ jobs: uses: actions/checkout@v3 - name: Setup Pages uses: actions/configure-pages@v3 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v3 with: - python-version: "3.11" + python-version: "3.12" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/python-3.12.yml b/.github/workflows/python-3.12.yml new file mode 100644 index 0000000..7057be2 --- /dev/null +++ b/.github/workflows/python-3.12.yml @@ -0,0 +1,33 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python 3.12 + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.12 + uses: actions/setup-python@v3 + with: + python-version: "3.12" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install poetry + poetry config virtualenvs.create false + poetry install --no-root --with dev + - name: Test with pytest + run: | + make ci-test + - name: Check typing + run: | + make typing diff --git a/.github/workflows/python-code-style.yml b/.github/workflows/python-code-style.yml index 744bc0d..a23ff76 100644 --- a/.github/workflows/python-code-style.yml +++ b/.github/workflows/python-code-style.yml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v3 with: - python-version: "3.11" + python-version: "3.12" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml index 899fe88..a95d325 100644 --- a/.github/workflows/python-lint.yml +++ b/.github/workflows/python-lint.yml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v3 with: - python-version: "3.11" + python-version: "3.12" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index e04198b..841b314 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -16,10 +16,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v3 with: - python-version: "3.11" + python-version: "3.12" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/python-quality.yml b/.github/workflows/python-quality.yml index f6b2b66..f003e65 100644 --- a/.github/workflows/python-quality.yml +++ b/.github/workflows/python-quality.yml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v3 with: - python-version: "3.11" + python-version: "3.12" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/README.md b/README.md index db68c8e..6d1b1d6 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![Python 3.9](https://github.com/febus982/sqlalchemy-bind-manager/actions/workflows/python-3.9.yml/badge.svg?event=push)](https://github.com/febus982/sqlalchemy-bind-manager/actions/workflows/python-3.9.yml) [![Python 3.10](https://github.com/febus982/sqlalchemy-bind-manager/actions/workflows/python-3.10.yml/badge.svg?event=push)](https://github.com/febus982/sqlalchemy-bind-manager/actions/workflows/python-3.10.yml) [![Python 3.11](https://github.com/febus982/sqlalchemy-bind-manager/actions/workflows/python-3.11.yml/badge.svg?event=push)](https://github.com/febus982/sqlalchemy-bind-manager/actions/workflows/python-3.11.yml) +[![Python 3.12](https://github.com/febus982/sqlalchemy-bind-manager/actions/workflows/python-3.12.yml/badge.svg?event=push)](https://github.com/febus982/sqlalchemy-bind-manager/actions/workflows/python-3.12.yml) [![Maintainability](https://api.codeclimate.com/v1/badges/0140f7f4e559ae806887/maintainability)](https://codeclimate.com/github/febus982/sqlalchemy-bind-manager/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/0140f7f4e559ae806887/test_coverage)](https://codeclimate.com/github/febus982/sqlalchemy-bind-manager/test_coverage) diff --git a/pyproject.toml b/pyproject.toml index 8e67367..e1f4140 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ requires = ["poetry-core", "poetry-dynamic-versioning"] build-backend = "poetry_dynamic_versioning.backend" [tool.poetry.dependencies] -python = ">=3.8,<3.12" +python = ">=3.8,<3.13" pydantic = "^2.1.1" SQLAlchemy = { version = "~2.0.0", extras = ["asyncio", "mypy"] } From 1dfb32a0abafcdc32eca3de59dd2354554bce6ed Mon Sep 17 00:00:00 2001 From: Federico Busetti <729029+febus982@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:53:38 +0000 Subject: [PATCH 2/2] Fix typing --- .idea/misc.xml | 3 +++ sqlalchemy_bind_manager/_repository/common.py | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index eac2c60..31a9dc3 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,8 @@ + + diff --git a/sqlalchemy_bind_manager/_repository/common.py b/sqlalchemy_bind_manager/_repository/common.py index 3aa276e..91b2dd2 100644 --- a/sqlalchemy_bind_manager/_repository/common.py +++ b/sqlalchemy_bind_manager/_repository/common.py @@ -1,6 +1,6 @@ from enum import Enum from functools import partial -from typing import Generic, List, TypeVar, Union +from typing import Callable, Generic, List, TypeVar, Union from pydantic import BaseModel, StrictInt, StrictStr from sqlalchemy import asc, desc @@ -43,5 +43,5 @@ class CursorPaginatedResult(BaseModel, Generic[MODEL]): class SortDirection(Enum): - ASC = partial(asc) - DESC = partial(desc) + ASC: Callable = partial(asc) + DESC: Callable = partial(desc)