Skip to content

chore!: Add python 3.13 support #1711

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

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d281879
Drop python 3.8. Add python 3.13
schloerke Oct 1, 2024
fdc685c
Update 3.13 python versions to 3.13-dev
schloerke Oct 1, 2024
21f1022
Remove `WrapAsync` code
schloerke Oct 1, 2024
958b051
Use `3.13.0-rc.2` version
schloerke Oct 1, 2024
d07d067
Bump python version to 3.13.0-rc.3
schloerke Oct 1, 2024
0ecd6dc
Merge branch 'main' into bump_versions
schloerke Oct 1, 2024
fe6e2da
Merge branch 'main' into bump_versions
schloerke Oct 7, 2024
c568fd3
Merge branch 'main' into bump_versions
schloerke Oct 7, 2024
43fd104
Try short version
schloerke Oct 7, 2024
97bba3f
Merge branch 'bump_versions' of https://github.com/posit-dev/py-shiny…
schloerke Oct 7, 2024
8f9e8c1
Update pytest.yaml
schloerke Oct 7, 2024
257f7f6
Allow for pre-releases
schloerke Oct 7, 2024
cf723ec
try using pip for now. Revert commit later!
schloerke Oct 7, 2024
5e7a61c
Revert "try using pip for now. Revert commit later!"
schloerke Oct 7, 2024
62d52ae
Update playwright as 1.43 depends on greenlet version that is incompa…
schloerke Oct 7, 2024
02e8f91
Reapply "try using pip for now. Revert commit later!"
schloerke Oct 7, 2024
70dfdfa
Revert "Reapply "try using pip for now. Revert commit later!""
schloerke Oct 7, 2024
a304dba
Remove `allow-prereleases: true` flag
schloerke Oct 10, 2024
5a84f69
Use playwright version from github until next release
schloerke Oct 11, 2024
4b8bb6a
Use playwright v1.48.0 w/ Py3.13 support
schloerke Oct 22, 2024
6afc4a9
Merge branch 'main' into bump_versions
schloerke Feb 3, 2025
940e032
Merge branch 'main' into bump_versions
cpsievert Feb 26, 2025
3db13c0
Don't install ray on pyton 3.13
cpsievert Feb 26, 2025
42ee7a2
Do same for modin
cpsievert Feb 26, 2025
40cc6da
Undo test_chat changes
cpsievert Feb 26, 2025
e450da5
Merge branch 'main' into bump_versions
cpsievert Mar 3, 2025
b8b6d24
fix(tests): skip modin tests if python version == 3.13 (#1882)
karangattu Mar 6, 2025
41af702
Merge branch 'main' into bump_versions
schloerke Apr 8, 2025
a3f675b
Skip test w/ modin for anyting >= 3.13
schloerke Apr 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .github/py-shiny/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ inputs:
python-version:
description: 'Python version to use'
required: false
default: "3.12"
default: "3.13"
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -39,12 +39,6 @@ runs:
run: |
make ci-install-wheel

- name: Install backports.tarfile
if: ${{ startsWith(inputs.python-version, '3.8') }}
shell: bash
run: |
uv pip install backports.tarfile

- name: Pip list
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
python-version: ["3.13"]
fail-fast: false

steps:
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
# "3.10" must be a string; otherwise it is interpreted as 3.1.
python-version: ["3.12", "3.11", "3.10", "3.9"]
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"]
os: [ubuntu-latest, windows-latest, macOS-latest]
exclude:
- python-version: ${{ github.event.pull_request.draft && '3.11' }}
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
with:
fetch-depth: 0
- name: "Set up Python 3.10"
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.11", "3.10", "3.9"]
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"]
browser: ["chromium", "firefox", "webkit"]
exclude:
- python-version: ${{ github.event.pull_request.draft && '3.11' }}
Expand All @@ -117,8 +117,6 @@ jobs:
- browser: ${{ github.event.pull_request.draft && 'webkit' }}
# There are many unexplained tests that fail on webkit w/ python 3.8, 3.9
# Given the more recent versions of python work, we will exclude this combination
- browser: "webkit"
python-version: "3.8"
- browser: "webkit"
python-version: "3.9"
fail-fast: false
Expand Down Expand Up @@ -157,7 +155,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.11", "3.10", "3.9"]
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9"]
browser: ["chromium", "firefox", "webkit"]
exclude:
- python-version: ${{ github.event.pull_request.draft && '3.11' }}
Expand Down
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"typing-extensions>=4.10.0",
Expand Down Expand Up @@ -54,8 +55,8 @@ theme = ["libsass>=0.23.0", "brand_yml>=0.1.0"]
test = [
"pytest>=6.2.4",
"pytest-asyncio>=0.17.2",
"pytest-playwright>=0.3.0",
"playwright>=1.43.0",
"pytest-playwright>=0.5.2",
"playwright>=1.48.0",
"pytest-xdist",
"pytest-timeout",
"pytest-rerunfailures",
Expand Down Expand Up @@ -86,7 +87,10 @@ test = [
"faicons",
"ridgeplot",
"great_tables",
"modin[all]",
# modin depends on ray, which doesn't support Python 3.13
"modin[all];python_version<'3.13'",
# ray doesn't currently support Python 3.13
"ray;python_version<'3.13'",
"polars",
"dask[dataframe]",
"pyarrow",
Expand Down
2 changes: 0 additions & 2 deletions shiny/_datastructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class PriorityQueueFIFO(Generic[T]):
"""

def __init__(self) -> None:
# Using Tuple instead of tuple because in Python 3.8 and earlier, tuple isn't
# generic
self._pq: PriorityQueue[tuple[int, int, T]] = PriorityQueue()
self._counter: int = 0

Expand Down
4 changes: 1 addition & 3 deletions shiny/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,14 @@ def sort_keys_length(x: dict[str, T], descending: bool = False) -> dict[str, T]:


def guess_mime_type(
url: "str | os.PathLike[str]",
url: str | os.PathLike[str],
default: str = "application/octet-stream",
strict: bool = True,
) -> str:
"""
Guess the MIME type of a file. This is a wrapper for mimetypes.guess_type, but it
only returns the type (and not encoding), and it allows a default value.
"""
# Note that in the parameters above, "os.PathLike[str]" is in quotes to avoid
# "TypeError: 'ABCMeta' object is not subscriptable", in Python<=3.8.
if url:
# Work around issue #1601, some installations of Windows 10 return text/plain
# as the mime type for .js files
Expand Down
3 changes: 0 additions & 3 deletions shiny/render/_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import os
import sys
import typing

# `typing.Dict` sed for python 3.8 compatibility
# Can use `dict` in python >= 3.9
from typing import TYPE_CHECKING, Any, Callable, Literal, Optional, Union, cast

from htmltools import Tag, TagAttrValue, TagChild
Expand Down
3 changes: 0 additions & 3 deletions shiny/render/renderer/_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,6 @@ def _auto_register(self) -> None:
self._auto_registered = True


# Not inheriting from `WrapAsync[[], IT]` as python 3.8 needs typing extensions that
# doesn't support `[]` for a ParamSpec definition. :-( Would be minimal/clean if we
# could do `class AsyncValueFn(WrapAsync[[], IT]):`
class AsyncValueFn(Generic[IT]):
"""
App-supplied output value function which returns type `IT`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
from __future__ import annotations

import modin.pandas as mpd # pyright: ignore[reportMissingTypeStubs]
import sys

# Remove this conditional once modin is supported on Python 3.13
if sys.version_info < (3, 13):
import modin.pandas as mpd # pyright: ignore[reportMissingTypeStubs]
else:
raise RuntimeError("This test is not supported on Python 3.13")

import narwhals.stable.v1 as nw
import palmerpenguins # pyright: ignore[reportMissingTypeStubs]
import polars as pl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import re
import sys

import pytest
from playwright.sync_api import Page

from shiny.playwright import controller
Expand Down Expand Up @@ -39,6 +41,10 @@
]


@pytest.mark.skipif(
sys.version_info[:2] == (3, 13),
reason="Skipping on Python 3.13, since modin is not supported on 3.13",
)
def test_data_frame_data_type(
page: Page,
local_app: ShinyAppProc,
Expand Down
9 changes: 8 additions & 1 deletion tests/playwright/shiny/components/table/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
from __future__ import annotations

import modin.pandas as md # pyright: ignore[reportMissingTypeStubs]
import sys

# Remove this conditional once modin is supported on Python 3.13
if sys.version_info < (3, 13):
import modin.pandas as md # pyright: ignore[reportMissingTypeStubs]
else:
# This block executes for Python 3.13 and above
raise RuntimeError("This test is not supported on Python 3.13")
import narwhals.stable.v1 as nw
import palmerpenguins # pyright: ignore[reportMissingTypeStubs]

Expand Down
6 changes: 6 additions & 0 deletions tests/playwright/shiny/components/table/test_table.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import re
import sys

import pytest
from playwright.sync_api import Page

from shiny.playwright import controller
from shiny.run import ShinyAppProc


@pytest.mark.skipif(
sys.version_info >= (3, 13),
reason="Skipping on Python 3.13 and above, since modin is not supported on these versions",
)
def test_table_data_support(page: Page, local_app: ShinyAppProc) -> None:
page.goto(local_app.url)

Expand Down
Loading