Skip to content

Commit 7087cfe

Browse files
committed
Drop Python 3.9, Adapt code to Python 3.10 standards and add support for Python 3.14
1 parent 8f40946 commit 7087cfe

33 files changed

Lines changed: 402 additions & 414 deletions

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
- name: Checkout
1717
uses: actions/checkout@v4
1818

19-
- name: Setup Python 3.9
19+
- name: Setup Python 3.10
2020
uses: actions/setup-python@v5
2121
with:
22-
python-version: "3.9"
22+
python-version: "3.10"
2323
cache: "pip" # Cache the pip packages to speed up the workflow
2424

2525
- name: Install Dependencies and Package

.github/workflows/pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
- name: Checkout
1818
uses: actions/checkout@v4
1919

20-
- name: Setup Python 3.9
20+
- name: Setup Python 3.10
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: "3.9"
23+
python-version: "3.10"
2424

2525
- name: Install Dependencies
2626
run: python -m pip install -U pip setuptools build

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
- name: Checkout
1919
uses: actions/checkout@v4
2020

21-
- name: Setup Python 3.9
21+
- name: Setup Python 3.10
2222
uses: actions/setup-python@v5
2323
with:
24-
python-version: "3.9"
24+
python-version: "3.10"
2525
cache: "pip" # Cache the pip packages to speed up the workflow
2626

2727
- name: Install Dependencies and Package
@@ -45,10 +45,10 @@ jobs:
4545
- name: Checkout
4646
uses: actions/checkout@v4
4747

48-
- name: Setup Python 3.9
48+
- name: Setup Python 3.10
4949
uses: actions/setup-python@v5
5050
with:
51-
python-version: "3.9"
51+
python-version: "3.10"
5252
cache: "pip" # Cache the pip packages to speed up the workflow
5353

5454
- name: Install Dependencies and Project
@@ -69,10 +69,10 @@ jobs:
6969
- name: Checkout
7070
uses: actions/checkout@v4
7171

72-
- name: Setup Python 3.9
72+
- name: Setup Python 3.10
7373
uses: actions/setup-python@v5
7474
with:
75-
python-version: "3.9"
75+
python-version: "3.10"
7676
cache: "pip" # Cache the pip packages to speed up the workflow
7777

7878
- name: Install Dependencies and Project

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The library's focus is to provide a simple and easy-to-use interface to interact
1313

1414
## Installation
1515

16-
Note that **Python 3.9 or higher is required.**
16+
Note that **Python 3.10 or higher is required.**
1717

