-
-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for Python 3.13 #3850
base: main
Are you sure you want to change the base?
Conversation
@@ -96,7 +101,7 @@ opentelemetry = ["opentelemetry-instrumentation-asgi"] | |||
piccolo = ["piccolo"] | |||
picologging = ["picologging"] | |||
prometheus = ["prometheus-client"] | |||
pydantic = ["pydantic", "email-validator", "pydantic-extra-types"] | |||
pydantic = ["pydantic", "email-validator", "pydantic-extra-types<=2.9.0; python_version < \"3.9\"", "pydantic-extra-types>=2.9.0; python_version >= \"3.9\""] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an open build issue re: this.
@@ -130,13 +135,14 @@ dev = [ | |||
"trio", | |||
"aiosqlite", | |||
"asyncpg>=0.29.0", | |||
"psycopg[pool,binary]>=3.1.10,<3.2", | |||
"psycopg[pool,binary]>=3.1.10,<3.2; python_version < \"3.13\"", | |||
"psycopg[pool,c]; python_version >= \"3.13\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Package needs to be built for 3.13
from litestar.testing import TestClient | ||
|
||
pytestmark = pytest.mark.xdist_group("sqlalchemy_examples") | ||
|
||
|
||
def test_sqlalchemy_declarative_models() -> None: | ||
from docs.examples.contrib.sqlalchemy.sqlalchemy_declarative_models import app | ||
async def test_sqlalchemy_declarative_models(tmp_path: Path, monkeypatch: MonkeyPatch) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this additional monkey-patching, there were intermittent failures on this job. This is the only way I could make the tests consistently pass on all python versions.
@@ -90,9 +92,9 @@ def cleanup_logging_impl() -> Generator: | |||
# Don't interfere with PyTest handler config | |||
if not isinstance(std_handler, (_LiveLoggingNullHandler, LogCaptureHandler)): | |||
std_root_logger.removeHandler(std_handler) | |||
|
|||
picologging = pytest.importorskip("picologging") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL about this. It will auto-skip if this import fails
|
||
exec(f"async def test_fn({reserved_kwarg}: int) -> None: pass") | ||
handler_with_path_param = decorator("/{" + reserved_kwarg + ":int}")(locals()["test_fn"]) | ||
local = dict(locals(), **globals()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also caused some weird issues with the scope of the locals()
output. This was the only way I could consistently make sure the call to locals
contained the test_fn
key
"anyio>=4 ; python_version >= \"3.9\"", | ||
"httpx>=0.22", | ||
"exceptiongroup; python_version < \"3.11\"", | ||
"eval_type_backport; python_version <= \"3.9\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious: Why do we need this?
Description
This PR implements support for Python 3.13.
Note
msgspec
built by the Litestar team. This is a drop in replacement until the official pre-built wheels are available.msgspec
implementation, while all other versions prefer the pre-built litestar wheels.psycopg[binary]
. If you rely on this for development, you'll need to have the postgres development libraries installedpicologging
does not currently support Python 3.13. These tests are skipped automatically.Closes