Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.11 Support #2699

Merged
merged 2 commits into from
Dec 16, 2022
Merged

Python 3.11 Support #2699

merged 2 commits into from
Dec 16, 2022

Conversation

kclowes
Copy link
Collaborator

@kclowes kclowes commented Oct 28, 2022

What was wrong?

Needed to support Python 3.11.

How was it fixed?

Updated our upstream libraries, pulled them in here.

Todo:

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@kclowes kclowes changed the title Add tests for python 3.11 Python 3.11 Support Oct 28, 2022
@Uxio0
Copy link
Contributor

Uxio0 commented Oct 31, 2022

Just adding here this issue I found when compiling pysha3 for Python 3.11: tiran/pysha3#30 . It would be a shame to fallback to pycryptodome as pysha3 is way faster

@kclowes
Copy link
Collaborator Author

kclowes commented Nov 2, 2022

@Uxio0 that's a bummer that your issue got closed/that pysha3 is no longer maintained. I don't see keccak in the hashlib module either. @carver raised an issue in eth-hash to remove pysha3 from the backends.

@Uxio0
Copy link
Contributor

Uxio0 commented Nov 3, 2022

@kclowes I tested master branch for pysha3 and it works on Python 3.11. I can fork it and release a new version. Update: I cannot make it work again, working on it: https://github.com/5afe/pysha3/actions/runs/3387222972/jobs/5627671166

@Uxio0
Copy link
Contributor

Uxio0 commented Nov 3, 2022

Here it is: https://pypi.org/project/safe-pysha3/

@aliking7
Copy link

aliking7 commented Nov 5, 2022

Please check it out? what should i do now?
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from web3 import Web3
Traceback (most recent call last):
File "", line 1, in
File "C:\Python311\Lib\site-packages\web3_init_.py", line 6, in
from eth_account import (
File "C:\Python311\Lib\site-packages\eth_account_init_.py", line 1, in
from eth_account.account import (
File "C:\Python311\Lib\site-packages\eth_account\account.py", line 59, in
from eth_account.messages import (
File "C:\Python311\Lib\site-packages\eth_account\messages.py", line 26, in
from eth_account.utils.structured_data.hashing import (
File "C:\Python311\Lib\site-packages\eth_account_utils\structured_data\hashing.py", line 9, in
from eth_abi import (
File "C:\Python311\Lib\site-packages\eth_abi_init
.py", line 6, in
from eth_abi.abi import ( # NOQA
File "C:\Python311\Lib\site-packages\eth_abi\abi.py", line 1, in
from eth_abi.codec import (
File "C:\Python311\Lib\site-packages\eth_abi\codec.py", line 16, in
from eth_abi.decoding import (
File "C:\Python311\Lib\site-packages\eth_abi\decoding.py", line 14, in
from eth_abi.base import (
File "C:\Python311\Lib\site-packages\eth_abi\base.py", line 7, in
from .grammar import (
File "C:\Python311\Lib\site-packages\eth_abi\grammar.py", line 4, in
import parsimonious
File "C:\Python311\Lib\site-packages\parsimonious_init_.py", line 9, in
from parsimonious.grammar import Grammar, TokenGrammar
File "C:\Python311\Lib\site-packages\parsimonious\grammar.py", line 14, in
from parsimonious.expressions import (Literal, Regex, Sequence, OneOf,
File "C:\Python311\Lib\site-packages\parsimonious\expressions.py", line 9, in
from inspect import getargspec
ImportError: cannot import name 'getargspec' from 'inspect' (C:\Python311\Lib\inspect.py)

@0xChupaCabra
Copy link

@aliking7
as per parsimonious changelog:

0.9.0

    Add support for Python 3.7, 3.8, 3.9, 3.10 (righthandabacus, Lonnen)
    Drop support for Python 2.x, 3.3, 3.4 (righthandabacus, Lonnen)

https://github.com/erikrose/parsimonious

I guess currently web3.py uses 0.8.1

@charles-cooper
Copy link
Contributor

@kclowes i think eth-bloom is also pinning to an old version of eth-hash: https://github.com/ethereum/eth-bloom/blob/03378183fa3afefff0f366f1a8e9a31d56363b28/setup.py#L44

@charles-cooper
Copy link
Contributor

here's what happens when trying to install web3.py and eth-hash==0.5.1 at the same time:
image

@kclowes
Copy link
Collaborator Author

kclowes commented Nov 16, 2022

Yeah, we have to update our whole dependency stack. @fselmo was going to start looking into eth-bloom today.

Copy link
Collaborator

@fselmo fselmo left a comment

Choose a reason for hiding this comment

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

lgtm! Thanks! Just missing a newsfragment and adding 3.11 to the list here.

@kclowes kclowes marked this pull request as ready for review December 16, 2022 21:14
@kclowes kclowes merged commit 1abb144 into ethereum:master Dec 16, 2022
@kclowes kclowes deleted the py311-support branch December 16, 2022 21:35
@yabirgb
Copy link

yabirgb commented Dec 27, 2022

Thanks for the work in this PR! Is this going to ship in the 5.x.x versions?

@kclowes
Copy link
Collaborator Author

kclowes commented Jan 4, 2023

@yabirgb this will not ship in the 5.x versions because there were some breaking dependency changes.

@bh2smith
Copy link

bh2smith commented Jan 13, 2023

This is fantastic news. Has this new version been published to PyPi yet?

Never mind, I found a bunch of pre-releases here: https://pypi.org/project/web3/#history

Were you guys aware that there does not appear to be a direct link to the PyPi package page from this project README? Makes it a bit hard to find... Would anyone be opposed to me adding this to the README?

@bh2smith
Copy link

Not sure if some indirect requirement was changed, but I had to manually add a dependency to my project that was included in previous versions (namely ipfshttpclient)

# web3==5.31.3
# For Python 3.11 support. Waiting for official release.
# https://pypi.org/project/web3/#history
web3==6.0.0b9
# Python 3.11 seems to need this explicitly declared now for some reason.
ipfshttpclient==0.8.0a2

Here is a corresponding failing CI without the manually added additional dependency.

@kclowes
Copy link
Collaborator Author

kclowes commented Jan 13, 2023

Thank you for the report! Fix is at #2775. It should be released next week in v6b10.

Would anyone be opposed to me adding this to the README?

Not at all! Thank you!

@lamoboos223
Copy link

i still have the issue in python3.11

image

@kclowes
Copy link
Collaborator Author

kclowes commented Feb 15, 2023

@lamoboos223 thanks for the reminder. I just released v6.0.0-beta.10 that has the fix. If you upgrade and still see the problem, please open a new issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants