From 892af7449aed0de5c4ec8481570ce30f07bb96c7 Mon Sep 17 00:00:00 2001 From: Jacob Coffee Date: Tue, 3 Oct 2023 01:50:51 -0500 Subject: [PATCH 01/13] feat: add support for `Python@3.12` --- .github/workflows/ci.yml | 13 ++++++++----- .pre-commit-config.yaml | 2 +- sonar-project.properties | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4656cdb1a..ce81b1243d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,8 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" + allow-prereleases: true - name: Install Pre-Commit run: python -m pip install pre-commit && pre-commit install @@ -34,11 +35,12 @@ jobs: strategy: fail-fast: true matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] pydantic-version: ["1", "2"] uses: ./.github/workflows/test.yml with: - coverage: ${{ matrix.python-version == '3.11' && matrix.pydantic-version == '2' }} + coverage: ${{ matrix.python-version == '3.12' && matrix.pydantic-version == '2' }} + integration: ${{ matrix.python-version == '3.12' && matrix.pydantic-version == '2' }} pydantic-version: ${{ matrix.pydantic-version }} python-version: ${{ matrix.python-version }} @@ -50,7 +52,7 @@ jobs: os: ["macos-latest", "windows-latest"] uses: ./.github/workflows/test.yml with: - python-version: "3.11" + python-version: "3.12" pydantic-version: "2" os: ${{ matrix.os }} @@ -108,7 +110,8 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" + allow-prereleases: true - uses: pdm-project/setup-pdm@v3 name: Set up PDM diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d237b01269..852c1b3eea 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ default_language_version: - python: "3.11" + python: "3.12" repos: - repo: https://github.com/compilerla/conventional-pre-commit rev: v2.4.0 diff --git a/sonar-project.properties b/sonar-project.properties index 9933219670..49fa91b5ee 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,7 @@ sonar.organization=litestar-api sonar.projectKey=litestar-org_litestar sonar.python.coverage.reportPaths=coverage.xml -sonar.python.version=3.8, 3.9, 3.10, 3.11 +sonar.python.version=3.8, 3.9, 3.10, 3.11, 3.12 sonar.sourceEncoding=UTF-8 sonar.sources=litestar sonar.tests=tests From 618305b4ed47d2e1b91d314134b0af49a5d9304b Mon Sep 17 00:00:00 2001 From: Jacob Coffee Date: Tue, 3 Oct 2023 01:53:48 -0500 Subject: [PATCH 02/13] chore: remove prerelease - chore: apply suggestions --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce81b1243d..6ee824623d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,6 @@ jobs: - uses: actions/setup-python@v4 with: python-version: "3.12" - allow-prereleases: true - name: Install Pre-Commit run: python -m pip install pre-commit && pre-commit install @@ -39,7 +38,7 @@ jobs: pydantic-version: ["1", "2"] uses: ./.github/workflows/test.yml with: - coverage: ${{ matrix.python-version == '3.12' && matrix.pydantic-version == '2' }} + coverage: ${{ matrix.python-version == '3.11' && matrix.pydantic-version == '2' }} integration: ${{ matrix.python-version == '3.12' && matrix.pydantic-version == '2' }} pydantic-version: ${{ matrix.pydantic-version }} python-version: ${{ matrix.python-version }} @@ -111,7 +110,6 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.12" - allow-prereleases: true - uses: pdm-project/setup-pdm@v3 name: Set up PDM From 63469bba2498586551a8f66476fc26f2309f17b7 Mon Sep 17 00:00:00 2001 From: Jacob Coffee Date: Tue, 3 Oct 2023 01:57:58 -0500 Subject: [PATCH 03/13] fix(ci): fix weird thing --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ee824623d..5c3f73f4e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,6 @@ jobs: uses: ./.github/workflows/test.yml with: coverage: ${{ matrix.python-version == '3.11' && matrix.pydantic-version == '2' }} - integration: ${{ matrix.python-version == '3.12' && matrix.pydantic-version == '2' }} pydantic-version: ${{ matrix.pydantic-version }} python-version: ${{ matrix.python-version }} From 71876819cc09a756c3f8d120d9c9316a6f5628b3 Mon Sep 17 00:00:00 2001 From: Jacob Coffee Date: Tue, 3 Oct 2023 02:05:32 -0500 Subject: [PATCH 04/13] Revert "chore: remove prerelease" This reverts commit a6082f40 --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c3f73f4e0..d3e3c75623 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: "3.12" + allow-prereleases: true - name: Install Pre-Commit run: python -m pip install pre-commit && pre-commit install @@ -109,6 +110,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.12" + allow-prereleases: true - uses: pdm-project/setup-pdm@v3 name: Set up PDM From 34bc1957d39155a30d54de2b65d3ebfe21953630 Mon Sep 17 00:00:00 2001 From: Jacob Coffee Date: Fri, 13 Oct 2023 20:35:57 -0500 Subject: [PATCH 05/13] feat: 3.12 --- .github/workflows/ci.yml | 4 +-- .github/workflows/docs.yml | 5 ++- .github/workflows/publish.yml | 11 +++--- pdm.lock | 68 +++++++++++++++++++---------------- pyproject.toml | 5 +-- 5 files changed, 49 insertions(+), 44 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3e3c75623..c0f78766e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: pydantic-version: ["1", "2"] uses: ./.github/workflows/test.yml with: - coverage: ${{ matrix.python-version == '3.11' && matrix.pydantic-version == '2' }} + coverage: ${{ matrix.python-version == '3.12' && matrix.pydantic-version == '2' }} pydantic-version: ${{ matrix.pydantic-version }} python-version: ${{ matrix.python-version }} @@ -115,7 +115,7 @@ jobs: - uses: pdm-project/setup-pdm@v3 name: Set up PDM with: - python-version: "3.11" + python-version: "3.12" allow-python-prereleases: false cache: true cache-dependency-path: | diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9be302c1fd..a16aa81d72 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -17,13 +17,12 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" - uses: pdm-project/setup-pdm@v3 name: Set up PDM with: - python-version: "3.11" - allowpython-prereleases: false + python-version: "3.12" cache: true cache-dependency-path: | ./pdm.lock diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0068e8e8d4..7bea786888 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ jobs: name: Test Minimal Application with Base Dependencies runs-on: ubuntu-latest env: - python_version: "3.11" + python_version: "3.12" steps: - name: Check out repository uses: actions/checkout@v4 @@ -18,12 +18,12 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" - uses: pdm-project/setup-pdm@v3 name: Set up PDM with: - python-version: "3.11" + python-version: "3.12" allow-python-prereleases: false cache: true cache-dependency-path: | @@ -50,13 +50,12 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" - uses: pdm-project/setup-pdm@v3 name: Set up PDM with: - python-version: "3.11" - allow-python-prereleases: false + python-version: "3.12" cache: true - name: Build package diff --git a/pdm.lock b/pdm.lock index fb216aa70f..0645282257 100644 --- a/pdm.lock +++ b/pdm.lock @@ -6,7 +6,7 @@ groups = ["default", "annotated-types", "attrs", "brotli", "cli", "cryptography" cross_platform = true static_urls = false lock_version = "4.3" -content_hash = "sha256:41b63a9ef2b44b3ac01593f1ee20d7cdb14a762e03facd36c6106fd2de32eedd" +content_hash = "sha256:f4b5aed71e0f4451e1e6d10c785bef4a264708617e0d2b917bd7dc0be2c41918" [[package]] name = "accessible-pygments" @@ -1995,7 +1995,7 @@ files = [ [[package]] name = "pre-commit" -version = "3.4.0" +version = "3.5.0" requires_python = ">=3.8" summary = "A framework for managing and maintaining multi-language pre-commit hooks." dependencies = [ @@ -2006,8 +2006,8 @@ dependencies = [ "virtualenv>=20.10.0", ] files = [ - {file = "pre_commit-3.4.0-py2.py3-none-any.whl", hash = "sha256:96d529a951f8b677f730a7212442027e8ba53f9b04d217c4c67dc56c393ad945"}, - {file = "pre_commit-3.4.0.tar.gz", hash = "sha256:6bbd5129a64cad4c0dfaeeb12cd8f7ea7e15b77028d985341478c8af3c759522"}, + {file = "pre_commit-3.5.0-py2.py3-none-any.whl", hash = "sha256:841dc9aef25daba9a0238cd27984041fa0467b4199fc4852e27950664919f660"}, + {file = "pre_commit-3.5.0.tar.gz", hash = "sha256:5804465c675b659b0862f07907f96295d490822a450c4c40e747d0b1c6ebcb32"}, ] [[package]] @@ -3294,35 +3294,41 @@ files = [ [[package]] name = "uvloop" -version = "0.17.0" -requires_python = ">=3.7" +version = "0.18.0" +requires_python = ">=3.7.0" summary = "Fast implementation of asyncio event loop on top of libuv" files = [ - {file = "uvloop-0.17.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ce9f61938d7155f79d3cb2ffa663147d4a76d16e08f65e2c66b77bd41b356718"}, - {file = "uvloop-0.17.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:68532f4349fd3900b839f588972b3392ee56042e440dd5873dfbbcd2cc67617c"}, - {file = "uvloop-0.17.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0949caf774b9fcefc7c5756bacbbbd3fc4c05a6b7eebc7c7ad6f825b23998d6d"}, - {file = "uvloop-0.17.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ff3d00b70ce95adce264462c930fbaecb29718ba6563db354608f37e49e09024"}, - {file = "uvloop-0.17.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:a5abddb3558d3f0a78949c750644a67be31e47936042d4f6c888dd6f3c95f4aa"}, - {file = "uvloop-0.17.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8efcadc5a0003d3a6e887ccc1fb44dec25594f117a94e3127954c05cf144d811"}, - {file = "uvloop-0.17.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:3378eb62c63bf336ae2070599e49089005771cc651c8769aaad72d1bd9385a7c"}, - {file = "uvloop-0.17.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6aafa5a78b9e62493539456f8b646f85abc7093dd997f4976bb105537cf2635e"}, - {file = "uvloop-0.17.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c686a47d57ca910a2572fddfe9912819880b8765e2f01dc0dd12a9bf8573e539"}, - {file = "uvloop-0.17.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:864e1197139d651a76c81757db5eb199db8866e13acb0dfe96e6fc5d1cf45fc4"}, - {file = "uvloop-0.17.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:2a6149e1defac0faf505406259561bc14b034cdf1d4711a3ddcdfbaa8d825a05"}, - {file = "uvloop-0.17.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:6708f30db9117f115eadc4f125c2a10c1a50d711461699a0cbfaa45b9a78e376"}, - {file = "uvloop-0.17.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:a4aee22ece20958888eedbad20e4dbb03c37533e010fb824161b4f05e641f738"}, - {file = "uvloop-0.17.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:307958f9fc5c8bb01fad752d1345168c0abc5d62c1b72a4a8c6c06f042b45b20"}, - {file = "uvloop-0.17.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3ebeeec6a6641d0adb2ea71dcfb76017602ee2bfd8213e3fcc18d8f699c5104f"}, - {file = "uvloop-0.17.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1436c8673c1563422213ac6907789ecb2b070f5939b9cbff9ef7113f2b531595"}, - {file = "uvloop-0.17.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:8887d675a64cfc59f4ecd34382e5b4f0ef4ae1da37ed665adba0c2badf0d6578"}, - {file = "uvloop-0.17.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:3db8de10ed684995a7f34a001f15b374c230f7655ae840964d51496e2f8a8474"}, - {file = "uvloop-0.17.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7d37dccc7ae63e61f7b96ee2e19c40f153ba6ce730d8ba4d3b4e9738c1dccc1b"}, - {file = "uvloop-0.17.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:cbbe908fda687e39afd6ea2a2f14c2c3e43f2ca88e3a11964b297822358d0e6c"}, - {file = "uvloop-0.17.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3d97672dc709fa4447ab83276f344a165075fd9f366a97b712bdd3fee05efae8"}, - {file = "uvloop-0.17.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f1e507c9ee39c61bfddd79714e4f85900656db1aec4d40c6de55648e85c2799c"}, - {file = "uvloop-0.17.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:c092a2c1e736086d59ac8e41f9c98f26bbf9b9222a76f21af9dfe949b99b2eb9"}, - {file = "uvloop-0.17.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:30babd84706115626ea78ea5dbc7dd8d0d01a2e9f9b306d24ca4ed5796c66ded"}, - {file = "uvloop-0.17.0.tar.gz", hash = "sha256:0ddf6baf9cf11a1a22c71487f39f15b2cf78eb5bde7e5b45fbb99e8a9d91b9e1"}, + {file = "uvloop-0.18.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:1f354d669586fca96a9a688c585b6257706d216177ac457c92e15709acaece10"}, + {file = "uvloop-0.18.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:280904236a5b333a273292b3bcdcbfe173690f69901365b973fa35be302d7781"}, + {file = "uvloop-0.18.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ad79cd30c7e7484bdf6e315f3296f564b3ee2f453134a23ffc80d00e63b3b59e"}, + {file = "uvloop-0.18.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:99deae0504547d04990cc5acf631d9f490108c3709479d90c1dcd14d6e7af24d"}, + {file = "uvloop-0.18.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:edbb4de38535f42f020da1e3ae7c60f2f65402d027a08a8c60dc8569464873a6"}, + {file = "uvloop-0.18.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:54b211c46facb466726b227f350792770fc96593c4ecdfaafe20dc00f3209aef"}, + {file = "uvloop-0.18.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:25b714f07c68dcdaad6994414f6ec0f2a3b9565524fba181dcbfd7d9598a3e73"}, + {file = "uvloop-0.18.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1121087dfeb46e9e65920b20d1f46322ba299b8d93f7cb61d76c94b5a1adc20c"}, + {file = "uvloop-0.18.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:74020ef8061678e01a40c49f1716b4f4d1cc71190d40633f08a5ef8a7448a5c6"}, + {file = "uvloop-0.18.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f4a549cd747e6f4f8446f4b4c8cb79504a8372d5d3a9b4fc20e25daf8e76c05"}, + {file = "uvloop-0.18.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:6132318e1ab84a626639b252137aa8d031a6c0550250460644c32ed997604088"}, + {file = "uvloop-0.18.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:585b7281f9ea25c4a5fa993b1acca4ad3d8bc3f3fe2e393f0ef51b6c1bcd2fe6"}, + {file = "uvloop-0.18.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:61151cc207cf5fc88863e50de3d04f64ee0fdbb979d0b97caf21cae29130ed78"}, + {file = "uvloop-0.18.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:c65585ae03571b73907b8089473419d8c0aff1e3826b3bce153776de56cbc687"}, + {file = "uvloop-0.18.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e3d301e23984dcbc92d0e42253e0e0571915f0763f1eeaf68631348745f2dccc"}, + {file = "uvloop-0.18.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:680da98f12a7587f76f6f639a8aa7708936a5d17c5e7db0bf9c9d9cbcb616593"}, + {file = "uvloop-0.18.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:75baba0bfdd385c886804970ae03f0172e0d51e51ebd191e4df09b929771b71e"}, + {file = "uvloop-0.18.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:ed3c28337d2fefc0bac5705b9c66b2702dc392f2e9a69badb1d606e7e7f773bb"}, + {file = "uvloop-0.18.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:56c1026a6b0d12b378425e16250acb7d453abaefe7a2f5977143898db6cfe5bd"}, + {file = "uvloop-0.18.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:12af0d2e1b16780051d27c12de7e419b9daeb3516c503ab3e98d364cc55303bb"}, + {file = "uvloop-0.18.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b028776faf9b7a6d0a325664f899e4c670b2ae430265189eb8d76bd4a57d8a6e"}, + {file = "uvloop-0.18.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53aca21735eee3859e8c11265445925911ffe410974f13304edb0447f9f58420"}, + {file = "uvloop-0.18.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:847f2ed0887047c63da9ad788d54755579fa23f0784db7e752c7cf14cf2e7506"}, + {file = "uvloop-0.18.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6e20bb765fcac07879cd6767b6dca58127ba5a456149717e0e3b1f00d8eab51c"}, + {file = "uvloop-0.18.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:e14de8800765b9916d051707f62e18a304cde661fa2b98a58816ca38d2b94029"}, + {file = "uvloop-0.18.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f3b18663efe0012bc4c315f1b64020e44596f5fabc281f5b0d9bc9465288559c"}, + {file = "uvloop-0.18.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c6d341bc109fb8ea69025b3ec281fcb155d6824a8ebf5486c989ff7748351a37"}, + {file = "uvloop-0.18.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:895a1e3aca2504638a802d0bec2759acc2f43a0291a1dff886d69f8b7baff399"}, + {file = "uvloop-0.18.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:4d90858f32a852988d33987d608bcfba92a1874eb9f183995def59a34229f30d"}, + {file = "uvloop-0.18.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:db1fcbad5deb9551e011ca589c5e7258b5afa78598174ac37a5f15ddcfb4ac7b"}, + {file = "uvloop-0.18.0.tar.gz", hash = "sha256:d5d1135beffe9cd95d0350f19e2716bc38be47d5df296d7cc46e3b7557c0d1ff"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 25abf22cdd..2d69b0c1e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries", @@ -72,7 +73,7 @@ Repository = "https://github.com/litestar-org/litestar" annotated-types = ["annotated-types"] attrs = ["attrs"] brotli = ["brotli"] -cli = ["jsbeautifier", "uvicorn[standard]"] +cli = ["jsbeautifier", "uvicorn[standard]", "uvloop>=0.18.0"] cryptography = ["cryptography"] jinja = ["jinja2>=3.1.2"] jwt = ["python-jose", "cryptography"] @@ -85,7 +86,7 @@ prometheus = ["prometheus-client"] pydantic = ["pydantic[email]", "pydantic-extra-types"] redis = ["redis[hiredis]>=4.4.4"] sqlalchemy = ["advanced-alchemy==0.2.2"] -standard = ["jinja2", "jsbeautifier", "uvicorn[standard]", "fast-query-parsers>=1.0.2"] +standard = ["jinja2", "jsbeautifier", "uvicorn[standard]", "uvloop>=0.18.0", "fast-query-parsers>=1.0.2"] structlog = ["structlog"] full = [ "litestar[annotated-types,attrs,brotli,cli,cryptography,jinja,jwt,mako,minijinja,opentelemetry,piccolo,picologging,prometheus,pydantic,redis,sqlalchemy,standard,structlog]", From dfda276c079537e25f797362780eb18725c778f4 Mon Sep 17 00:00:00 2001 From: Peter Schutt Date: Sun, 15 Oct 2023 13:10:33 +1000 Subject: [PATCH 06/13] Compat for changes to QueueListener/QueueHandler config. --- litestar/logging/config.py | 1 + litestar/logging/standard.py | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/litestar/logging/config.py b/litestar/logging/config.py index dcf3ea3026..33aab89a92 100644 --- a/litestar/logging/config.py +++ b/litestar/logging/config.py @@ -40,6 +40,7 @@ "class": "litestar.logging.standard.QueueListenerHandler", "level": "DEBUG", "formatter": "standard", + "handlers": ["console"], }, } diff --git a/litestar/logging/standard.py b/litestar/logging/standard.py index 9140325a24..e10e9a5cbd 100644 --- a/litestar/logging/standard.py +++ b/litestar/logging/standard.py @@ -1,6 +1,7 @@ from __future__ import annotations import atexit +import sys from logging import StreamHandler from logging.handlers import QueueHandler, QueueListener from queue import Queue @@ -11,18 +12,21 @@ __all__ = ("QueueListenerHandler",) -class QueueListenerHandler(QueueHandler): - """Configure queue listener and handler to support non-blocking logging configuration.""" +if sys.version_info < (3, 12): + class QueueListenerHandler(QueueHandler): + """Configure queue listener and handler to support non-blocking logging configuration.""" - def __init__(self, handlers: list[Any] | None = None) -> None: - """Initialize `?QueueListenerHandler`. + def __init__(self, handlers: list[Any] | None = None) -> None: + """Initialize `?QueueListenerHandler`. - Args: - handlers: Optional 'ConvertingList' - """ - super().__init__(Queue(-1)) - handlers = resolve_handlers(handlers) if handlers else [StreamHandler()] - self.listener = QueueListener(self.queue, *handlers) - self.listener.start() + Args: + handlers: Optional 'ConvertingList' + """ + super().__init__(Queue(-1)) + handlers = resolve_handlers(handlers) if handlers else [StreamHandler()] + self.listener = QueueListener(self.queue, *handlers) + self.listener.start() - atexit.register(self.listener.stop) + atexit.register(self.listener.stop) +else: + QueueListenerHandler = QueueHandler From 1b18b5ba471640520991f06fd5515f346f869ac4 Mon Sep 17 00:00:00 2001 From: Peter Schutt Date: Sun, 15 Oct 2023 13:27:36 +1000 Subject: [PATCH 07/13] Fix for test modifying global state. --- tests/unit/test_logging/test_logging_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_logging/test_logging_config.py b/tests/unit/test_logging/test_logging_config.py index 492e0ebece..05358eab42 100644 --- a/tests/unit/test_logging/test_logging_config.py +++ b/tests/unit/test_logging/test_logging_config.py @@ -148,8 +148,8 @@ def test_root_logger(handlers: Any, listener: Any) -> None: [default_picologging_handlers, PicologgingQueueListenerHandler], ], ) -def test_customizing_handler(handlers: Any, listener: Any) -> None: - handlers["queue_listener"]["handlers"] = ["cfg://handlers.console"] +def test_customizing_handler(handlers: Any, listener: Any, monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setitem(handlers["queue_listener"], "handlers", ["cfg://handlers.console"]) logging_config = LoggingConfig(handlers=handlers) get_logger = logging_config.configure() From 4a630a03368a265052c2b7e38b2db3ca4a898050 Mon Sep 17 00:00:00 2001 From: Peter Schutt Date: Sun, 15 Oct 2023 13:36:13 +1000 Subject: [PATCH 08/13] Fix test assertions. --- tests/unit/test_cli/test_session_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_cli/test_session_commands.py b/tests/unit/test_cli/test_session_commands.py index 7c32f0b3bb..4841c50473 100644 --- a/tests/unit/test_cli/test_session_commands.py +++ b/tests/unit/test_cli/test_session_commands.py @@ -48,7 +48,7 @@ def test_delete_session( result = runner.invoke(cli_command, ["sessions", "delete", "foo"]) - assert mock_confirm_ask.called_once_with("[red]Delete session 'foo'?") + mock_confirm_ask.assert_called_once_with("Delete session 'foo'?") assert not result.exception mock_delete.assert_called_once_with("foo") @@ -78,6 +78,6 @@ def test_clear_sessions( result = runner.invoke(cli_command, ["sessions", "clear"]) - assert mock_confirm_ask.called_once_with("[red]Delete all sessions?") + mock_confirm_ask.assert_called_once_with("[red]Delete all sessions?") assert not result.exception mock_delete.assert_called_once() From 56740377c51098abce1194febe376289e05b3c0c Mon Sep 17 00:00:00 2001 From: Peter Schutt Date: Sun, 15 Oct 2023 13:43:56 +1000 Subject: [PATCH 09/13] xfail for 3.12 --- tests/unit/test_logging/test_logging_config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unit/test_logging/test_logging_config.py b/tests/unit/test_logging/test_logging_config.py index 05358eab42..453e9344b9 100644 --- a/tests/unit/test_logging/test_logging_config.py +++ b/tests/unit/test_logging/test_logging_config.py @@ -1,4 +1,5 @@ import logging +import sys from typing import TYPE_CHECKING, Any, Dict from unittest.mock import Mock, patch @@ -141,6 +142,7 @@ def test_root_logger(handlers: Any, listener: Any) -> None: isinstance(root_logger.handlers[0], listener) # type: ignore +@pytest.mark.xfail(condition=sys.version_info >= (3, 12), reason="change to QueueHandler/QueueListener config in 3.12") @pytest.mark.parametrize( "handlers, listener", [ From e8a739c90e734c4dd68116914b7a370628415735 Mon Sep 17 00:00:00 2001 From: Peter Schutt Date: Sun, 15 Oct 2023 13:44:03 +1000 Subject: [PATCH 10/13] fix formatting --- litestar/logging/standard.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/litestar/logging/standard.py b/litestar/logging/standard.py index e10e9a5cbd..467b2f1215 100644 --- a/litestar/logging/standard.py +++ b/litestar/logging/standard.py @@ -13,6 +13,7 @@ if sys.version_info < (3, 12): + class QueueListenerHandler(QueueHandler): """Configure queue listener and handler to support non-blocking logging configuration.""" @@ -28,5 +29,6 @@ def __init__(self, handlers: list[Any] | None = None) -> None: self.listener.start() atexit.register(self.listener.stop) + else: QueueListenerHandler = QueueHandler From d8251ce1966579771b9b84df8372cd199b1a6f26 Mon Sep 17 00:00:00 2001 From: Peter Schutt Date: Sun, 15 Oct 2023 13:53:59 +1000 Subject: [PATCH 11/13] fix xfail for parametrized test --- tests/unit/test_logging/test_logging_config.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_logging/test_logging_config.py b/tests/unit/test_logging/test_logging_config.py index 453e9344b9..a9fcfcddf7 100644 --- a/tests/unit/test_logging/test_logging_config.py +++ b/tests/unit/test_logging/test_logging_config.py @@ -142,11 +142,16 @@ def test_root_logger(handlers: Any, listener: Any) -> None: isinstance(root_logger.handlers[0], listener) # type: ignore -@pytest.mark.xfail(condition=sys.version_info >= (3, 12), reason="change to QueueHandler/QueueListener config in 3.12") @pytest.mark.parametrize( "handlers, listener", [ - [default_handlers, StandardQueueListenerHandler], + pytest.param( + default_handlers, + StandardQueueListenerHandler, + marks=pytest.mark.xfail( + condition=sys.version_info >= (3, 12), reason="change to QueueHandler/QueueListener config in 3.12" + ), + ), [default_picologging_handlers, PicologgingQueueListenerHandler], ], ) From 9fbbeaf04e4d567acb48fa97cb5990cbb8f368e8 Mon Sep 17 00:00:00 2001 From: Peter Schutt Date: Sun, 15 Oct 2023 14:46:28 +1000 Subject: [PATCH 12/13] fixes for structlog logic. Something seems to have changed in the way `isinstance()` proxies through from `BoundLoggerLazyProxy` to `BoundLogger`. --- litestar/logging/config.py | 1 - litestar/middleware/logging.py | 2 +- tests/unit/test_logging/test_structlog_config.py | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/litestar/logging/config.py b/litestar/logging/config.py index 33aab89a92..b986773c98 100644 --- a/litestar/logging/config.py +++ b/litestar/logging/config.py @@ -328,7 +328,6 @@ def configure(self) -> GetLogger: from structlog import configure, get_logger - # we now configure structlog configure( **{ k: v diff --git a/litestar/middleware/logging.py b/litestar/middleware/logging.py index d7f0374397..0779830e7b 100644 --- a/litestar/middleware/logging.py +++ b/litestar/middleware/logging.py @@ -106,7 +106,7 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: """ if not hasattr(self, "logger"): self.logger = scope["app"].get_logger(self.config.logger_name) - self.is_struct_logger = structlog_installed and isinstance(self.logger, BindableLogger) + self.is_struct_logger = structlog_installed and repr(self.logger).startswith(" None: with create_test_client([], logging_config=StructLoggingConfig()) as client: assert client.app.logger - assert isinstance(client.app.logger, BindableLogger) - client.app.logger.info("message", key="value") # type: ignore [attr-defined] + assert isinstance(client.app.logger.bind(), BindableLogger) + client.app.logger.info("message", key="value") log_messages = [decode_json(value=x) for x in capsys.readouterr().out.splitlines()] assert len(log_messages) == 1 @@ -29,11 +29,11 @@ def test_structlog_config_specify_processors(capsys: CaptureFixture) -> None: with create_test_client([], logging_config=logging_config) as client: assert client.app.logger - assert isinstance(client.app.logger, BindableLogger) + assert isinstance(client.app.logger.bind(), BindableLogger) - client.app.logger.info("message1", key="value1") # type: ignore [attr-defined] + client.app.logger.info("message1", key="value1") # Log twice to make sure issue #882 doesn't appear again - client.app.logger.info("message2", key="value2") # type: ignore [attr-defined] + client.app.logger.info("message2", key="value2") log_messages = [decode_json(value=x) for x in capsys.readouterr().out.splitlines()] From be9d4412bc5f24a684bb2bda1a82db035a028ad2 Mon Sep 17 00:00:00 2001 From: Jacob Coffee Date: Sat, 14 Oct 2023 23:56:13 -0500 Subject: [PATCH 13/13] Update pyproject.toml Co-authored-by: Peter Schutt --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 45da9dbd1e..ad781f5ba5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,7 @@ picologging = ["picologging"] prometheus = ["prometheus-client"] pydantic = ["pydantic[email]", "pydantic-extra-types"] redis = ["redis[hiredis]>=4.4.4"] -sqlalchemy = ["advanced-alchemy==0.2.2"] +sqlalchemy = ["advanced-alchemy>=0.2.2,<0.4.0"] standard = ["jinja2", "jsbeautifier", "uvicorn[standard]", "uvloop>=0.18.0", "fast-query-parsers>=1.0.2"] structlog = ["structlog"]