Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/check_wheel_availability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
matrix: arm
- name: Intel
matrix: intel
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12"]
exclude:
- os:
matrix: windows
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
- name: Intel
matrix: intel
python:
- major_dot_minor: "3.9"
- major_dot_minor: "3.10"
- major_dot_minor: "3.11"
- major_dot_minor: "3.12"
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/test-install-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ jobs:
if: ${{ matrix.distribution.type == 'amazon' }}
run: |
yum install --assumeyes git sudo
sudo dnf update -y
sudo dnf search python3.12
sudo dnf install python3.12 -y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe. but maybe we should be testing on a newer amazon?

what's the reason for yum vs dnf. also odd that we need to use sudo for one and not the other. was the search for debug?


- name: Prepare Arch
if: ${{ matrix.distribution.type == 'arch' }}
Expand Down Expand Up @@ -242,7 +245,10 @@ jobs:
- name: Prepare Rocky
if: ${{ matrix.distribution.type == 'rocky' }}
run: |
yum install --assumeyes git sudo python39
yum install --assumeyes git sudo
sudo dnf update -y
sudo dnf search python3.12
sudo dnf install python3.12 -y

- name: Prepare Ubuntu
if: ${{ matrix.distribution.type == 'ubuntu' }}
Expand All @@ -251,7 +257,7 @@ jobs:
run: |
apt-get --yes update
apt-get install --yes git lsb-release sudo
MINIMUM=3.9
MINIMUM=3.10
if ! apt-get satisfy --yes "python3-venv (>= ${MINIMUM})"
then
apt-get install --yes python${MINIMUM}-venv
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/test-single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,6 @@ jobs:
- matrix: ${{ inputs.arch }}
emoji: ${{ inputs.arch-emoji }}
python:
- name: "3.9"
file_name: "3.9"
action: "3.9"
apt: "3.9"
install_sh: "3.9"
matrix: "3.9"
exclude_from:
limited: True
main: True
- name: "3.10"
file_name: "3.10"
action: "3.10"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/upload-pypi-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ jobs:
emoji: 🌀
matrix: intel
python:
- major_dot_minor: "3.9"
- major_dot_minor: "3.10"
- major_dot_minor: "3.11"
- major_dot_minor: "3.12"
Expand Down
2 changes: 1 addition & 1 deletion Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if ($null -eq (Get-Command py -ErrorAction SilentlyContinue))
Exit 1
}

