Support python 3.13 (#4206)

* bump playwright and run tests with 3.13

* test with psycopg3

* typo

* update everything for psycopg 3.
This commit is contained in:
Thomas Brandého 2024-12-12 00:10:51 -08:00 committed by GitHub
parent a86d2c612a
commit 5e026e4b27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 32 additions and 32 deletions

View File

@ -58,7 +58,7 @@ jobs:
working-directory: ./reflex-web
run: poetry run uv pip install -r requirements.txt
- name: Install additional dependencies for DB access
run: poetry run uv pip install psycopg2-binary
run: poetry run uv pip install psycopg
- name: Init Website for reflex-web
working-directory: ./reflex-web
run: poetry run reflex init

View File

@ -22,9 +22,9 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
state_manager: ["redis", "memory"]
state_manager: ['redis', 'memory']
python-version: ['3.11.5', '3.12.0', '3.13.0']
split_index: [1, 2]
python-version: ["3.11.5", "3.12.0"]
fail-fast: false
runs-on: ubuntu-22.04
services:

View File

@ -43,7 +43,7 @@ jobs:
matrix:
# Show OS combos first in GUI
os: [ubuntu-latest, windows-latest]
python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0']
python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0', '3.13.0']
exclude:
- os: windows-latest
python-version: '3.10.13'
@ -73,7 +73,7 @@ jobs:
run: |
poetry run uv pip install -r requirements.txt
- name: Install additional dependencies for DB access
run: poetry run uv pip install psycopg2-binary
run: poetry run uv pip install psycopg
- name: Check export --backend-only before init for counter example
working-directory: ./reflex-examples/counter
run: |
@ -147,7 +147,7 @@ jobs:
working-directory: ./reflex-web
run: poetry run uv pip install $(grep -ivE "reflex " requirements.txt)
- name: Install additional dependencies for DB access
run: poetry run uv pip install psycopg2-binary
run: poetry run uv pip install psycopg
- name: Init Website for reflex-web
working-directory: ./reflex-web
run: poetry run reflex init
@ -216,7 +216,7 @@ jobs:
working-directory: ./reflex-web
run: poetry run uv pip install -r requirements.txt
- name: Install additional dependencies for DB access
run: poetry run uv pip install psycopg2-binary
run: poetry run uv pip install psycopg
- name: Init Website for reflex-web
working-directory: ./reflex-web
run: poetry run reflex init

View File

@ -28,7 +28,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0']
python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0', '3.13.0']
# Windows is a bit behind on Python version availability in Github
exclude:
- os: windows-latest
@ -88,7 +88,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0']
python-version: ['3.9.18', '3.10.13', '3.11.5', '3.12.0', '3.13.0']
runs-on: macos-12
steps:
- uses: actions/checkout@v4

View File

@ -52,7 +52,7 @@ FROM python:3.13-slim
WORKDIR /app
RUN adduser --disabled-password --home /app reflex
COPY --chown=reflex --from=init /app /app
# Install libpq-dev for psycopg2 (skip if not using postgres).
# Install libpq-dev for psycopg (skip if not using postgres).
RUN apt-get update -y && apt-get install -y libpq-dev && rm -rf /var/lib/apt/lists/*
USER reflex
ENV PATH="/app/.venv/bin:$PATH" PYTHONUNBUFFERED=1

View File

@ -39,7 +39,7 @@ FROM python:3.13-slim
WORKDIR /app
RUN adduser --disabled-password --home /app reflex
COPY --chown=reflex --from=init /app /app
# Install libpq-dev for psycopg2 (skip if not using postgres).
# Install libpq-dev for psycopg (skip if not using postgres).
RUN apt-get update -y && apt-get install -y libpq-dev && rm -rf /var/lib/apt/lists/*
USER reflex
ENV PATH="/app/.venv/bin:$PATH" PYTHONUNBUFFERED=1

View File

@ -15,7 +15,7 @@ services:
app:
environment:
DB_URL: postgresql+psycopg2://postgres:secret@db/postgres
DB_URL: postgresql+psycopg://postgres:secret@db/postgres
REDIS_URL: redis://redis:6379
depends_on:
- db

16
poetry.lock generated
View File

@ -1542,18 +1542,18 @@ type = ["mypy (>=1.11.2)"]
[[package]]
name = "playwright"
version = "1.49.0"
version = "1.49.1"
description = "A high-level API to automate web browsers"
optional = false
python-versions = ">=3.9"
files = [
{file = "playwright-1.49.0-py3-none-macosx_10_13_x86_64.whl", hash = "sha256:704532a2d8ba580ec9e1895bfeafddce2e3d52320d4eb8aa38e80376acc5cbb0"},
{file = "playwright-1.49.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e453f02c4e5cc2db7e9759c47e7425f32e50ac76c76b7eb17c69eed72f01c4d8"},
{file = "playwright-1.49.0-py3-none-macosx_11_0_universal2.whl", hash = "sha256:37ae985309184472946a6eb1a237e5d93c9e58a781fa73b75c8751325002a5d4"},
{file = "playwright-1.49.0-py3-none-manylinux1_x86_64.whl", hash = "sha256:68d94beffb3c9213e3ceaafa66171affd9a5d9162e0c8a3eed1b1132c2e57598"},
{file = "playwright-1.49.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7f12d2aecdb41fc25a624cb15f3e8391c252ebd81985e3d5c1c261fe93779345"},
{file = "playwright-1.49.0-py3-none-win32.whl", hash = "sha256:91103de52d470594ad375b512d7143fa95d6039111ae11a93eb4fe2f2b4a4858"},
{file = "playwright-1.49.0-py3-none-win_amd64.whl", hash = "sha256:34d28a2c2d46403368610be4339898dc9c34eb9f7c578207b4715c49743a072a"},
{file = "playwright-1.49.1-py3-none-macosx_10_13_x86_64.whl", hash = "sha256:1041ffb45a0d0bc44d698d3a5aa3ac4b67c9bd03540da43a0b70616ad52592b8"},
{file = "playwright-1.49.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:9f38ed3d0c1f4e0a6d1c92e73dd9a61f8855133249d6f0cec28648d38a7137be"},
{file = "playwright-1.49.1-py3-none-macosx_11_0_universal2.whl", hash = "sha256:3be48c6d26dc819ca0a26567c1ae36a980a0303dcd4249feb6f59e115aaddfb8"},
{file = "playwright-1.49.1-py3-none-manylinux1_x86_64.whl", hash = "sha256:753ca90ee31b4b03d165cfd36e477309ebf2b4381953f2a982ff612d85b147d2"},
{file = "playwright-1.49.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cd9bc8dab37aa25198a01f555f0a2e2c3813fe200fef018ac34dfe86b34994b9"},
{file = "playwright-1.49.1-py3-none-win32.whl", hash = "sha256:43b304be67f096058e587dac453ece550eff87b8fbed28de30f4f022cc1745bb"},
{file = "playwright-1.49.1-py3-none-win_amd64.whl", hash = "sha256:47b23cb346283278f5b4d1e1990bcb6d6302f80c0aa0ca93dd0601a1400191df"},
]
[package.dependencies]

View File

@ -82,7 +82,7 @@ class DBConfig(Base):
)
@classmethod
def postgresql_psycopg2(
def postgresql_psycopg(
cls,
database: str,
username: str,
@ -90,7 +90,7 @@ class DBConfig(Base):
host: str | None = None,
port: int | None = 5432,
) -> DBConfig:
"""Create an instance with postgresql+psycopg2 engine.
"""Create an instance with postgresql+psycopg engine.
Args:
database: Database name.
@ -103,7 +103,7 @@ class DBConfig(Base):
DBConfig instance.
"""
return cls(
engine="postgresql+psycopg2",
engine="postgresql+psycopg",
username=username,
password=password,
host=host,

View File

@ -164,7 +164,7 @@ def test_constructor_postgresql(username, password, host, port, database, expect
"localhost",
5432,
"db",
"postgresql+psycopg2://user:pass@localhost:5432/db",
"postgresql+psycopg://user:pass@localhost:5432/db",
),
(
"user",
@ -172,17 +172,17 @@ def test_constructor_postgresql(username, password, host, port, database, expect
"localhost",
None,
"db",
"postgresql+psycopg2://user@localhost/db",
"postgresql+psycopg://user@localhost/db",
),
("user", "", "", None, "db", "postgresql+psycopg2://user@/db"),
("", "", "localhost", 5432, "db", "postgresql+psycopg2://localhost:5432/db"),
("", "", "", None, "db", "postgresql+psycopg2:///db"),
("user", "", "", None, "db", "postgresql+psycopg://user@/db"),
("", "", "localhost", 5432, "db", "postgresql+psycopg://localhost:5432/db"),
("", "", "", None, "db", "postgresql+psycopg:///db"),
],
)
def test_constructor_postgresql_psycopg2(
def test_constructor_postgresql_psycopg(
username, password, host, port, database, expected_url
):
"""Test DBConfig.postgresql_psycopg2 constructor creates the instance correctly.
"""Test DBConfig.postgresql_psycopg constructor creates the instance correctly.
Args:
username: Database username.
@ -192,10 +192,10 @@ def test_constructor_postgresql_psycopg2(
database: Database name.
expected_url: Expected database URL generated.
"""
db_config = DBConfig.postgresql_psycopg2(
db_config = DBConfig.postgresql_psycopg(
username=username, password=password, host=host, port=port, database=database
)
assert db_config.engine == "postgresql+psycopg2"
assert db_config.engine == "postgresql+psycopg"
assert db_config.username == username
assert db_config.password == password
assert db_config.host == host