Raise Python minimum to 3.11 (#21395)

* Raise the supported Python floor from 3.10 to 3.11.

Python 3.10 reaches end-of-life in October 2026; drop it from packaging, installers, and CI.

* Apply ruff UP fixes enabled by the 3.11 minimum

Raising requires-python to 3.11 changes ruff's inferred target-version,
which activates UP017, UP035, UP036 and UP041 across the tree:

- typing_extensions.Self/final -> typing
- asyncio.TimeoutError -> TimeoutError
- datetime.timezone.utc -> datetime.UTC
- drop sys.version_info branches that are now always taken

UP042 (str, Enum -> StrEnum) is ignored for now; it changes str()/format()
output on enums that cross the daemon protocol and CLI parsing.

* Drop unused commented numpy and big-o stubs from pyproject.toml.

Neither was ever a live dependency after the Poetry migration, and the
benchmark that needed them was already reverted.

* Restore Ubuntu Jammy in install-script CI.

Jammy's python3 is 3.10, but the existing Prepare Ubuntu step already
falls back to python3.11-venv when python3-venv is too old.
This commit is contained in:
Earle Lowe
2026-10-19 13:25:30 -07:00
committed by GitHub
parent 4ae7833cf7
commit b24cc479ca
84 changed files with 142 additions and 284 deletions
@@ -43,7 +43,7 @@ jobs:
matrix: arm
- name: Intel
matrix: intel
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
python-version: ["3.11", "3.12", "3.13", "3.14"]
exclude:
- os:
matrix: windows
-1
View File
@@ -71,7 +71,6 @@ jobs:
- name: Intel
matrix: intel
python:
- major_dot_minor: "3.10"
- major_dot_minor: "3.11"
- major_dot_minor: "3.12"
- major_dot_minor: "3.13"
+2 -1
View File
@@ -193,6 +193,7 @@ jobs:
- name: ubuntu:jammy (22.04)
type: ubuntu
# https://packages.ubuntu.com/jammy/python3 (22.04, 3.10)
# Prepare Ubuntu falls back to python3.11-venv from universe.
url: "docker://ubuntu:jammy"
- name: ubuntu:noble (24.04)
type: ubuntu
@@ -267,7 +268,7 @@ jobs:
run: |
apt-get --yes update
apt-get install --yes git lsb-release
MINIMUM=3.10
MINIMUM=3.11
if ! apt-get satisfy --yes "python3-venv (>= ${MINIMUM})"
then
apt-get install --yes python${MINIMUM}-venv
-9
View File
@@ -122,15 +122,6 @@ jobs:
- matrix: ${{ inputs.arch }}
emoji: ${{ inputs.arch-emoji }}
python:
- name: "3.10"
file_name: "3.10"
action: "3.10"
apt: "3.10"
install_sh: "3.10"
matrix: "3.10"
exclude_from:
limited: True
main: True
- name: "3.11"
file_name: "3.11"
action: "3.11"
-1
View File
@@ -89,7 +89,6 @@ jobs:
emoji: 🌀
matrix: intel
python:
- major_dot_minor: "3.10"
- major_dot_minor: "3.11"
- major_dot_minor: "3.12"
- major_dot_minor: "3.13"
+1 -1
View File
@@ -46,7 +46,7 @@ if ($null -eq (Get-Command py -ErrorAction SilentlyContinue))
Exit 1
}
$supportedPythonVersions = "3.14", "3.13", "3.12", "3.11", "3.10"
$supportedPythonVersions = "3.14", "3.13", "3.12", "3.11"
if ("$env:INSTALL_PYTHON_VERSION" -ne "")
{
$pythonVersion = $env:INSTALL_PYTHON_VERSION
+1 -1
View File
@@ -20,7 +20,7 @@ Chia is a modern cryptocurrency built from scratch, designed to be efficient, de
Please check out the [Chia website][link-chia], the [Intro to Chia][link-intro], and [FAQ][link-faq] for information on this project.
Python 3.10+ is required. Make sure your default python version is >=3.10 by typing `python3`.
Python 3.11+ is required. Make sure your default python version is >=3.11 by typing `python3`.
If you are behind a NAT, it can be difficult for peers outside your subnet to reach you when they start up. You can enable [UPnP][link-upnp]
on your router or add a NAT (for IPv4 but not IPv6) and firewall rules to allow TCP port 8444 access to your peer.
+1 -1
View File
@@ -114,7 +114,7 @@ async def test_successfully_dispatches(
assert by_name["macos-intel"]["conclusion"] == "skipped"
assert by_name["windows"]["conclusion"] == "skipped"
versions = ["3.10", "3.11", "3.12"]
versions = ["3.11", "3.12"]
runs_by_name: dict[str, list[str]] = {name: [] for name in ["ubuntu", "macos-arm"]}
for name in by_name:
platform, _, rest = name.partition(" / ")
+1 -1
View File
@@ -1114,7 +1114,7 @@ def test_get_offers(capsys: object, get_test_cli_clients: tuple[TestRpcClients,
FINGERPRINT_ARG,
"--summaries",
]
tzinfo = datetime.datetime.now(datetime.timezone.utc).astimezone().tzinfo
tzinfo = datetime.datetime.now(datetime.UTC).astimezone().tzinfo
# these are various things that should be in the output
assert_list = [
"Timelock information:",
+5 -25
View File
@@ -275,11 +275,7 @@ async def run_cli_cmd(*args: str, root_path: Path) -> asyncio.subprocess.Process
assert process.stdout is not None
assert process.stderr is not None
stderr = await process.stderr.read()
if sys.version_info >= (3, 10, 6):
assert stderr == b""
else: # pragma: no cover
# https://github.com/python/cpython/issues/92841
assert stderr == b"" or b"_ProactorBasePipeTransport.__del__" in stderr
assert stderr == b""
assert process.returncode == 0
return process
@@ -2204,11 +2200,7 @@ async def test_clear_pending_roots(
cleared_root = json.loads(stdout)
stderr = await process.stderr.read()
assert process.returncode == 0
if sys.version_info >= (3, 10, 6):
assert stderr == b""
else: # pragma: no cover
# https://github.com/python/cpython/issues/92841
assert stderr == b"" or b"_ProactorBasePipeTransport.__del__" in stderr
assert stderr == b""
elif layer == InterfaceLayer.client:
async with DataLayerRpcClient.create_as_context(
self_hostname=self_hostname,
@@ -3486,11 +3478,7 @@ async def test_pagination_cmds(
else:
kv_diff = json.loads(stdout)
assert process.returncode == 0
if sys.version_info >= (3, 10, 6):
assert stderr == b""
else: # pragma: no cover
# https://github.com/python/cpython/issues/92841
assert stderr == b"" or b"_ProactorBasePipeTransport.__del__" in stderr
assert stderr == b""
elif layer == InterfaceLayer.client:
async with DataLayerRpcClient.create_as_context(
self_hostname=self_hostname,
@@ -3665,11 +3653,7 @@ async def test_unsubmitted_batch_update(
res = json.loads(stdout)
stderr = await process.stderr.read()
assert process.returncode == 0
if sys.version_info >= (3, 10, 6):
assert stderr == b""
else: # pragma: no cover
# https://github.com/python/cpython/issues/92841
assert stderr == b"" or b"_ProactorBasePipeTransport.__del__" in stderr
assert stderr == b""
assert res == {"success": True}
elif layer == InterfaceLayer.client:
async with DataLayerRpcClient.create_as_context(
@@ -3807,11 +3791,7 @@ async def test_unsubmitted_batch_update(
res = json.loads(stdout)
stderr = await process.stderr.read()
assert process.returncode == 0
if sys.version_info >= (3, 10, 6):
assert stderr == b""
else: # pragma: no cover
# https://github.com/python/cpython/issues/92841
assert stderr == b"" or b"_ProactorBasePipeTransport.__del__" in stderr
assert stderr == b""
update_tx_rec1 = bytes32.from_hexstr(res["tx_id"])
elif layer == InterfaceLayer.client:
async with DataLayerRpcClient.create_as_context(
+2 -3
View File
@@ -1,6 +1,5 @@
from __future__ import annotations
import asyncio
import json
import logging
from collections.abc import AsyncIterator
@@ -150,7 +149,7 @@ async def test_get_plugin_info_timeout() -> None:
with patch(
"chia.data_layer.data_layer.aiohttp.ClientSession",
side_effect=asyncio.TimeoutError("connection timed out"),
side_effect=TimeoutError("connection timed out"),
):
remote, result = await get_plugin_info(plugin, DUMMY_TIMEOUT)
@@ -230,7 +229,7 @@ async def test_download_file_plugin_timeout(tmp_path: Path) -> None:
with patch(
"chia.data_layer.download_data.aiohttp.ClientSession",
side_effect=asyncio.TimeoutError("plugin timed out"),
side_effect=TimeoutError("plugin timed out"),
):
result = await download_file(
data_store=data_store,
@@ -38,7 +38,7 @@ async def test_protocol_messages(
await time_out_assert(60, node_height_at_least, True, full_node_sim, blocks[-1].height)
offset_secs = [60, 120, 300]
now_unix_secs = int(datetime.datetime.now(datetime.timezone.utc).timestamp())
now_unix_secs = int(datetime.datetime.now(datetime.UTC).timestamp())
request_times = [uint64(now_unix_secs + s) for s in offset_secs]
request: wallet_protocol.RequestFeeEstimates = wallet_protocol.RequestFeeEstimates(request_times)
estimates = await full_node_sim.request_fee_estimates(request)
+5 -16
View File
@@ -32,21 +32,14 @@ def test_base_event_loop_has_methods() -> None:
assert inspect.ismethod(method)
if sys.version_info >= (3, 13):
expected_signature = "(protocol_factory, host=None, port=None, *, family=<AddressFamily.AF_UNSPEC: 0>, flags=<AddressInfo.AI_PASSIVE: 1>, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, keep_alive=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True)" # ruff: ignore[line-too-long]
elif sys.version_info >= (3, 11):
expected_signature = "(protocol_factory, host=None, port=None, *, family=<AddressFamily.AF_UNSPEC: 0>, flags=<AddressInfo.AI_PASSIVE: 1>, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True)" # ruff: ignore[line-too-long]
else:
expected_signature = "(protocol_factory, host=None, port=None, *, family=<AddressFamily.AF_UNSPEC: 0>, flags=<AddressInfo.AI_PASSIVE: 1>, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, ssl_handshake_timeout=None, start_serving=True)" # ruff: ignore[line-too-long]
expected_signature = "(protocol_factory, host=None, port=None, *, family=<AddressFamily.AF_UNSPEC: 0>, flags=<AddressInfo.AI_PASSIVE: 1>, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True)" # ruff: ignore[line-too-long]
assert str(inspect.signature(method)) == expected_signature
assert hasattr(base_selector_event_loop, "_start_serving")
method = getattr(base_selector_event_loop, "_start_serving")
assert inspect.ismethod(method)
if sys.version_info >= (3, 11):
expected_signature = "(protocol_factory, sock, sslcontext=None, server=None, backlog=100, ssl_handshake_timeout=60.0, ssl_shutdown_timeout=30.0)" # ruff: ignore[line-too-long]
else:
expected_signature = (
"(protocol_factory, sock, sslcontext=None, server=None, backlog=100, ssl_handshake_timeout=60.0)"
)
expected_signature = "(protocol_factory, sock, sslcontext=None, server=None, backlog=100, ssl_handshake_timeout=60.0, ssl_shutdown_timeout=30.0)" # ruff: ignore[line-too-long]
assert str(inspect.signature(method)) == expected_signature
assert hasattr(base_selector_event_loop, "remove_reader")
@@ -94,13 +87,9 @@ def test_base_event_loop_has_methods() -> None:
base_server = super(PausableServer, pausable_server)
method = getattr(base_server, "__init__")
if sys.version_info >= (3, 11):
expected_signature = (
"(loop, sockets, protocol_factory, ssl_context, backlog, ssl_handshake_timeout,"
" ssl_shutdown_timeout=None)"
)
else:
expected_signature = "(loop, sockets, protocol_factory, ssl_context, backlog, ssl_handshake_timeout)"
expected_signature = (
"(loop, sockets, protocol_factory, ssl_context, backlog, ssl_handshake_timeout, ssl_shutdown_timeout=None)"
)
assert str(inspect.signature(method)) == expected_signature
for func in ("_attach", "_detach"):
+1 -1
View File
@@ -174,7 +174,7 @@ async def test_start_client_handshake_timeout(
async def timeout_handshake(
self: WSChiaConnection, network_id: str, server_port: uint16, local_type: NodeType
) -> None:
raise asyncio.TimeoutError
raise TimeoutError
monkeypatch.setattr(WSChiaConnection, "perform_handshake", timeout_handshake)
target_peer = PeerInfo(self_hostname, server_2.get_port())
+1 -2
View File
@@ -8,7 +8,7 @@ from contextlib import asynccontextmanager
from dataclasses import dataclass
from time import time
from types import TracebackType
from typing import Any, cast
from typing import Any, Self, cast
from unittest.mock import ANY, AsyncMock
import pytest
@@ -16,7 +16,6 @@ from chia_rs import AugSchemeMPL, G1Element, G2Element, PlotParam, PrivateKey, P
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint8, uint16, uint32, uint64
from pytest_mock import MockerFixture
from typing_extensions import Self
from yarl import URL
from chia import __version__
+1 -5
View File
@@ -6,7 +6,6 @@ import dataclasses
import json
import logging
import ssl
import sys
from collections.abc import AsyncIterator
from pathlib import Path
from typing import TYPE_CHECKING, Any, ClassVar, cast
@@ -26,10 +25,7 @@ from chia.util.ws_message import WsRpcMessage
root_logger = logging.getLogger()
if sys.version_info >= (3, 11): # pragma: no cover
name_to_number_level_map = logging.getLevelNamesMapping()
else:
name_to_number_level_map = logging._nameToLevel
name_to_number_level_map = logging.getLevelNamesMapping()
number_to_name_level_map = {number: name for name, number in name_to_number_level_map.items()}
@@ -91,7 +91,7 @@ class TestStartSimulator:
# We can ignore this timeout as long as the subsequent tests pass
try:
await simulator_rpc_client.reorg_blocks(2) # fork point 2 blocks, now height is 5
except asyncio.TimeoutError:
except TimeoutError:
pass # ignore this error and hope the reorg is going ahead
# wait up to 5 mins
+1 -2
View File
@@ -20,7 +20,7 @@ from statistics import mean
from textwrap import dedent
from time import thread_time
from types import TracebackType
from typing import TYPE_CHECKING, Any, ClassVar, Protocol, TextIO, TypeVar, cast, final
from typing import TYPE_CHECKING, Any, ClassVar, Protocol, Self, TextIO, TypeVar, cast, final
import aiohttp
import pytest
@@ -31,7 +31,6 @@ from aiohttp import web
from chia_rs import Coin
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint16, uint32, uint64
from typing_extensions import Self
import chia
import chia._tests
+1 -2
View File
@@ -7,7 +7,7 @@ from collections.abc import AsyncIterator
from contextlib import asynccontextmanager
from dataclasses import dataclass
from pathlib import Path
from typing import Any
from typing import Any, Self
import anyio
from chia_rs import (
@@ -23,7 +23,6 @@ from chia_rs import (
from chia_rs import get_puzzle_and_solution_for_coin2 as get_puzzle_and_solution_for_coin
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint32, uint64
from typing_extensions import Self
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
from chia.consensus.coinbase import create_farmer_coin, create_pool_coin
+1 -3
View File
@@ -9,9 +9,7 @@ import time
from collections.abc import Awaitable, Callable, Iterable
from inspect import getframeinfo, stack
from pathlib import Path
from typing import TYPE_CHECKING, Any, ClassVar, Protocol, TypeVar, cast, final
from typing_extensions import Self
from typing import TYPE_CHECKING, Any, ClassVar, Protocol, Self, TypeVar, cast, final
import chia
import chia._tests
@@ -1,9 +1,10 @@
from __future__ import annotations
from typing import Any
import pytest
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint64
from typing_extensions import Any
from chia._tests.environments.wallet import WalletStateTransition, WalletTestFramework
from chia._tests.util.time_out_assert import time_out_assert
@@ -94,7 +94,7 @@ async def wait_rpc_state_condition(
now = time.monotonic()
elapsed = now - start
if elapsed >= timeout:
raise asyncio.TimeoutError(
raise TimeoutError(
f"timed out while waiting for {async_function.__name__}(): {elapsed} >= {timeout}",
)
+1 -1
View File
@@ -51,7 +51,7 @@ def data_group() -> None:
def print_date(*args: Any, **kwargs: Any) -> None:
kwargs.setdefault("flush", True)
s = datetime.datetime.now(datetime.timezone.utc).isoformat(timespec="seconds")
s = datetime.datetime.now(datetime.UTC).isoformat(timespec="seconds")
print(f"{s}:", *args, **kwargs)
+2 -2
View File
@@ -7,7 +7,7 @@ import pathlib
import sys
import time
from collections.abc import Awaitable, Callable, Sequence
from datetime import datetime, timezone
from datetime import UTC, datetime
from decimal import Decimal
from typing import Any
@@ -709,7 +709,7 @@ async def print_offer_summary(
def format_timestamp_with_timezone(timestamp: int) -> str:
tzinfo = datetime.now(timezone.utc).astimezone().tzinfo
tzinfo = datetime.now(UTC).astimezone().tzinfo
return datetime.fromtimestamp(timestamp, tz=tzinfo).strftime("%Y-%m-%d %H:%M %Z")
+1 -1
View File
@@ -99,7 +99,7 @@ class DaemonProxy:
response: WsRpcMessage = self.response_dict[request_id]
self.response_dict.pop(request_id)
return response
except asyncio.TimeoutError:
except TimeoutError:
self._request_dict.pop(request_id)
raise Exception(f"No response from daemon for request_id: {request_id}")
+1 -1
View File
@@ -96,7 +96,7 @@ class KeychainProxy(DaemonProxy):
self.log.error("Attempting to send request to a keychain-proxy that has shut down.")
self.log.debug(f"Sending request to keychain command: {request['command']} from {request['origin']}.")
return await super()._get(request)
except asyncio.TimeoutError:
except TimeoutError:
raise KeychainProxyConnectionTimeout
async def start(self, wait_for_start: bool = False) -> None:
+2 -2
View File
@@ -114,7 +114,7 @@ async def get_plugin_info(
if response.status == 200:
ret["response"] = json.loads(await response.text())
return plugin_remote, ret
except (asyncio.TimeoutError, aiohttp.ClientError) as e:
except (TimeoutError, aiohttp.ClientError) as e:
return plugin_remote, {"error": f"{type(e).__name__}: {e}"}
@@ -889,7 +889,7 @@ class DataLayer:
self.log.error(f"failed to upload to uploader {uploader}")
else:
self.log.debug(f"uploaded to uploader {uploader}")
except (asyncio.TimeoutError, aiohttp.ClientError) as e:
except (TimeoutError, aiohttp.ClientError) as e:
self.log.error(f"add_missing_files could not reach uploader {uploader}: {type(e).__name__}: {e}")
async def subscribe(self, store_id: bytes32, urls: list[str]) -> Subscription:
+2 -2
View File
@@ -1,8 +1,8 @@
from __future__ import annotations
from typing import Any
from typing import Any, Self
from typing_extensions import Protocol, Self
from typing_extensions import Protocol
# If accepted for general use then this should be moved to a common location
# and probably implemented by the framework instead of manual decoration.
+1 -2
View File
@@ -5,13 +5,12 @@ from dataclasses import dataclass, field
from enum import Enum, IntEnum
from hashlib import sha256
from pathlib import Path
from typing import TYPE_CHECKING, Any, Union
from typing import TYPE_CHECKING, Any, Union, final
import aiosqlite
from chia_rs.datalayer import ProofOfInclusion, ProofOfInclusionLayer
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint8, uint64
from typing_extensions import final
from chia.data_layer.data_layer_errors import ProofIntegrityError
from chia.server.ws_connection import WSChiaConnection
+2 -2
View File
@@ -2,14 +2,14 @@ from __future__ import annotations
import dataclasses
import logging
from typing import TYPE_CHECKING, Any, ClassVar, cast
from typing import TYPE_CHECKING, Any, ClassVar, cast, final
from chia_rs import BlockRecord, CoinSpend, CoinState, G1Element, G2Element
from chia_rs.datalayer import ProofOfInclusion, ProofOfInclusionLayer
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint8, uint32, uint64, uint128
from clvm.EvalError import EvalError
from typing_extensions import Unpack, final
from typing_extensions import Unpack
from chia.data_layer.data_layer_errors import LauncherCoinNotFoundError, OfferIntegrityError
from chia.data_layer.data_layer_util import OfferStore, StoreProofs, leaf_hash
+1 -1
View File
@@ -1,11 +1,11 @@
from __future__ import annotations
import dataclasses
from typing import Self
from aiosqlite import Row
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint16, uint32, uint64
from typing_extensions import Self
from chia.data_layer.data_layer_wallet import Mirror
from chia.data_layer.singleton_record import SingletonRecord
+2 -3
View File
@@ -1,6 +1,5 @@
from __future__ import annotations
import asyncio
import logging
import time
from dataclasses import dataclass
@@ -134,7 +133,7 @@ async def download_file(
await http_download(
target_filename_path, filename, proxy_url, server_info, timeout, log, max_delta_file_size
)
except (asyncio.TimeoutError, aiohttp.ClientError, MaxDeltaFileSizeExceededError):
except (TimeoutError, aiohttp.ClientError, MaxDeltaFileSizeExceededError):
new_server_info = await data_store.server_misses_file(store_id, server_info, timestamp)
log.info(
f"Failed to download {filename} from {new_server_info.url}."
@@ -163,7 +162,7 @@ async def download_file(
res_json = await response.json()
assert isinstance(res_json["downloaded"], bool)
return res_json["downloaded"]
except (asyncio.TimeoutError, aiohttp.ClientError) as e:
except (TimeoutError, aiohttp.ClientError) as e:
log.error(f"download_file could not get response from plugin {downloader}: {type(e).__name__}: {e}")
return False
+3 -3
View File
@@ -8,7 +8,7 @@ import time
import traceback
from collections.abc import AsyncIterator
from dataclasses import dataclass
from datetime import datetime, timezone
from datetime import UTC, datetime
from math import floor
from pathlib import Path
from typing import TYPE_CHECKING, Any, ClassVar, Literal, TypeVar, cast
@@ -438,8 +438,8 @@ class Farmer:
elif pool_config.version == 2:
cached_auth_token = self.authentication_tokens.get(pool_config.launcher_id, None)
if cached_auth_token is None or datetime.fromtimestamp(
cached_auth_token[1], tz=timezone.utc
) < datetime.fromtimestamp(self.get_current_time(), tz=timezone.utc):
cached_auth_token[1], tz=UTC
) < datetime.fromtimestamp(self.get_current_time(), tz=UTC):
auth_response = await self._pool_get_auth(pool_config)
if isinstance(auth_response, pool_protocol.GetAuthResponse):
self.authentication_tokens[pool_config.launcher_id] = (
+3 -3
View File
@@ -6,7 +6,7 @@ import logging
import time
import traceback
from collections.abc import Collection, Sequence
from datetime import datetime, timezone
from datetime import UTC, datetime
from typing import TYPE_CHECKING, ClassVar, cast
import anyio
@@ -2012,8 +2012,8 @@ class FullNodeAPI:
@metadata.request(reply_types=[ProtocolMessageTypes.respond_fee_estimates])
async def request_fee_estimates(self, request: wallet_protocol.RequestFeeEstimates) -> Message:
def get_fee_estimates(est: FeeEstimatorInterface, req_times: list[uint64]) -> list[FeeEstimate]:
now = datetime.now(timezone.utc)
utc_time = now.replace(tzinfo=timezone.utc)
now = datetime.now(UTC)
utc_time = now.replace(tzinfo=UTC)
utc_now = int(utc_time.timestamp())
deltas = [max(0, req_ts - utc_now) for req_ts in req_times]
fee_rates = [est.estimate_fee_rate(time_offset_seconds=d) for d in deltas]
+3 -3
View File
@@ -1,7 +1,7 @@
from __future__ import annotations
import time
from datetime import datetime, timezone
from datetime import UTC, datetime
from typing import TYPE_CHECKING, Any, ClassVar, cast
from chia_rs import (
@@ -1153,8 +1153,8 @@ class FullNodeRpcApi:
last_tx_block_fees = last_tx_block.fees
last_tx_block_height = last_tx_block.height
dt = datetime.now(timezone.utc)
utc_time = dt.replace(tzinfo=timezone.utc)
dt = datetime.now(UTC)
utc_time = dt.replace(tzinfo=UTC)
utc_timestamp = utc_time.timestamp()
return {
+1 -2
View File
@@ -7,7 +7,7 @@ from collections.abc import AsyncIterator, Awaitable, Callable, Collection
from dataclasses import dataclass, field
from pathlib import Path
from types import TracebackType
from typing import Literal, TypeVar
from typing import Literal, Self, TypeVar
from chia_rs import (
ELIGIBLE_FOR_DEDUP,
@@ -26,7 +26,6 @@ from chia_rs import (
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint32, uint64
from chiabip158 import PyBIP158
from typing_extensions import Self
from chia.consensus.block_record import BlockRecordProtocol
from chia.full_node.bitcoin_fee_estimator import create_bitcoin_fee_estimator
+2 -1
View File
@@ -9,10 +9,11 @@ from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from chia.plotting.prover import ProverProtocol
from typing import final
from chia_rs import G1Element, PrivateKey
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint32
from typing_extensions import final
from chia.util.config import load_config, lock_and_load_config, save_config
from chia.util.harvester_config import get_plot_directories
+1 -2
View File
@@ -3,13 +3,12 @@ from __future__ import annotations
import dataclasses
from dataclasses import dataclass, field, replace
from functools import cached_property
from typing import ClassVar
from typing import ClassVar, Self
from chia_rs import G1Element
from chia_rs.chia_rs import Coin, CoinSpend
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint32, uint64
from typing_extensions import Self
from chia.types.blockchain_format.program import Program, run
from chia.types.coin_spend import make_spend
+1 -2
View File
@@ -4,13 +4,12 @@ from collections.abc import Iterator
from contextlib import contextmanager
from dataclasses import dataclass
from pathlib import Path
from typing import TypedDict
from typing import NotRequired, Self, TypedDict
import yaml
from chia_rs import G1Element
from chia_rs.sized_byte_class import hexstr_to_bytes
from chia_rs.sized_bytes import bytes32
from typing_extensions import NotRequired, Self
from chia.util.config import lock_and_load_config, save_config
from chia.util.lock import Lockfile
+2 -2
View File
@@ -2,12 +2,12 @@ from __future__ import annotations
import dataclasses
import logging
from typing import TYPE_CHECKING, Any, ClassVar, cast
from typing import TYPE_CHECKING, Any, ClassVar, cast, final
from chia_rs import CoinSpend, G1Element, G2Element
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint32, uint64, uint128
from typing_extensions import Unpack, final
from typing_extensions import Unpack
from chia.pools.pool_config import PoolingShareState
from chia.pools.pool_puzzles import (
+1 -2
View File
@@ -7,12 +7,11 @@ from contextlib import asynccontextmanager
from dataclasses import dataclass
from pathlib import Path
from ssl import SSLContext
from typing import Any
from typing import Any, Self
import aiohttp
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint16
from typing_extensions import Self
from chia.protocols.outbound_message import NodeType
from chia.server.server import ssl_context_for_client
+3 -7
View File
@@ -4,14 +4,13 @@ import asyncio
import contextlib
import json
import logging
import sys
import traceback
from collections.abc import AsyncIterator, Awaitable, Callable
from dataclasses import dataclass, field
from pathlib import Path
from ssl import SSLContext
from types import MethodType
from typing import Any, ClassVar, Generic, TypeVar
from typing import Any, ClassVar, Generic, TypeVar, final
from aiohttp import (
ClientConnectorError,
@@ -21,7 +20,7 @@ from aiohttp import (
web,
)
from chia_rs.sized_ints import uint16
from typing_extensions import Protocol, final
from typing_extensions import Protocol
from chia import __version__
from chia.protocols.outbound_message import NodeType
@@ -356,10 +355,7 @@ class RpcServer(Generic[_T_RpcApiProtocol]):
level_number = logger.level
level_name = logging.getLevelName(level_number)
if sys.version_info >= (3, 11):
map = logging.getLevelNamesMapping()
else:
map = logging._nameToLevel
map = logging.getLevelNamesMapping()
return {
"success": True,
+1 -1
View File
@@ -92,7 +92,7 @@ class Crawler:
if self.crawl_task is not None:
try:
await asyncio.wait_for(self.crawl_task, timeout=10) # wait 10 seconds before giving up
except asyncio.TimeoutError:
except TimeoutError:
self.log.error("Crawl task did not exit in time, killing task.")
self.crawl_task.cancel()
if self.crawl_store is not None:
+1 -1
View File
@@ -208,7 +208,7 @@ class TCPDNSServerProtocol(asyncio.BufferedProtocol):
"""
try:
await asyncio.wait_for(asyncio.gather(*self.futures), timeout=10)
except asyncio.TimeoutError:
except TimeoutError:
log.warning(f"Timed out waiting for DNS replies to be sent to {self.peer_info}.")
if self.transport is not None:
self.transport.close()
+4 -5
View File
@@ -9,7 +9,7 @@ from collections.abc import Awaitable, Callable
from dataclasses import dataclass, field
from ipaddress import IPv4Network, IPv6Network, ip_network
from pathlib import Path
from typing import TYPE_CHECKING, Any, cast
from typing import TYPE_CHECKING, Any, cast, final
from aiohttp import (
ClientResponseError,
@@ -25,7 +25,6 @@ from chia_rs.sized_ints import uint16
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from typing_extensions import final
from chia.protocols.outbound_message import Message, NodeType
from chia.protocols.protocol_message_types import ProtocolMessageTypes
@@ -380,7 +379,7 @@ class ChiaServer:
await self.connection_added(connection, self.on_connect)
if self.introducer_peers is not None and connection.connection_type is NodeType.FULL_NODE:
self.introducer_peers.add(connection.get_peer_info())
except asyncio.TimeoutError:
except TimeoutError:
if connection is not None:
await connection.close(
self.invalid_protocol_ban_seconds, WSCloseCode.PROTOCOL_ERROR, Err.INVALID_HANDSHAKE
@@ -494,7 +493,7 @@ class ChiaServer:
except ClientResponseError as e:
self.log.warning(f"Connection failed to {url}. Error: {e}")
return False
except asyncio.TimeoutError:
except TimeoutError:
self.log.debug(f"Timeout error connecting to {url}")
return False
if ws is None:
@@ -561,7 +560,7 @@ class ChiaServer:
self.log.debug(f"Feeler connection error. {e}")
else:
self.log.info(f"{e}")
except asyncio.TimeoutError:
except TimeoutError:
if connection is not None:
await connection.close()
self.log.debug(f"Handshake timeout connecting to {target_node}")
+3 -3
View File
@@ -9,7 +9,7 @@ import unicodedata
from collections.abc import Awaitable, Callable
from dataclasses import dataclass, field
from ipaddress import IPv4Network, IPv6Network
from typing import Any
from typing import Any, final
from aiohttp import ClientSession, WebSocketError, WSCloseCode, WSMsgType
from aiohttp.client import ClientWebSocketResponse
@@ -17,7 +17,7 @@ from aiohttp.web import WebSocketResponse
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import int16, uint8, uint16
from packaging.version import Version
from typing_extensions import Protocol, final
from typing_extensions import Protocol
from chia import __version__
from chia.protocols.outbound_message import Message, NodeType, make_msg
@@ -767,7 +767,7 @@ class WSChiaConnection:
try:
await asyncio.wait_for(event.wait(), timeout=timeout)
except asyncio.TimeoutError:
except TimeoutError:
self.log.debug(f"Request timeout: {message}")
result = self.request_results.pop(message.id, None)
+1 -2
View File
@@ -17,7 +17,7 @@ from functools import lru_cache
from pathlib import Path
from random import Random
from types import TracebackType
from typing import Any
from typing import Any, Self
import anyio
from chia_puzzles_py.programs import CHIALISP_DESERIALISATION, ROM_BOOTSTRAP_GENERATOR
@@ -46,7 +46,6 @@ from chia_rs import (
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint8, uint16, uint32, uint64, uint128
from filelock import FileLock
from typing_extensions import Self
from chia.consensus.block_creation import (
calculate_infusion_point_total_iters,
+2 -2
View File
@@ -119,8 +119,8 @@ def make_ca_cert(cert_path: Path, key_path: Path):
.issuer_name(issuer)
.public_key(root_key.public_key())
.serial_number(x509.random_serial_number())
.not_valid_before(datetime.datetime.now(datetime.timezone.utc))
.not_valid_after(datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=3650))
.not_valid_before(datetime.datetime.now(datetime.UTC))
.not_valid_after(datetime.datetime.now(datetime.UTC) + datetime.timedelta(days=3650))
.add_extension(x509.BasicConstraints(ca=True, path_length=None), critical=True)
.sign(root_key, hashes.SHA256(), default_backend())
)
+1 -2
View File
@@ -2,7 +2,7 @@ from __future__ import annotations
import io
from collections.abc import Callable
from typing import TYPE_CHECKING, Any, ClassVar, TypeVar
from typing import TYPE_CHECKING, Any, ClassVar, Self, TypeVar
from chia_rs import MEMPOOL_MODE, run_chia_program, tree_hash
from chia_rs.sized_bytes import bytes32
@@ -10,7 +10,6 @@ from clvm.CLVMObject import CLVMStorage
from clvm.EvalError import EvalError
from clvm.serialize import sexp_from_stream, sexp_to_stream
from clvm.SExp import SExp
from typing_extensions import Self
from chia.types.blockchain_format.serialized_program import SerializedProgram
from chia.types.blockchain_format.tree_hash import sha256_treehash
+1 -3
View File
@@ -4,9 +4,7 @@ import contextlib
import copy
from collections.abc import AsyncIterator, Awaitable, Callable
from dataclasses import dataclass, field
from typing import Generic, TypeVar
from typing_extensions import Self
from typing import Generic, Self, TypeVar
_T_SideEffects = TypeVar("_T_SideEffects")
_T_Config = TypeVar("_T_Config")
+10 -26
View File
@@ -6,16 +6,14 @@ import functools
import logging
import secrets
import sqlite3
import sys
from collections.abc import AsyncIterator, Iterable, Iterator
from dataclasses import dataclass, field
from datetime import datetime
from pathlib import Path
from typing import Any, TextIO
from typing import Any, TextIO, final
import aiosqlite
import anyio
from typing_extensions import final
if aiosqlite.sqlite_version_info < (3, 32, 0):
SQLITE_MAX_VARIABLE_NUMBER = 900
@@ -158,18 +156,9 @@ def sql_trace_callback(req: str, file: TextIO, name: str | None = None) -> None:
def get_host_parameter_limit() -> int:
# NOTE: This does not account for dynamically adjusted limits since it makes a
# separate db and connection. If aiosqlite adds support we should use it.
if sys.version_info >= (3, 11):
with contextlib.closing(sqlite3.connect(":memory:")) as connection:
limit_number = sqlite3.SQLITE_LIMIT_VARIABLE_NUMBER
host_parameter_limit = connection.getlimit(limit_number)
# guessing based on defaults, seems you can't query
# https://www.sqlite.org/changes.html#version_3_32_0
# Increase the default upper bound on the number of parameters from 999 to 32766.
elif sqlite3.sqlite_version_info >= (3, 32, 0):
host_parameter_limit = 32766
else:
host_parameter_limit = 999
with contextlib.closing(sqlite3.connect(":memory:")) as connection:
limit_number = sqlite3.SQLITE_LIMIT_VARIABLE_NUMBER
host_parameter_limit = connection.getlimit(limit_number)
return host_parameter_limit
@@ -182,10 +171,9 @@ def _suppress_task_cancellation() -> Iterator[None]:
1. ``anyio.CancelScope(shield=True)`` — prevents NEW ``task.cancel()``
calls from anyio's cancellation delivery (e.g. scope timeouts, task
group cancellation) during the await.
2. ``task.uncancel()`` (Python 3.11+) — clears any ALREADY-PENDING
``_must_cancel`` flag so the await is not immediately interrupted.
On exit, the flag is re-applied so cancellation fires at the next
*unprotected* await point.
2. ``task.uncancel()`` — clears any ALREADY-PENDING ``_must_cancel`` flag
so the await is not immediately interrupted. On exit, the flag is
re-applied so cancellation fires at the next *unprotected* await point.
The anyio shield alone is insufficient because its
``_restart_cancellation_in_parent()`` re-calls ``task.cancel()`` when
@@ -196,17 +184,13 @@ def _suppress_task_cancellation() -> Iterator[None]:
outside anyio's scope tree (e.g. ``ws_connection.cancel_tasks()``).
Callers that need to handle that case should place the protected await
inside a try/except/finally for cleanup.
On Python < 3.11 (which lacks ``task.cancelling()``/``task.uncancel()``),
only the anyio shield is active.
"""
task = asyncio.current_task()
assert task is not None
saved = 0
if sys.version_info >= (3, 11):
while task.cancelling() > 0:
task.uncancel()
saved += 1
while task.cancelling() > 0:
task.uncancel()
saved += 1
with anyio.CancelScope(shield=True):
try:
yield
+1 -2
View File
@@ -10,11 +10,10 @@ from dataclasses import asdict, dataclass, field
from hashlib import pbkdf2_hmac
from pathlib import Path
from secrets import token_bytes
from typing import Any, cast
from typing import Any, cast, final
import yaml
from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305 # pyright: reportMissingModuleSource=false
from typing_extensions import final
from watchdog.events import DirModifiedEvent, FileSystemEvent, FileSystemEventHandler
from watchdog.observers import Observer
from watchdog.observers.api import BaseObserver
+1 -2
View File
@@ -6,14 +6,13 @@ from collections.abc import Iterator
from dataclasses import dataclass
from hashlib import pbkdf2_hmac
from pathlib import Path
from typing import Any, Literal, overload
from typing import Any, Literal, final, overload
import importlib_resources
from bitstring import BitArray # pyright: reportMissingImports=false
from chia_rs import AugSchemeMPL, G1Element, PrivateKey # pyright: reportMissingImports=false
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint32
from typing_extensions import final
from chia.util.bech32m import bech32_decode, convertbits
from chia.util.byte_types import hexstr_to_bytes
+1 -2
View File
@@ -4,8 +4,7 @@ import asyncio
import contextlib
from collections.abc import AsyncIterator
from dataclasses import dataclass
from typing_extensions import final
from typing import final
class LimitedSemaphoreFullError(Exception):
+1 -1
View File
@@ -3,9 +3,9 @@ from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from types import TracebackType
from typing import final
from filelock import BaseFileLock, FileLock, Timeout
from typing_extensions import final
class LockfileError(Exception):
+1 -2
View File
@@ -8,14 +8,13 @@ import ssl
from collections.abc import Iterable
from dataclasses import dataclass
from ipaddress import IPv4Network, IPv6Network, ip_address
from typing import Any, Literal
from typing import Any, Literal, final
from urllib.parse import urlsplit
from aiohttp import web
from aiohttp.log import web_logger
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint16
from typing_extensions import final
from chia.util.ip_address import IPAddress
from chia.util.task_referencer import create_referenced_task
+1 -3
View File
@@ -7,9 +7,7 @@ import dataclasses
import logging
from collections.abc import AsyncIterator
from enum import IntEnum
from typing import Generic, TypeVar
from typing_extensions import final
from typing import Generic, TypeVar, final
log = logging.getLogger(__name__)
+1 -3
View File
@@ -9,9 +9,7 @@ from collections.abc import Callable
from concurrent.futures import Future
from dataclasses import dataclass, field
from types import TracebackType
from typing import Any, Protocol, runtime_checkable
from typing_extensions import Self
from typing import Any, Protocol, Self, runtime_checkable
log = logging.getLogger(__name__)
+1 -1
View File
@@ -16,6 +16,7 @@ from typing import (
BinaryIO,
ClassVar,
Literal,
Self,
TypeVar,
Union,
get_args,
@@ -25,7 +26,6 @@ from typing import (
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint16, uint32, uint64
from typing_extensions import Self
from chia.util.byte_types import hexstr_to_bytes
from chia.util.hash import std_hash
+2 -2
View File
@@ -4,12 +4,12 @@ import dataclasses
import logging
import time
import traceback
from typing import TYPE_CHECKING, Any, ClassVar, cast
from typing import TYPE_CHECKING, Any, ClassVar, Self, cast
from chia_rs import CoinSpend, CoinState, G1Element
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint32, uint64, uint128
from typing_extensions import Self, Unpack
from typing_extensions import Unpack
from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.server.ws_connection import WSChiaConnection
+1 -2
View File
@@ -3,13 +3,12 @@ from __future__ import annotations
import logging
from dataclasses import dataclass
from enum import IntEnum
from typing import TYPE_CHECKING, Any, ClassVar, cast
from typing import TYPE_CHECKING, Any, ClassVar, Self, cast
from chia_rs import G1Element
from chia_rs.sized_byte_class import hexstr_to_bytes
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint8, uint16
from typing_extensions import Self
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.program import Program
+1 -2
View File
@@ -3,12 +3,11 @@ from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Iterable
from dataclasses import dataclass, fields, replace
from typing import Any, ClassVar, TypeVar, final, get_type_hints
from typing import Any, ClassVar, Self, TypeVar, final, get_type_hints
from chia_rs import Coin, G1Element
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint8, uint32, uint64
from typing_extensions import Self
from chia.types.blockchain_format.program import Program
from chia.types.condition_opcodes import ConditionOpcode
+1 -3
View File
@@ -1,8 +1,6 @@
from __future__ import annotations
from typing import Protocol, TypeVar
from typing_extensions import Self
from typing import Protocol, Self, TypeVar
from chia.util.db_wrapper import DBWrapper2
+1 -2
View File
@@ -2,12 +2,11 @@ from __future__ import annotations
import logging
from dataclasses import dataclass
from typing import Any, ClassVar, Literal
from typing import Any, ClassVar, Literal, Self
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint16, uint64
from clvm_tools.binutils import disassemble
from typing_extensions import Self
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.serialized_program import SerializedProgram
+1 -1
View File
@@ -2,11 +2,11 @@ from __future__ import annotations
import logging
from dataclasses import dataclass
from typing import Self
from chia_rs import CoinSpend, CoinState
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint16
from typing_extensions import Self
from chia.types.blockchain_format.program import Program
from chia.util.streamable import Streamable, streamable
+1 -1
View File
@@ -2,11 +2,11 @@ from __future__ import annotations
from collections.abc import AsyncGenerator
from sqlite3 import Row
from typing import Self
from chia_rs import Coin, G1Element
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint32, uint64
from typing_extensions import Self
from chia.pools.plotnft_drivers import PlotNFT, PoolConfig, PoolReward, UserConfig
from chia.types.blockchain_format.program import Program
+2 -2
View File
@@ -2,13 +2,13 @@ from __future__ import annotations
import dataclasses
import logging
from typing import TYPE_CHECKING, ClassVar, cast, final
from typing import TYPE_CHECKING, ClassVar, Self, cast, final
from chia_rs import CoinSpend, G2Element
from chia_rs.chia_rs import Coin, G1Element
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint8, uint32, uint64, uint128
from typing_extensions import Self, Unpack
from typing_extensions import Unpack
from chia.pools.plotnft_drivers import (
GetNextPlotNFTError,
+1 -2
View File
@@ -1,11 +1,10 @@
from __future__ import annotations
from typing import Any
from typing import Any, Self
from clvm.SExp import SExp
from clvm_tools.binutils import assemble, type_for_atom
from ir.Type import Type
from typing_extensions import Self
from chia.types.blockchain_format.program import Program
from chia.util.byte_types import hexstr_to_bytes
+1 -2
View File
@@ -1,11 +1,10 @@
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from typing import Any, Self
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint8, uint32, uint64
from typing_extensions import Self
from chia.types.blockchain_format.coin import Coin
from chia.util.streamable import Streamable, streamable
+2 -2
View File
@@ -1,12 +1,12 @@
from __future__ import annotations
import dataclasses
from typing import Any
from typing import Any, NotRequired, Self
from chia_rs import ConsensusConstants
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint64
from typing_extensions import NotRequired, Self, TypedDict, Unpack
from typing_extensions import TypedDict, Unpack
from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.types.blockchain_format.coin import Coin
+1 -1
View File
@@ -4,6 +4,7 @@ import functools
from collections.abc import Iterable
from dataclasses import dataclass, replace
from enum import IntEnum
from typing import Self
from chia_puzzles_py.programs import (
CONDITIONS_W_FEE_ANNOUNCE,
@@ -18,7 +19,6 @@ from chia_puzzles_py.programs import (
from chia_rs import CoinSpend
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint16, uint64
from typing_extensions import Self
from chia.types.blockchain_format.coin import Coin, coin_as_list
from chia.types.blockchain_format.program import Program
+2 -2
View File
@@ -3,12 +3,12 @@ from __future__ import annotations
import logging
import time
import traceback
from typing import TYPE_CHECKING, Any, ClassVar
from typing import TYPE_CHECKING, Any, ClassVar, Self
from chia_rs import CoinSpend, G1Element, G2Element
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint8, uint32, uint64, uint128
from typing_extensions import Self, Unpack
from typing_extensions import Unpack
from chia.server.ws_connection import WSChiaConnection
from chia.types.blockchain_format.coin import Coin, coin_as_list
+1 -2
View File
@@ -1,7 +1,7 @@
from __future__ import annotations
from dataclasses import dataclass, replace
from typing import Any, Generic, TypeVar, final
from typing import Any, Generic, Self, TypeVar, final
from chia_puzzles_py.programs import ACS_TRANSFER_PROGRAM as ACS_TRANSFER_PROGRAM_BYTES
from chia_puzzles_py.programs import COVENANT_LAYER as COVENANT_LAYER_BYTES
@@ -23,7 +23,6 @@ from chia_puzzles_py.programs import STD_PARENT_MORPHER_HASH as STD_PARENT_MORPH
from chia_rs import CoinSpend
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint64
from typing_extensions import Self
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.program import Program
+1 -1
View File
@@ -2,11 +2,11 @@ from __future__ import annotations
import dataclasses
from functools import cmp_to_key
from typing import Self
from aiosqlite import Row
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint32, uint64
from typing_extensions import Self
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.program import Program
+1 -1
View File
@@ -3,10 +3,10 @@ from __future__ import annotations
import json
import logging
from sqlite3 import Row
from typing import Self
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint32
from typing_extensions import Self
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.program import Program
+2 -2
View File
@@ -1,11 +1,11 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, TypeVar, runtime_checkable
from typing import TYPE_CHECKING, Any, NotRequired, TypeVar, runtime_checkable
from chia_rs import G1Element
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint32, uint64, uint128
from typing_extensions import NotRequired, Protocol, TypedDict, Unpack
from typing_extensions import Protocol, TypedDict, Unpack
from chia.server.ws_connection import WSChiaConnection
from chia.types.blockchain_format.coin import Coin
+1 -2
View File
@@ -4,12 +4,11 @@ from copy import deepcopy
from dataclasses import dataclass, field, fields
from enum import Enum
from functools import cached_property
from typing import Any, BinaryIO, TypeVar, final
from typing import Any, BinaryIO, Self, TypeVar, final
from chia_rs import Coin, CoinRecord, G1Element, G2Element, PrivateKey
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint8, uint16, uint32, uint64
from typing_extensions import Self
from chia.data_layer.data_layer_wallet import DataLayerSummary, Mirror
from chia.data_layer.singleton_record import SingletonRecord
+2 -2
View File
@@ -4,7 +4,7 @@ import dataclasses
import json
import logging
from collections.abc import Callable
from datetime import datetime, timezone
from datetime import UTC, datetime
from itertools import count
from pathlib import Path
from types import MethodType
@@ -942,7 +942,7 @@ class WalletRpcApi:
except ValueError as e:
raise ValueError("Wallet is not currently connected to any full node peers") from e
now_utc: int = int(datetime.now(timezone.utc).timestamp())
now_utc: int = int(datetime.now(UTC).timestamp())
time_targets = [uint64(now_utc)]
fee_estimate_group = await self.service.request_fee_estimates(peer, time_targets)
+1 -1
View File
@@ -3,11 +3,11 @@ from __future__ import annotations
import dataclasses
import logging
import time
from typing import Any
import aiosqlite
from chia_rs.sized_bytes import bytes32
from chia_rs.sized_ints import uint8, uint32
from typing_extensions import Any
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
from chia.util.bech32m import encode_puzzle_hash
+2 -1
View File
@@ -1,7 +1,8 @@
from __future__ import annotations
from typing import Self
from chia_rs.sized_ints import uint32
from typing_extensions import Self
from chia.util.db_wrapper import DBWrapper2, execute_fetchone
from chia.wallet.util.wallet_types import WalletType
+4 -4
View File
@@ -58,7 +58,7 @@ if [ "$(uname -m)" = "armv7l" ]; then
fi
# You can specify preferred python version by exporting `INSTALL_PYTHON_VERSION`
# e.g. `export INSTALL_PYTHON_VERSION=3.10`
# e.g. `export INSTALL_PYTHON_VERSION=3.11`
INSTALL_PYTHON_PATH=
PYTHON_MAJOR_VER=
PYTHON_MINOR_VER=
@@ -71,7 +71,7 @@ OPENSSL_VERSION_INT=
find_python() {
set +e
unset BEST_VERSION
for V in 314 3.14 313 3.13 312 3.12 311 3.11 310 3.10 3; do
for V in 314 3.14 313 3.13 312 3.12 311 3.11 3; do
if command -v python$V >/dev/null; then
if [ "$BEST_VERSION" = "" ]; then
BEST_VERSION=$V
@@ -134,8 +134,8 @@ if ! command -v "$INSTALL_PYTHON_PATH" >/dev/null; then
exit 1
fi
if [ "$PYTHON_MAJOR_VER" -ne "3" ] || [ "$PYTHON_MINOR_VER" -lt "10" ] || [ "$PYTHON_MINOR_VER" -ge "15" ]; then
echo "Chia requires Python version >= 3.10 and < 3.15.0" >&2
if [ "$PYTHON_MAJOR_VER" -ne "3" ] || [ "$PYTHON_MINOR_VER" -lt "11" ] || [ "$PYTHON_MINOR_VER" -ge "15" ]; then
echo "Chia requires Python version >= 3.11 and < 3.15.0" >&2
echo "Current Python version = $INSTALL_PYTHON_VERSION" >&2
# If Arch, direct to Arch Wiki
if type pacman >/dev/null 2>&1 && [ -f "/etc/arch-release" ]; then
+6 -54
View File
@@ -156,7 +156,6 @@ files = [
[package.dependencies]
aiohappyeyeballs = ">=2.5.0"
aiosignal = ">=1.4.0"
async-timeout = {version = ">=4.0,<6.0", markers = "python_version < \"3.11\""}
attrs = ">=17.3.0"
frozenlist = ">=1.1.1"
multidict = ">=4.5,<7.0"
@@ -241,7 +240,6 @@ files = [
]
[package.dependencies]
exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""}
idna = ">=2.8"
typing_extensions = {version = ">=4.16.0", markers = "python_version < \"3.15\""}
@@ -375,19 +373,6 @@ files = [
{file = "ast_serialize-0.8.0.tar.gz", hash = "sha256:6c37c43e4004dfb42d321ddedc569dc17ff4259296f3af577c9ea46a809bc010"},
]
[[package]]
name = "async-timeout"
version = "5.0.1"
description = "Timeout context manager for asyncio programs"
optional = false
python-versions = ">=3.8"
groups = ["main"]
markers = "python_version == \"3.10\""
files = [
{file = "async_timeout-5.0.1-py3-none-any.whl", hash = "sha256:39e3809566ff85354557ec2398b55e096c8364bacac9405a7a1fa429e77fe76c"},
{file = "async_timeout-5.0.1.tar.gz", hash = "sha256:d9321a7a3d5a6a5e187e824d2fa0793ce379a202935782d555d6e9d2735677d3"},
]
[[package]]
name = "attrs"
version = "25.4.0"
@@ -407,7 +392,7 @@ description = "Backport of CPython tarfile module"
optional = false
python-versions = ">=3.8"
groups = ["main"]
markers = "python_version < \"3.12\""
markers = "python_version == \"3.11\""
files = [
{file = "backports.tarfile-1.2.0-py3-none-any.whl", hash = "sha256:77e284d754527b01fb1e6fa8a1afe577858ebe4e9dad8919e34c862cb399bc34"},
{file = "backports_tarfile-1.2.0.tar.gz", hash = "sha256:d75e02c268746e1b8144c278978b6e98e85de6ad16f8e4b0844a154557eca991"},
@@ -1119,10 +1104,8 @@ files = [
[package.dependencies]
colorama = {version = "*", markers = "os_name == \"nt\""}
importlib-metadata = {version = ">=4.6", markers = "python_full_version < \"3.10.2\""}
packaging = ">=24.0"
pyproject_hooks = "*"
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
[package.extras]
keyring = ["keyring"]
@@ -1884,9 +1867,6 @@ files = [
{file = "coverage-7.16.1.tar.gz", hash = "sha256:f83981779bcf9dfa06fa0a8d4cb43e0faec1706328ce07aa3e7b665b4ac0f210"},
]
[package.dependencies]
tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""}
[package.extras]
toml = ["tomli ; python_full_version <= \"3.11.0a6\""]
@@ -1949,7 +1929,6 @@ files = [
[package.dependencies]
cffi = {version = ">=2.0.0", markers = "platform_python_implementation != \"PyPy\""}
typing-extensions = {version = ">=4.13.2", markers = "python_full_version < \"3.11.0\""}
[package.extras]
ssh = ["bcrypt (>=3.1.5)"]
@@ -1969,7 +1948,6 @@ files = [
[package.dependencies]
cffi = {version = ">=2.0.0", markers = "platform_python_implementation != \"PyPy\""}
typing-extensions = {version = ">=4.13.2", markers = "python_full_version < \"3.11.0\""}
[package.extras]
ssh = ["bcrypt (>=3.1.5)"]
@@ -2060,25 +2038,6 @@ idna = ["idna (>=3.10)"]
trio = ["trio (>=0.30)"]
wmi = ["wmi (>=1.5.1) ; platform_system == \"Windows\""]
[[package]]
name = "exceptiongroup"
version = "1.3.1"
description = "Backport of PEP 654 (exception groups)"
optional = false
python-versions = ">=3.7"
groups = ["main"]
markers = "python_version == \"3.10\""
files = [
{file = "exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598"},
{file = "exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219"},
]
[package.dependencies]
typing-extensions = {version = ">=4.6.0", markers = "python_version < \"3.13\""}
[package.extras]
test = ["pytest (>=6)"]
[[package]]
name = "execnet"
version = "2.1.2"
@@ -3293,9 +3252,6 @@ files = [
{file = "multidict-6.7.1.tar.gz", hash = "sha256:ec6652a1bee61c53a3e5776b6049172c53b6aaba34f18c9ad04f82712bac623d"},
]
[package.dependencies]
typing-extensions = {version = ">=4.1.0", markers = "python_version < \"3.11\""}
[[package]]
name = "mypy"
version = "2.3.1"
@@ -3364,7 +3320,6 @@ ast-serialize = ">=0.6.0,<1.0.0"
librt = {version = ">=0.13.0", markers = "platform_python_implementation != \"PyPy\""}
mypy_extensions = ">=1.0.0"
pathspec = ">=1.0.0"
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
typing_extensions = [
{version = ">=4.6.0", markers = "python_version < \"3.15\""},
{version = ">=4.14.0", markers = "python_version >= \"3.15\""},
@@ -4063,12 +4018,10 @@ files = [
[package.dependencies]
colorama = {version = ">=0.4", markers = "sys_platform == \"win32\""}
exceptiongroup = {version = ">=1", markers = "python_version < \"3.11\""}
iniconfig = ">=1"
packaging = ">=20"
pluggy = ">=1.5,<2"
pygments = ">=2.7.2"
tomli = {version = ">=1", markers = "python_version < \"3.11\""}
[package.extras]
dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "requests", "setuptools", "xmlschema"]
@@ -4717,10 +4670,10 @@ dev = ["build", "hypothesis (>=6.151.0)", "pyright (>=1.1.389)", "pytest (>=9.0.
name = "tomli"
version = "2.4.0"
description = "A lil' TOML parser"
optional = false
optional = true
python-versions = ">=3.8"
groups = ["main"]
markers = "extra == \"dev\" or python_version == \"3.10\""
markers = "extra == \"dev\""
files = [
{file = "tomli-2.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b5ef256a3fd497d4973c11bf142e9ed78b150d36f5773f1ca6088c230ffc5867"},
{file = "tomli-2.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5572e41282d5268eb09a697c89a7bee84fae66511f87533a6f88bd2f7b652da9"},
@@ -4987,7 +4940,6 @@ files = [
distlib = ">=0.3.7,<1"
filelock = {version = ">=3.20.1,<4", markers = "python_version >= \"3.10\""}
platformdirs = ">=3.9.1,<5"
typing-extensions = {version = ">=4.13.2", markers = "python_version < \"3.11\""}
[package.extras]
docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"]
@@ -5240,7 +5192,7 @@ description = "ZSTD Bindings for Python"
optional = false
python-versions = "*"
groups = ["main"]
markers = "python_version < \"3.12\""
markers = "python_version == \"3.11\""
files = [
{file = "zstd-1.5.7.2-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:e17104d0e88367a7571dde4286e233126c8551691ceff11f9ae2e3a3ac1bb483"},
{file = "zstd-1.5.7.2-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:d6ee5dfada4c8fa32f43cc092fcf7d8482da6ad242c22fdf780f7eebd0febcc7"},
@@ -5440,5 +5392,5 @@ upnp = ["miniupnpc"]
[metadata]
lock-version = "2.1"
python-versions = ">=3.10, <4"
content-hash = "e11d038ee07d4f2a4224f66d6e4a2bd0533e6060ec0afaa8f279a0f1c6a9673d"
python-versions = ">=3.11, <4"
content-hash = "8c493a1dcbd284e725f15cc65fac965279ba7ad5368650b798c76611bc07b7e3"
+1 -5
View File
@@ -2,7 +2,7 @@
name = "chia-blockchain"
dynamic = [ "dependencies", "version" ]
description = "Chia blockchain full node, farmer, timelord, and wallet."
requires-python = ">=3.10, <4"
requires-python = ">=3.11, <4"
authors = [
{name="Mariano Sorgente", email="mariano@chia.net"}
]
@@ -114,10 +114,6 @@ sortedcontainers-stubs = {version = ">= 2.4.3", optional = true }
types-colorama = { version = ">=0.4.15.20260508", optional = true }
lxml = { version = ">=6.1.0", optional = true }
miniupnpc = {version = ">=2.3.2, <3", source = "chia", optional = true}
# big-o = {version = "0.11.0", optional = true}
# numpy = [
# {version="<=1.24.4", python = "<3.10", optional = true},
# {version=">=1.26.4", python = ">=3.10", optional = true}]
ruff = { version = ">=0.16.7", optional = true }
[project.optional-dependencies]
+6
View File
@@ -43,6 +43,12 @@ ignore = [
# flake8-implicit-str-concat
"ISC003", # explicit-string-concatenation
# pyupgrade
# `StrEnum` changes `str()` and `format()` output. The remaining `(str, Enum)` classes
# cross the daemon websocket protocol, RPC error payloads and benchmark CLI parsing.
# TODO: convert these to `enum.StrEnum`
"UP042", # replace-str-enum
# Ruff Specific
# This code is problematic because using instantiated types as defaults is so common across the codebase.