Skip to content

Commit 3907e17

Browse files
committed
Support Python 3.11
1 parent e04acaf commit 3907e17

File tree

12 files changed

+170
-32
lines changed

12 files changed

+170
-32
lines changed

.circleci/config.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,103 @@ jobs:
615615
environment:
616616
TOXENV: py310-wheel-cli
617617

618+
#
619+
# Python 3.11
620+
#
621+
py311-core:
622+
<<: *common
623+
docker:
624+
- image: cimg/python:3.11
625+
environment:
626+
TOXENV: py311-core
627+
628+
py311-ens:
629+
<<: *common
630+
docker:
631+
- image: cimg/python:3.11
632+
environment:
633+
TOXENV: py311-ens
634+
635+
py311-ethpm:
636+
<<: *ethpm_steps
637+
docker:
638+
- image: cimg/python:3.11
639+
environment:
640+
TOXENV: py311-ethpm
641+
# Please don't use this key for any shenanigans
642+
WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22
643+
644+
py311-integration-goethereum-ipc:
645+
<<: *geth_steps
646+
docker:
647+
- image: cimg/python:3.11
648+
environment:
649+
TOXENV: py311-integration-goethereum-ipc
650+
GETH_VERSION: v1.10.25
651+
652+
py311-integration-goethereum-ipc_flaky:
653+
<<: *geth_steps
654+
docker:
655+
- image: cimg/python:3.11
656+
environment:
657+
TOXENV: py311-integration-goethereum-ipc_flaky
658+
GETH_VERSION: v1.10.25
659+
660+
py311-integration-goethereum-http:
661+
<<: *geth_steps
662+
docker:
663+
- image: cimg/python:3.11
664+
environment:
665+
TOXENV: py311-integration-goethereum-http
666+
GETH_VERSION: v1.10.25
667+
668+
py311-integration-goethereum-http_async:
669+
<<: *geth_steps
670+
docker:
671+
- image: cimg/python:3.11
672+
environment:
673+
TOXENV: py311-integration-goethereum-http_async
674+
GETH_VERSION: v1.10.25
675+
676+
py311-integration-goethereum-http_flaky:
677+
<<: *geth_steps
678+
docker:
679+
- image: cimg/python:3.11
680+
environment:
681+
TOXENV: py311-integration-goethereum-http_flaky
682+
GETH_VERSION: v1.10.25
683+
684+
py311-integration-goethereum-ws:
685+
<<: *geth_steps
686+
docker:
687+
- image: cimg/python:3.11
688+
environment:
689+
TOXENV: py311-integration-goethereum-ws
690+
GETH_VERSION: v1.10.25
691+
692+
py311-integration-goethereum-ws_flaky:
693+
<<: *geth_steps
694+
docker:
695+
- image: cimg/python:3.11
696+
environment:
697+
TOXENV: py311-integration-goethereum-ws_flaky
698+
GETH_VERSION: v1.10.25
699+
700+
py311-integration-ethtester-pyevm:
701+
<<: *common
702+
docker:
703+
- image: cimg/python:3.11
704+
environment:
705+
TOXENV: py311-integration-ethtester
706+
ETHEREUM_TESTER_CHAIN_BACKEND: eth_tester.backends.PyEVMBackend
707+
708+
py311-wheel-cli:
709+
<<: *common
710+
docker:
711+
- image: cimg/python:3.11
712+
environment:
713+
TOXENV: py311-wheel-cli
714+
618715
benchmark:
619716
<<: *geth_steps
620717
docker:
@@ -632,6 +729,7 @@ workflows:
632729
- py38-core
633730
- py39-core
634731
- py310-core
732+
- py311-core
635733
- lint
636734
- docs
637735
- benchmark
@@ -680,3 +778,14 @@ workflows:
680778
- py310-integration-goethereum-ws_flaky
681779
- py310-integration-ethtester-pyevm
682780
- py310-wheel-cli
781+
- py311-ens
782+
- py311-ethpm
783+
- py311-integration-goethereum-ipc
784+
- py311-integration-goethereum-ipc_flaky
785+
- py311-integration-goethereum-http
786+
- py311-integration-goethereum-http_async
787+
- py311-integration-goethereum-http_flaky
788+
- py311-integration-goethereum-ws
789+
- py311-integration-goethereum-ws_flaky
790+
- py311-integration-ethtester-pyevm
791+
- py311-wheel-cli

ethpm/_utils/protobuf/ipfs_file_pb2.py

Lines changed: 14 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

newsfragments/2699.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Support Python 3.11

setup.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
extras_require = {
88
"tester": [
9-
"eth-tester[py-evm]==v0.7.0-b.1",
9+
"eth-tester[py-evm]==v0.8.0-b.3",
1010
"py-geth>=3.10.0",
1111
],
1212
"linter": [
@@ -80,11 +80,12 @@
8080
include_package_data=True,
8181
install_requires=[
8282
"aiohttp>=3.7.4.post0",
83-
"eth-abi>=3.0.0",
84-
"eth-account>=0.7.0",
85-
"eth-hash[pycryptodome]>=0.2.0",
83+
"eth-abi>=4.0.0-b.2",
84+
"parsimonious==0.9.0", # TODO - fix in eth-abi
85+
"eth-account>=0.8.0",
86+
"eth-hash[pycryptodome]>=0.5.1",
8687
"eth-typing>=3.0.0",
87-
"eth-utils>=2.0.0",
88+
"eth-utils>=2.1.0",
8889
"hexbytes>=0.1.0",
8990
"jsonschema>=4.0.0",
9091
"lru-dict>=1.1.6",
@@ -114,5 +115,6 @@
114115
"Programming Language :: Python :: 3.8",
115116
"Programming Language :: Python :: 3.9",
116117
"Programming Language :: Python :: 3.10",
118+
"Programming Language :: Python :: 3.11",
117119
],
118120
)

tests/core/middleware/test_eth_tester_middleware.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ def test_get_block_formatters(w3):
3232
latest_block_keys = set(latest_block.keys())
3333

3434
keys_diff = all_block_keys.difference(latest_block_keys)
35-
assert len(keys_diff) == 1
36-
assert keys_diff.pop() == "mixHash" # mixHash is not implemented in eth-tester
35+
assert len(keys_diff) == 2
36+
# mixHash and miner not implemented in eth-tester
37+
assert keys_diff == set(["mixHash", "miner"])
3738

3839

3940
@pytest.mark.parametrize(

tests/core/module-class/test_module.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def test_attach_methods_with_mungers(web3_with_external_modules):
8686
}
8787
)
8888