$supportedPythonVersions = "3.12", "3.11", "3.10", "3.9"
$supportedPythonVersions = "3.12", "3.11", "3.10"
if ("$env:INSTALL_PYTHON_VERSION" -ne "")
{
$pythonVersion = $env:INSTALL_PYTHON_VERSION
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.9+ is required. Make sure your default python version is >=3.9 by typing `python3`.
Python 3.10+ is required. Make sure your default python version is >=3.10 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.
Expand Down
2 changes: 1 addition & 1 deletion chia/_tests/cmds/test_dev_gh.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async def test_successfully_dispatches(
assert by_name["macos-intel"]["conclusion"] == "skipped"
assert by_name["windows"]["conclusion"] == "skipped"

versions = ["3.9", "3.10", "3.11", "3.12"]
versions = ["3.10", "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(" / ")
Expand Down
2 changes: 1 addition & 1 deletion chia/_tests/util/test_priority_mutex.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def sane(requests: list[Request]) -> bool:
return False

ordered = sorted(requests)
return all(a.before(b) for a, b in zip(ordered, ordered[1:]))
return all(a.before(b) for a, b in itertools.pairwise(ordered))


@dataclass
Expand Down
28 changes: 6 additions & 22 deletions chia/cmds/cmd_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import dataclasses
import inspect
import pathlib
import sys
from dataclasses import MISSING, dataclass, field, fields
from typing import (
Any,
Expand Down Expand Up @@ -45,20 +44,14 @@ async def run(self) -> None: ...


def option(*param_decls: str, **kwargs: Any) -> Any:
if sys.version_info >= (3, 10):
default_default = MISSING
else: # versions < 3.10 don't know about kw_only and they complain about lacks of defaults
# Can't get coverage on this because we only test on one version
default_default = None # pragma: no cover

return field(
metadata=dict(
option_args=dict(
param_decls=tuple(param_decls),
**kwargs,
),
),
default=kwargs.get("default", default_default),
default=kwargs.get("default", MISSING),
)


Expand Down Expand Up @@ -270,16 +263,10 @@ def chia_command(
def _chia_command(cls: type[ChiaCommand]) -> type[ChiaCommand]:
# The type ignores here are largely due to the fact that the class information is not preserved after being
# passed through the dataclass wrapper. Not sure what to do about this right now.
if sys.version_info >= (3, 10):
wrapped_cls: type[ChiaCommand] = dataclass(
frozen=True,
kw_only=True,
)(cls)
else: # pragma: no cover
# stuff below 3.10 doesn't know about kw_only
wrapped_cls: type[ChiaCommand] = dataclass(
frozen=True,
)(cls)
wrapped_cls: type[ChiaCommand] = dataclass(
frozen=True,
kw_only=True,
)(cls)

metadata = Metadata(
command=click.command(
Expand Down Expand Up @@ -316,9 +303,6 @@ def get_chia_command_metadata(cls: type[ChiaCommand]) -> Metadata:

@dataclass_transform(frozen_default=True)
def command_helper(cls: type[Any]) -> type[Any]:
if sys.version_info >= (3, 10):
new_cls = dataclass(frozen=True, kw_only=True)(cls)
else: # stuff below 3.10 doesn't support kw_only
new_cls = dataclass(frozen=True)(cls) # pragma: no cover
new_cls = dataclass(frozen=True, kw_only=True)(cls)
setattr(new_cls, COMMAND_HELPER_ATTRIBUTE_NAME, True)
return new_cls
4 changes: 1 addition & 3 deletions chia/wallet/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1472,9 +1472,7 @@ def parse_timelock_info(conditions: Iterable[Condition]) -> ConditionValidTimes:
elif isinstance(condition, Timelock):
timelock = condition
else:
# Something about python 3.9 makes this be not covered but on 3.10+ it is covered
# https://github.com/nedbat/coveragepy/issues/1530
continue # pragma: no cover
continue

properties_left = properties.copy()
min_not_max: bool = True
Expand Down
43 changes: 17 additions & 26 deletions chia/wallet/wallet_request_types.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from __future__ import annotations

import sys
from dataclasses import dataclass, field
from typing import Any, BinaryIO, Optional, final

from chia_rs import Coin, 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, dataclass_transform
from typing_extensions import Self

from chia.data_layer.data_layer_wallet import Mirror
from chia.data_layer.singleton_record import SingletonRecord
Expand Down Expand Up @@ -40,14 +39,6 @@
from chia.wallet.wallet_spend_bundle import WalletSpendBundle


@dataclass_transform(frozen_default=True, kw_only_default=True)
def kw_only_dataclass(cls: type[Any]) -> type[Any]:
if sys.version_info >= (3, 10):
return dataclass(frozen=True, kw_only=True)(cls)
else:
return dataclass(frozen=True)(cls) # pragma: no cover


def default_raise() -> Any: # pragma: no cover
raise RuntimeError("This should be impossible to hit and is just for < 3.10 compatibility")

Expand Down Expand Up @@ -241,7 +232,7 @@ class GetWalletBalances(Streamable):

# utility for GetWalletBalanceResponse(s)
@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class BalanceResponse(Balance):
wallet_id: uint32 = field(default_factory=default_raise)
wallet_type: uint8 = field(default_factory=default_raise)
Expand Down Expand Up @@ -1236,7 +1227,7 @@ class ExecuteSigningInstructionsResponse(Streamable):
# field(default_factory=default_raise)
# (this is for < 3.10 compatibility)
@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class TransactionEndpointRequest(Streamable):
fee: uint64 = uint64(0)
push: Optional[bool] = None
Expand Down Expand Up @@ -1357,7 +1348,7 @@ class PushTransactionsResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class SplitCoins(TransactionEndpointRequest):
wallet_id: uint32 = field(default_factory=default_raise)
number_of_coins: uint16 = field(default_factory=default_raise)
Expand All @@ -1372,7 +1363,7 @@ class SplitCoinsResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class CombineCoins(TransactionEndpointRequest):
wallet_id: uint32 = field(default_factory=default_raise)
number_of_coins: uint16 = uint16(500)
Expand All @@ -1389,7 +1380,7 @@ class CombineCoinsResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class DIDMessageSpend(TransactionEndpointRequest):
wallet_id: uint32 = field(default_factory=default_raise)
coin_announcements: list[bytes] = field(default_factory=list)
Expand All @@ -1403,7 +1394,7 @@ class DIDMessageSpendResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class DIDUpdateMetadata(TransactionEndpointRequest):
wallet_id: uint32 = field(default_factory=default_raise)
metadata: dict[str, str] = field(default_factory=dict)
Expand All @@ -1417,7 +1408,7 @@ class DIDUpdateMetadataResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class DIDTransferDID(TransactionEndpointRequest):
wallet_id: uint32 = field(default_factory=default_raise)
inner_address: str = field(default_factory=default_raise)
Expand All @@ -1437,7 +1428,7 @@ class DIDTransferDIDResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class NFTMintNFTRequest(TransactionEndpointRequest):
wallet_id: uint32 = field(default_factory=default_raise)
royalty_address: Optional[str] = field(default_factory=default_raise)
Expand All @@ -1463,7 +1454,7 @@ class NFTMintNFTResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class NFTSetNFTDID(TransactionEndpointRequest):
wallet_id: uint32 = field(default_factory=default_raise)
nft_coin_id: bytes32 = field(default_factory=default_raise)
Expand All @@ -1478,7 +1469,7 @@ class NFTSetNFTDIDResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class NFTSetDIDBulk(TransactionEndpointRequest):
nft_coin_list: list[NFTCoin] = field(default_factory=default_raise)
did_id: Optional[str] = None
Expand All @@ -1493,7 +1484,7 @@ class NFTSetDIDBulkResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class NFTTransferBulk(TransactionEndpointRequest):
nft_coin_list: list[NFTCoin] = field(default_factory=default_raise)
target_address: str = field(default_factory=default_raise)
Expand All @@ -1508,7 +1499,7 @@ class NFTTransferBulkResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class CreateNewDL(TransactionEndpointRequest):
root: bytes32 = field(default_factory=default_raise)

Expand All @@ -1520,7 +1511,7 @@ class CreateNewDLResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class DLUpdateRoot(TransactionEndpointRequest):
launcher_id: bytes32 = field(default_factory=default_raise)
new_root: bytes32 = field(default_factory=default_raise)
Expand Down Expand Up @@ -1564,7 +1555,7 @@ def from_json_dict(cls, json_dict: dict[str, Any]) -> Self:


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class DLUpdateMultiple(TransactionEndpointRequest):
updates: DLUpdateMultipleUpdates = field(default_factory=default_raise)

Expand All @@ -1580,7 +1571,7 @@ class DLUpdateMultipleResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class DLNewMirror(TransactionEndpointRequest):
launcher_id: bytes32 = field(default_factory=default_raise)
amount: uint64 = field(default_factory=default_raise)
Expand All @@ -1594,7 +1585,7 @@ class DLNewMirrorResponse(TransactionEndpointResponse):


@streamable
@kw_only_dataclass
@dataclass(frozen=True, kw_only=True)
class DLDeleteMirror(TransactionEndpointRequest):
coin_id: bytes32 = field(default_factory=default_raise)

Expand Down
6 changes: 3 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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.9`
# e.g. `export INSTALL_PYTHON_VERSION=3.10`
INSTALL_PYTHON_PATH=
PYTHON_MAJOR_VER=
PYTHON_MINOR_VER=
Expand All @@ -72,7 +72,7 @@ OPENSSL_VERSION_INT=
find_python() {
set +e
unset BEST_VERSION
for V in 312 3.12 311 3.11 310 3.10 39 3.9 3; do
for V in 312 3.12 311 3.11 310 3.10 3; do
if command -v python$V >/dev/null; then
if [ "$BEST_VERSION" = "" ]; then
BEST_VERSION=$V
Expand Down Expand Up @@ -136,7 +136,7 @@ if ! command -v "$INSTALL_PYTHON_PATH" >/dev/null; then
fi

if [ "$PYTHON_MAJOR_VER" -ne "3" ] || [ "$PYTHON_MINOR_VER" -lt "7" ] || [ "$PYTHON_MINOR_VER" -ge "13" ]; then
echo "Chia requires Python version >= 3.9 and < 3.13.0" >&2
echo "Chia requires Python version >= 3.10 and < 3.13.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
Expand Down
Loading
Loading