1818
```sh
1919
# Linux/macOS

docs/extensions/attribute_table.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import inspect
2929
import re
3030
from collections.abc import Sequence
31-
from typing import TYPE_CHECKING, ClassVar, NamedTuple, Optional
31+
from typing import TYPE_CHECKING, ClassVar, NamedTuple
3232

3333
from docutils import nodes
3434
from sphinx import addnodes
@@ -207,7 +207,7 @@ def build_lookup_table(env: BuildEnvironment) -> dict[str, list[str]]:
207207
class TableElement(NamedTuple):
208208
fullname: str
209209
label: str
210-
badge: Optional[attributetablebadge]
210+
badge: attributetablebadge | None
211211

212212

213213
def process_attributetable(app: Sphinx, doctree: nodes.Node, fromdocname: str) -> None:

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ To install the Fortnite-API Python library, you can use pip. Run the following c
1111

1212
.. note::
1313

14-
Note that Python 3.9 and greater is required to use this library.
14+
Note that Python 3.10 and greater is required to use this library.
1515

1616
.. code-block:: bash
1717

examples/discord_integration.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import asyncio
1717
import os
18-
from typing import Optional
1918

2019
import discord
2120
from discord.ext import commands
@@ -73,7 +72,7 @@ async def aes(self, ctx: commands.Context[MyBot]) -> None:
7372

7473
# (3.1) The main AES key is marked as optional in the documentation, so we must
7574
# handle the case where it is None.
76-
main_key: Optional[str] = aes.main_key
75+
main_key: str | None = aes.main_key
7776

7877
# (4) and send a message back to the user.
7978
if main_key is None:

fortnite_api/abc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from __future__ import annotations
2626

2727
import copy
28-
from typing import TYPE_CHECKING, Generic, TypeVar, Union
28+
from typing import TYPE_CHECKING, Generic, TypeVar
2929

3030
from typing_extensions import Self
3131

@@ -118,7 +118,7 @@ def __init__(self, *, data: DictT, http: HTTPClientT) -> None:
118118
# still keeping the correct HTTPClient type.
119119

120120
@classmethod
121-
def from_dict(cls: type[Self], data: DictT, *, client: Union[Client, SyncClient]) -> Self:
121+
def from_dict(cls: type[Self], data: DictT, *, client: Client | SyncClient) -> Self:
122122
"""Reconstructs this class from a raw dictionary object. This is useful for when you
123123
store the raw data and want to reconstruct the object later on.
124124

fortnite_api/aes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import dataclasses
2828
import re
2929
from collections.abc import Generator
30-
from typing import TYPE_CHECKING, Any, Optional, Union
30+
from typing import TYPE_CHECKING, Any
3131

3232
from .abc import ReconstructAble
3333
from .http import HTTPClientT
@@ -155,11 +155,11 @@ class Aes(ReconstructAble[dict[str, Any], HTTPClientT]):
155155
def __init__(self, *, data: dict[str, Any], http: HTTPClientT):
156156
super().__init__(data=data, http=http)
157157

158-
self.main_key: Optional[str] = data.get("mainKey")
158+
self.main_key: str | None = data.get("mainKey")
159159
self.build: str = data["build"]
160160

161161
# In the case that the API gives us an invalid version, we will set it to None
162-
self.version: Optional[Version] = None
162+
self.version: Version | None = None
163163
version_info = VERSION_REGEX.findall(self.build)
164164
if version_info and len(version_info[0]) == 2:
165165
major, minor = version_info[0]
@@ -240,7 +240,7 @@ def __init__(self, *, data: dict[str, Any], http: HTTPClientT):
240240
def __hash__(self) -> int:
241241
return hash((self.pak_filename, self.pak_guid, self.key))
242242

243-
def __eq__(self, o: Union[object, DynamicKey]) -> bool:
243+
def __eq__(self, o: object | DynamicKey) -> bool:
244244
if not isinstance(o, DynamicKey):
245245
return False
246246

fortnite_api/asset.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ class Asset(Generic[HTTPClientT]):
6666

6767
__slots__: tuple[str, ...] = ('_http', '_url', '_max_size', '_size')
6868

69-
def __init__(self, *, http: HTTPClientT, url: str, max_size: Optional[int] = MISSING, size: int = MISSING) -> None:
69+
def __init__(self, *, http: HTTPClientT, url: str, max_size: int | None = MISSING, size: int = MISSING) -> None:
7070
self._http: HTTPClientT = http
7171
self._url: str = url
7272

7373
# The maximum size of the asset, if any. If provided, the url's default size is the maximum size.
7474
# MISSING for not supported, None for no max size, int for max size.
75-
self._max_size: Optional[int] = max_size
75+
self._max_size: int | None = max_size
7676

7777
# The current size of this asset. Will only be set if the asset was resized.
7878
self._size: int = size
@@ -112,7 +112,7 @@ def can_resize(self) -> bool:
112112
return self._max_size is not MISSING
113113

114114
@property
115-
def max_size(self) -> Optional[int]:
115+
def max_size(self) -> int | None:
116116
"""
117117
Returns
118118
--------
@@ -161,7 +161,7 @@ def read(self: Asset[HTTPClient], /) -> Coroutine[Any, Any, bytes]: ...
161161
@overload
162162
def read(self: Asset[SyncHTTPClient], /) -> bytes: ...
163163

164-
def read(self) -> Union[Coroutine[Any, Any, bytes], bytes]:
164+
def read(self) -> Coroutine[Any, Any, bytes] | bytes:
165165
"""|maybecoro|
166166
167167
Retrieves the content of this asset as a :class:`bytes` object. This is only a coroutine if the client is

0 commit comments

Comments
 (0)