89+
w3.provider.ethereum_tester.mine_block()
8990
assert w3.eth.get_block(0, False)["baseFeePerGas"] == 1000000000
9091
assert w3.eth.get_block(1, False)["baseFeePerGas"] == 875000000
9192

tests/ens/test_get_text.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

3-
from eth_tester.exceptions import (
4-
TransactionFailed,
3+
from eth_utils.exceptions import (
4+
ValidationError,
55
)
66

77
from ens.exceptions import (
@@ -29,7 +29,7 @@ def test_set_text_fails_with_bad_address(ens):
2929
address = ens.w3.eth.accounts[2]
3030
ens.setup_address("tester.eth", address)
3131
zero_address = "0x" + "00" * 20
32-
with pytest.raises(TransactionFailed):
32+
with pytest.raises(ValidationError):
3333
ens.set_text(
3434
"tester.eth", "url", "http://example.com", transact={"from": zero_address}
3535
)
@@ -97,7 +97,7 @@ async def test_async_set_text_fails_with_bad_address(async_ens):
9797
address = accounts[2]
9898
await async_ens.setup_address("tester.eth", address)
9999
zero_address = "0x" + "00" * 20
100-
with pytest.raises(TransactionFailed):
100+
with pytest.raises(ValidationError):
101101
await async_ens.set_text(
102102
"tester.eth", "url", "http://example.com", transact={"from": zero_address}
103103
)

tests/integration/test_ethereum_tester.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,16 @@ def test_eth_send_transaction_no_gas(self, eth_tester, w3, unlocked_account):
568568
def test_eth_send_transaction_no_max_fee(self, eth_tester, w3, unlocked_account):
569569
super().test_eth_send_transaction_no_max_fee(w3, unlocked_account)
570570

571+
def test_eth_getBlockByNumber_safe(
572+
self, w3: "Web3", empty_block: BlockData
573+
) -> None:
574+
super().test_eth_getBlockByNumber_safe(w3, empty_block)
575+
576+
def test_eth_getBlockByNumber_finalized(
577+
self, w3: "Web3", empty_block: BlockData
578+
) -> None:
579+
super().test_eth_getBlockByNumber_finalized(w3, empty_block)
580+
571581

572582
class TestEthereumTesterNetModule(NetModuleTest):
573583
pass

tox.ini

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[tox]
22
envlist=
3-
py{37,38,39,310}-ens
4-
py{37,38,39,310}-ethpm
5-
py{37,38,39,310}-core
6-
py{37,38,39,310}-integration-{goethereum,ethtester}
3+
py{37,38,39,310,311}-ens
4+
py{37,38,39,310,311}-ethpm
5+
py{37,38,39,310,311}-core
6+
py{37,38,39,310,311}-integration-{goethereum,ethtester}
77
lint
88
docs
99
benchmark
10-
py{37,38,39,310}-wheel-cli
10+
py{37,38,39,310,311}-wheel-cli
1111

1212
[isort]
1313
combine_as_imports=True
@@ -28,7 +28,7 @@ extend-ignore=E203,W503
2828

2929
[testenv]
3030
allowlist_externals=/usr/bin/make
31-
install_command=python -m pip install --no-use-pep517 {opts} {packages}
31+
install_command=python -m pip install {opts} {packages}
3232
usedevelop=True
3333
commands=
3434
core: pytest {posargs:tests/core}
@@ -58,6 +58,7 @@ basepython =
5858
py38: python3.8
5959
py39: python3.9
6060
py310: python3.10
61+
py311: python3.11
6162

6263
[testenv:lint]
6364
basepython=python
@@ -111,6 +112,12 @@ allowlist_externals={[common-wheel-cli]allowlist_externals}
111112
commands={[common-wheel-cli]commands}
112113
skip_install=true
113114

115+
[testenv:py311-wheel-cli]
116+
deps={[common-wheel-cli]deps}
117+
allowlist_externals={[common-wheel-cli]allowlist_externals}
118+
commands={[common-wheel-cli]commands}
119+
skip_install=true
120+
114121
[common-wheel-cli-windows]
115122
deps=wheel
116123
allowlist_externals=

web3/_utils/method_formatters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def raise_contract_logic_error_on_revert(response: RPCResponse) -> RPCResponse:
629629
if data[:10] == "0x556f1830":
630630
parsed_data_as_bytes = to_bytes(hexstr=data[10:])
631631
abi_decoded_data = abi.decode(
632-
OFFCHAIN_LOOKUP_FIELDS.values(), parsed_data_as_bytes
632+
list(OFFCHAIN_LOOKUP_FIELDS.values()), parsed_data_as_bytes
633633
)
634634
offchain_lookup_payload = dict(
635635
zip(OFFCHAIN_LOOKUP_FIELDS.keys(), abi_decoded_data)

0 commit comments

Comments
 (0)