Skip to content

Commit

Permalink
Merge pull request #66 from melvinkcx/feat/python3.13
Browse files Browse the repository at this point in the history
update tox and test dependencies to cover up to Python 3.13
  • Loading branch information
melvinkcx authored Dec 21, 2024
2 parents ffead0e + 5621cf2 commit 9793359
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 21 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
on: [ push, pull_request ]
on:
pull_request:
push:
branches:
- dev

jobs:
pytest:
Expand All @@ -7,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ 3.7, 3.8, 3.9, '3.10', '3.11' ]
python-version: [ 3.8, 3.9, '3.10', '3.11', '3.12', '3.13' ]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ An event dispatching/handling library for FastAPI, and Starlette.

[![](https://github.com/melvinkcx/fastapi-events/actions/workflows/tests.yml/badge.svg?branch=dev&event=push)](https://github.com/melvinkcx/fastapi-events/actions/workflows/tests.yml)
![PyPI - Downloads](https://img.shields.io/pypi/dw/fastapi-events)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/fastapi-events)


Features:

Expand Down
4 changes: 3 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ minversion = 6.2
python_files =
middleware/test_*.py
test_*.py
asyncio_mode=auto
asyncio_mode = auto
asyncio_default_fixture_loop_scope = function
env =
AWS_ACCESS_KEY_ID=testing
AWS_SECRET_ACCESS_KEY=testing
AWS_SECURITY_TOKEN=testing
AWS_SESSION_TOKEN=testing

3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ def get_long_description():
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
},
python_requires=">=3.7",
keywords=["starlette", "fastapi", "starlite", "pydantic"],
Expand Down
2 changes: 1 addition & 1 deletion tests/middleware/test_starlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ def global_exception_handler(request, exc):
exception_handlers[ValueError] = global_exception_handler

client = create_test_client(
[root],
exception_handlers=exception_handlers,
middleware=[
DefineMiddleware(
EventHandlerASGIMiddleware,
handlers=[dummy_handler_1, dummy_handler_2],
),
],
route_handlers=[root],
)

with suppress(ValueError):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import functools
import os
import uuid
from datetime import datetime
from datetime import datetime, timezone
from enum import Enum
from typing import Optional

Expand Down Expand Up @@ -64,7 +64,7 @@ async def test_suppression_of_events_in_req_res_cycle(
@pytest.mark.asyncio
@pytest.mark.parametrize(
"event_payload,should_raise_error",
(({"user_id": uuid.uuid4(), "created_at": datetime.utcnow()}, False),
(({"user_id": uuid.uuid4(), "created_at": datetime.now(timezone.utc)}, False),
({"user_id": uuid.uuid4()}, True),
({}, True),
(None, True)))
Expand Down
55 changes: 41 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,27 @@ requires =
env_list =
flake8
isort
py{37,38,39,310,311}-starlite
py{37,38,39,310,311}-fastapi{092,093,094,095,096,097,098,099}-pydantic{1}
py{37,38,39,310,311}-fastapi{0100,0101}-pydantic{1,2}
py{38,39,310,311,312,313}-starlite
py{38,39,310,311}-fastapi{092,093,094,095,096,097,098,099}-pydantic{1}
py{38,39,310,311}-fastapi{0100,0101}-pydantic{1,2}
py{311,312,313}-fastapi{0102,0103,0104,0105,0106,0107,0108,0109,0111,0112,0113,0114,0115}-pydantic{2}

[gh]
python =
3.11 = flake8, isort, py311-starlite, py311-fastapi{092,093,094,095,096,097,098,099}-pydantic{1}, py311-fastapi{0100,0101}-pydantic{1}
3.10 = py310-starlite, py310-fastapi{092,093,094,095,096,097,098,099}-pydantic{1}, py310-fastapi{0100,0101}-pydantic{1}
3.13 = flake8, isort, py313-starlite, py313-fastapi{0102,0103,0104,0105,0106,0107,0108,0109,0111,0112,0113,0114,0115}-pydantic{2}
3.12 = flake8, isort, py312-starlite, py312-fastapi{0102,0103,0104,0105,0106,0107,0108,0109,0111,0112,0113,0114,0115}-pydantic{2}
3.11 = flake8, isort, py311-starlite, py311-fastapi{092,093,094,095,096,097,098,099}-pydantic{1}, py311-fastapi{0100,0101}-pydantic{1,2}, py311-fastapi{0102,0103,0104,0105,0106,0107,0108,0109,0111,0112,0113,0114,0115}-pydantic{2}
3.10 = py310-starlite, py310-fastapi{092,093,094,095,096,097,098,099}-pydantic{1}, py310-fastapi{0100,0101}-pydantic{1,2}
3.9 = py39-starlite, py39-fastapi{092,093,094,095,096,097,098,099}-pydantic{1}, py39-fastapi{0100,0101}-pydantic{1}
3.8 = py38-starlite, py38-fastapi{092,093,094,095,096,097,098,099}-pydantic{1}, py38-fastapi{0100,0101}-pydantic{1}
3.7 = py37-starlite, py37-fastapi{092,093,094,095,096,097,098,099}-pydantic{1}, py37-fastapi{0100,0101}-pydantic{1}

[base]
deps =
pytest>=6.2.4
pytest-asyncio>=0.18.3
pytest-env>=0.6.2
pytest-mock>=3.6.1
moto[sqs]>=4.2.14
pytest>=8.3.4
pytest-asyncio>=0.24.0
pytest-env>=1.1.5
pytest-mock>=3.14.0
moto[sqs]>=4.2.14,<5
mypy>=0.971
pytest-mypy>=0.9.1

Expand All @@ -34,7 +36,7 @@ deps =
opentelemetry-test-utils>=0.33b0
opentelemetry-sdk>=1.12.0

httpx>=0.23.0
httpx>=0.23.0,<0.28

[testenv:flake8]
description = run flake8
Expand All @@ -48,14 +50,25 @@ deps = isort>=5.10.1
commands =
isort --check-only ./fastapi_events ./tests

[testenv:py{37,38,39,310,311}-starlite]
[testenv:py{38,39,310,311,312}-starlite]
description : run test for starlite
deps =
{[base]deps}
pydantic>=1.0,<2.0
starlite>=1.38.0,<=2
commands =
pytest tests/middleware/test_starlite.py
[testenv:py{313}-starlite]
description : run test for starlite
deps =
; see: https://github.com/jcrist/msgspec/issues/698
git+https://github.com/jcrist/msgspec.git@main
{[base]deps}
pydantic>=1.0,<2.0
starlite>=1.38.0,<=2
commands =
pytest tests/middleware/test_starlite.py


[testenv]
description = run pytest for fastapi
Expand All @@ -70,7 +83,21 @@ deps =
fastapi098: fastapi>=0.98,<0.99
fastapi099: fastapi>=0.99,<0.100
fastapi0100: fastapi>=0.100,<0.101
fastapi0101: fastapi>=0.101
fastapi0101: fastapi>=0.101,<0.102
fastapi0102: fastapi>=0.102,<0.103
fastapi0103: fastapi>=0.103,<0.104
fastapi0104: fastapi>=0.104,<0.105
fastapi0105: fastapi>=0.105,<0.106
fastapi0106: fastapi>=0.106,<0.107
fastapi0107: fastapi>=0.107,<0.108
fastapi0108: fastapi>=0.108,<0.109
fastapi0109: fastapi>=0.109,<0.110
fastapi0110: fastapi>=0.110,<0.111
fastapi0111: fastapi>=0.111,<0.112
fastapi0112: fastapi>=0.112,<0.113
fastapi0113: fastapi>=0.113,<0.114
fastapi0114: fastapi>=0.114,<0.115
fastapi0115: fastapi>=0.115
pydantic1: pydantic[email]>=1.0,<2
pydantic2: pydantic[email]>=2.0,<3
commands =
Expand Down

0 comments on commit 9793359

Please sign in to comment.