Skip to content

Commit 061f37f

Browse files
committed
chore: drop Python 3.9, add support for 3.14
1 parent 061542b commit 061f37f

File tree

7 files changed

+18
-21
lines changed

7 files changed

+18
-21
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
strategy:
6464
matrix:
6565
os: [ubuntu-latest, macos-latest] # eventually add `windows-latest`
66-
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
66+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
6767

6868
steps:
6969
- uses: actions/checkout@v4

ape_ledger/_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TYPE_CHECKING, Union
1+
from typing import TYPE_CHECKING
22

33
import click
44
from ape.cli.arguments import existing_alias_argument, non_existing_alias_argument
@@ -13,7 +13,7 @@
1313
from ape_ledger.exceptions import LedgerSigningError
1414

1515

16-
def _select_account(hd_path: Union["HDBasePath", str]) -> tuple[str, "HDAccountPath"]:
16+
def _select_account(hd_path: "HDBasePath | str") -> tuple[str, "HDAccountPath"]:
1717
# NOTE: Lazy import so CLI help loads faster.
1818
from ape_ledger.choices import AddressPromptChoice
1919

ape_ledger/accounts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import json
22
from collections.abc import Iterator
33
from pathlib import Path
4-
from typing import Any, Optional
4+
from typing import Any
55

66
import rich
77
from ape.api import AccountAPI, AccountContainerAPI, TransactionAPI
@@ -112,7 +112,7 @@ def hdpath(self) -> HDAccountPath:
112112
def account_file(self) -> dict:
113113
return json.loads(self.account_file_path.read_text())
114114

115-
def sign_message(self, msg: Any, **signer_options) -> Optional[MessageSignature]:
115+
def sign_message(self, msg: Any, **signer_options) -> MessageSignature | None:
116116
use_eip712_package = isinstance(msg, EIP712Message)
117117
use_eip712 = use_eip712_package
118118
if isinstance(msg, str):
@@ -174,7 +174,7 @@ def sign_message(self, msg: Any, **signer_options) -> Optional[MessageSignature]
174174
v, r, s = signed_msg
175175
return MessageSignature(v=v, r=HexBytes(r), s=HexBytes(s))
176176

177-
def sign_transaction(self, txn: TransactionAPI, **kwargs) -> Optional[TransactionAPI]:
177+
def sign_transaction(self, txn: TransactionAPI, **kwargs) -> TransactionAPI | None:
178178
txn.chain_id = 1
179179
txn_dict: dict = {
180180
"nonce": txn.nonce,

ape_ledger/choices.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TYPE_CHECKING, Any, Optional, Union
1+
from typing import TYPE_CHECKING, Any
22

33
import click
44
from ape.cli import PromptChoice
@@ -19,7 +19,7 @@ class AddressPromptChoice(PromptChoice):
1919

2020
def __init__(
2121
self,
22-
hd_path: Union["HDBasePath", str],
22+
hd_path: "HDBasePath | str",
2323
index_offset: int = 0,
2424
page_size: int = DEFAULT_PAGE_SIZE,
2525
):
@@ -31,7 +31,7 @@ def __init__(
3131
self._hd_root_path = hd_path
3232
self._index_offset = index_offset
3333
self._page_size = page_size
34-
self._choice_index: Optional[int] = None
34+
self._choice_index: int | None = None
3535

3636
# Must call ``_load_choices()`` to set address choices
3737
super().__init__([])
@@ -48,9 +48,7 @@ def _prompt_message(self) -> str:
4848
f"or type 'n' for the next {self._page_size} entries"
4949
)
5050

51-
def convert(
52-
self, value: Any, param: Optional["Parameter"], ctx: Optional["Context"]
53-
) -> Optional[str]:
51+
def convert(self, value: Any, param: "Parameter | None", ctx: "Context | None") -> str | None:
5452
"""Convert the user selection to a choice or increment /decrement
5553
if they input ``n`` or ``p``."""
5654
if self._page_from_choice(value):

ape_ledger/hdpath.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import struct
2-
from typing import Optional, Union
32

43

54
class HDPath:
@@ -9,7 +8,7 @@ class HDPath:
98
as well as the derivation HD path class :class:`~ape_ledger.hdpath.HDBasePath`.
109
"""
1110

12-
def __init__(self, path: Union[str, "HDBasePath"]):
11+
def __init__(self, path: "HDBasePath | str"):
1312
if not isinstance(path, str) and hasattr(path, "path"):
1413
# NOTE: Using getattr for mypy
1514
path_str = getattr(path, "path")
@@ -71,7 +70,7 @@ class HDBasePath(HDPath):
7170
:class:`~ape_ledger.hdpath.HDAccountPath`.
7271
"""
7372

74-
def __init__(self, base_path: Optional[Union[str, "HDBasePath"]] = None):
73+
def __init__(self, base_path: "HDBasePath | str | None" = None):
7574
base_path = base_path or "m/44'/60'/{x}'/0/0"
7675
if not isinstance(base_path, str) and hasattr(base_path, "path"):
7776
base_path_str = base_path.path

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"ape_ledger=ape_ledger._cli:cli",
8080
],
8181
},
82-
python_requires=">=3.9,<4",
82+
python_requires=">=3.10,<4",
8383
extras_require=extras_require,
8484
py_modules=["ape_ledger"],
8585
license="Apache-2.0",
@@ -95,10 +95,10 @@
9595
"Operating System :: MacOS",
9696
"Operating System :: POSIX",
9797
"Programming Language :: Python :: 3",
98-
"Programming Language :: Python :: 3.9",
9998
"Programming Language :: Python :: 3.10",
10099
"Programming Language :: Python :: 3.11",
101100
"Programming Language :: Python :: 3.12",
102101
"Programming Language :: Python :: 3.13",
102+
"Programming Language :: Python :: 3.14",
103103
],
104104
)

tests/test_accounts.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import json
2-
from typing import TYPE_CHECKING, Optional, cast
2+
from typing import TYPE_CHECKING, cast
33

44
import pytest
55
from ape import networks
@@ -46,7 +46,7 @@ class Mail(EIP712Message):
4646

4747

4848
def build_transaction(
49-
txn: "TransactionAPI", receiver: Optional["AddressType"] = None
49+
txn: "TransactionAPI", receiver: "AddressType | None" = None
5050
) -> "TransactionAPI":
5151
txn.chain_id = 579875
5252
txn.nonce = 0
@@ -64,7 +64,7 @@ def build_transaction(
6464

6565

6666
def create_static_fee_txn(
67-
receiver: Optional["AddressType"] = None,
67+
receiver: "AddressType | None" = None,
6868
) -> StaticFeeTransaction:
6969
txn = StaticFeeTransaction()
7070
txn = cast(StaticFeeTransaction, build_transaction(txn, receiver=receiver))
@@ -73,7 +73,7 @@ def create_static_fee_txn(
7373

7474

7575
def create_dynamic_fee_txn(
76-
receiver: Optional["AddressType"] = None,
76+
receiver: "AddressType | None" = None,
7777
) -> DynamicFeeTransaction:
7878
txn = DynamicFeeTransaction()
7979
txn = cast(DynamicFeeTransaction, build_transaction(txn, receiver=receiver))

0 commit comments

Comments
 (0)