Skip to content

Commit

Permalink
Add Python 3.12 support (Chia-Network#14423)
Browse files Browse the repository at this point in the history
* start adding python 3.12 support

* add missing comma

* include 3.12

* allow 3.12 in install.sh

* Bump chia wheels for python 3.12

* bump chiabip158

* Use datetime.timezone.UTC

* Update create_ssl.py

* UTC->utc

* Use datetime.timezone.utc

* bump chiavdf

---------

Co-authored-by: Earle Lowe <[email protected]>
Co-authored-by: Earle Lowe <[email protected]>
  • Loading branch information
3 people authored Mar 9, 2024
1 parent 59e7cd8 commit 13b75e8
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check_wheel_availability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
matrix: arm
- name: Intel
matrix: intel
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
exclude:
- os:
matrix: macos
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/test-single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ jobs:
exclude_from:
limited: True
main: True
- name: '3.12'
file_name: '3.12'
action: '3.12'
apt: '3.12'
install_sh: '3.12'
matrix: '3.12'
exclude_from:
limited: True
# main: True
exclude:
- os:
matrix: macos
Expand Down
2 changes: 1 addition & 1 deletion Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if ($null -eq (Get-Command py -ErrorAction SilentlyContinue))
Exit 1
}

$supportedPythonVersions = "3.11", "3.10", "3.9", "3.8"
$supportedPythonVersions = "3.12", "3.11", "3.10", "3.9", "3.8"
if ("$env:INSTALL_PYTHON_VERSION" -ne "")
{
$pythonVersion = $env:INSTALL_PYTHON_VERSION
Expand Down
4 changes: 2 additions & 2 deletions chia/ssl/create_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,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.utcnow())
.not_valid_after(datetime.datetime.utcnow() + datetime.timedelta(days=3650))
.not_valid_before(datetime.datetime.now(datetime.timezone.utc))
.not_valid_after(datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=3650))
.add_extension(x509.BasicConstraints(ca=True, path_length=None), critical=True)
.sign(root_key, hashes.SHA256(), default_backend())
)
Expand Down
6 changes: 3 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ OPENSSL_VERSION_INT=
find_python() {
set +e
unset BEST_VERSION
for V in 311 3.11 310 3.10 39 3.9 38 3.8 3; do
for V in 312 3.12 311 3.11 310 3.10 39 3.9 38 3.8 3; do
if command -v python$V >/dev/null; then
if [ "$BEST_VERSION" = "" ]; then
BEST_VERSION=$V
Expand Down Expand Up @@ -132,8 +132,8 @@ if ! command -v "$INSTALL_PYTHON_PATH" >/dev/null; then
exit 1
fi

if [ "$PYTHON_MAJOR_VER" -ne "3" ] || [ "$PYTHON_MINOR_VER" -lt "7" ] || [ "$PYTHON_MINOR_VER" -ge "12" ]; then
echo "Chia requires Python version >= 3.8 and < 3.12.0" >&2
if [ "$PYTHON_MAJOR_VER" -ne "3" ] || [ "$PYTHON_MINOR_VER" -lt "7" ] || [ "$PYTHON_MINOR_VER" -ge "13" ]; then
echo "Chia requires Python version >= 3.8 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
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"aiofiles==23.2.1", # Async IO for files
"anyio==4.2.0",
"boto3==1.34.46", # AWS S3 for DL s3 plugin
"chiavdf==1.1.1", # timelord and vdf verification
"chiabip158==1.3", # bip158-style wallet filters
"chiapos==2.0.3", # proof of space
"clvm==0.9.8",
"clvm_tools==0.4.8", # Currying, Program.to, other conveniences
"chiavdf==1.1.4", # timelord and vdf verification
"chiabip158==1.4", # bip158-style wallet filters
"chiapos==2.0.4", # proof of space
"clvm==0.9.9",
"clvm_tools==0.4.9", # Currying, Program.to, other conveniences
"chia_rs==0.5.2",
"clvm-tools-rs==0.1.40", # Rust implementation of clvm_tools' compiler
"aiohttp==3.9.1", # HTTP server for full node rpc
Expand Down
2 changes: 1 addition & 1 deletion tests/core/mempool/test_mempool_fee_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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.utcnow().timestamp())
now_unix_secs = int(datetime.datetime.now(datetime.timezone.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)
Expand Down

0 comments on commit 13b75e8

Please sign in to comment.