From 105466a3e9d1d044ad8aa884322ee12bd72e4bdb Mon Sep 17 00:00:00 2001 From: Nathan Zilora Date: Sat, 19 Apr 2025 00:03:58 -0400 Subject: [PATCH] Add Windows Compatibility and forward compatibility with Quart --- pyproject.toml | 5 +++-- src/quart_sqlalchemy/__init__.py | 2 +- src/quart_sqlalchemy/bind.py | 3 ++- tox.ini | 4 ++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a1842b4..6f71ea5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,13 @@ [project] name = "quart-sqlalchemy" -version = "3.0.4" +version = "3.0.5" description = "SQLAlchemy for humans, with framework adapter for Quart." authors = [ {name = "Joe Black", email = "me@joeblack.nyc"}, ] dependencies = [ - "quart<0.20.0,>=0.18.3", + "quart>=0.18.3 ; python_version >= '3.9'", + "quart<0.20.0,>=0.18.3 ; python_version < '3.9'", "werkzeug<3.1.0,>=2.2.0", "blinker<1.7,>=1.5", "SQLAlchemy[asyncio]<2.1.0,>=2.0.0", diff --git a/src/quart_sqlalchemy/__init__.py b/src/quart_sqlalchemy/__init__.py index 480941b..3f736eb 100644 --- a/src/quart_sqlalchemy/__init__.py +++ b/src/quart_sqlalchemy/__init__.py @@ -1,4 +1,4 @@ -__version__ = "3.0.4" +__version__ = "3.0.5" from .bind import AsyncBind from .bind import Bind diff --git a/src/quart_sqlalchemy/bind.py b/src/quart_sqlalchemy/bind.py index 8a69eaa..763da41 100644 --- a/src/quart_sqlalchemy/bind.py +++ b/src/quart_sqlalchemy/bind.py @@ -258,7 +258,8 @@ def register_engine_connection_cross_process_safety_handlers( def close_connections_for_forking(): engine.dispose(close=False) - os.register_at_fork(before=close_connections_for_forking) + if os.name == 'posix': + os.register_at_fork(before=close_connections_for_forking) def connect(dbapi_connection, connection_record): connection_record.info["pid"] = os.getpid() diff --git a/tox.ini b/tox.ini index 7df35be..aa4b1fe 100644 --- a/tox.ini +++ b/tox.ini @@ -4,11 +4,15 @@ skip_missing_interpreters = true skip_install = true [testenv] +allowlist_externals = + pdm commands = pdm install --dev pytest -v -rsx --tb=short --asyncio-mode=auto --py311-task true --loop-scope session {posargs} tests [testenv:q183] +allowlist_externals = + pdm commands = pdm install --dev pip install aiofiles==23.2.1 blinker==1.5 click==8.1.7 flask==2.2.1 quart==0.18.3 werkzeug==2.2.0 jinja2==3.1.2