Skip to content

Commit

Permalink
build: support Python 3.13 (#1263)
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftinv authored Dec 29, 2024
1 parent 18535bb commit 6bcecb2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# FIXME: using specific patch version for 3.12 due to pdm bug
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12.7"]
experimental: [false]
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions changelog/1263.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support Python 3.13.
16 changes: 13 additions & 3 deletions disnake/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@

from .voice_client import VoiceClient

with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
import audioop
try:
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
import audioop

has_audioop = True
except ImportError:
has_audioop = False

MISSING = utils.MISSING

Expand Down Expand Up @@ -660,6 +665,11 @@ class PCMVolumeTransformer(AudioSource, Generic[AT]):
"""

def __init__(self, original: AT, volume: float = 1.0) -> None:
if not has_audioop:
raise RuntimeError(
f"audioop-lts library needed in Python >=3.13 in order to use {type(self).__name__}"
)

if not isinstance(original, AudioSource):
raise TypeError(f"expected AudioSource not {original.__class__.__name__}.")

Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def pyright(session: nox.Session) -> None:
pass


@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"])
@nox.parametrize(
"extras",
[
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Internet",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand All @@ -51,6 +52,7 @@ speed = [
]
voice = [
"PyNaCl>=1.5.0,<1.6",
'audioop-lts==0.2.1; python_version >= "3.13"'
]
docs = [
"sphinx==7.0.1",
Expand Down Expand Up @@ -125,7 +127,6 @@ runner = "pdm run"

[tool.black]
line-length = 100
target-version = ["py38", "py39", "py310", "py311", "py312"]

[tool.ruff]
line-length = 100
Expand Down

0 comments on commit 6bcecb2

Please sign in to comment.