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

➕ Add Python 3.10 support #2175

Merged
merged 15 commits into from
Feb 14, 2022
Merged

Conversation

wiseaidev
Copy link
Contributor

@wiseaidev wiseaidev commented Oct 7, 2021

Signed-off-by: Harmouch101 [email protected]

What was wrong?

Related to Issue #2172

How was it fixed?

Todo:

Cute Animal Picture

🐶

@wiseaidev wiseaidev force-pushed the add-py3.10-to-ci branch 2 times, most recently from 24e6492 to a03b7f8 Compare October 7, 2021 18:20
.circleci/config.yml Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
This was referenced Oct 8, 2021
@fselmo fselmo changed the title ➕ Add Python 3.10 support to CI ➕ Add Python 3.10 support Oct 8, 2021
@fselmo
Copy link
Collaborator

fselmo commented Oct 8, 2021

@Harmouch101 thanks for getting this started! I linked some issues that are relevant here, notably updating websockets version to 10.0

@wiseaidev
Copy link
Contributor Author

I don't see black2b-py being mentioned in setup.py, so how this error is even possible:

ERROR: Could not find a version that satisfies the requirement blake2b-py<0.2,>=0.1.4 (from py-evm) (from versions: 0.1.2, 0.1.3)

Presumably, somehow another package in setup.py depends on it? is it py-evm?

@fselmo
Copy link
Collaborator

fselmo commented Oct 8, 2021

I don't see black2b-py being mentioned in setup.py, so how this error is even possible:

ERROR: Could not find a version that satisfies the requirement blake2b-py<0.2,>=0.1.4 (from py-evm) (from versions: 0.1.2, 0.1.3)

Presumably, somehow another package in setup.py depends on it? is it py-evm?

It is on py-evm. However, a new version of py-evm was just released where blake2b-py is an extra dependency and not always required. I'm actually working on getting eth-tester up to date so this can be updated in web3.py as well. It shouldn't have this issue after that.

@wiseaidev
Copy link
Contributor Author

Yeah, I see.

@wiseaidev
Copy link
Contributor Author

Someone take the wheel and spread some magic on this.

@akcelero
Copy link

@Harmouch101 not sure if it changes anything but in your CI config you is python:3.10.0rc2, although there is already final version 3.10.0

@wiseaidev
Copy link
Contributor Author

@Harmouch101 not sure if it changes anything but in your CI config you is python:3.10.0rc2, although there is already final version 3.10.0

Going through the list of available python images on the official cicleci registry and on this github repo, i didn't find any stable release for python 3.10, I mean not alpha releases. That's the reason why I chose this variant of python 3.10. On the other hand, the version that you have mentioned is available not on the cicleci registry, but rather on a registry called cimg. Not sure if it is official or not. However, @fselmo already pushed a commit for this matter. But, I think the errors are not related to the python images being used.

@fselmo
Copy link
Collaborator

fselmo commented Oct 17, 2021

However, @fselmo already pushed a commit for this matter. But, I think the errors are not related to the python images being used.

Yeah sorry for the lack of context there... I pushed a commit just to check what the outcome would be with the cimg builds but it wasn't immediately obvious why it failed and I didn't have enough time to debug so I put things back for now. Haven't looked into the errors that came out of that too closely but it does look like they are official circleci "convenience" images. I wouldn't mind investigating that within this PR but only if it makes sense to. I should have more time to dive back in here soon.

@akcelero
Copy link

@Harmouch101 ok, I see, sorry and thanks for reply ; )

@ian-whitestone
Copy link

FYI i tried installing web3 on Python 3.10 for the first time today (not knowing what Python versions were supported) and got this error:

❯ python
Python 3.10.0 (default, Dec 19 2021, 22:01:54) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import web3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ianwhitestone/Library/Caches/pypoetry/virtualenvs/ethereum-etl-I6y7u93w-py3.10/lib/python3.10/site-packages/web3/__init__.py", line 7, in <module>
    from eth_account import Account  # noqa: E402
  File "/Users/ianwhitestone/Library/Caches/pypoetry/virtualenvs/ethereum-etl-I6y7u93w-py3.10/lib/python3.10/site-packages/eth_account/__init__.py", line 1, in <module>
    from eth_account.account import Account  # noqa: F401
  File "/Users/ianwhitestone/Library/Caches/pypoetry/virtualenvs/ethereum-etl-I6y7u93w-py3.10/lib/python3.10/site-packages/eth_account/account.py", line 1, in <module>
    from collections import (
ImportError: cannot import name 'Mapping' from 'collections' (/Users/ianwhitestone/.pyenv/versions/3.10.0/lib/python3.10/collections/__init__.py)

@pacrob pacrob mentioned this pull request Dec 28, 2021
@LeaveMyYard
Copy link

FYI i tried installing web3 on Python 3.10 for the first time today (not knowing what Python versions were supported) and got this error:

❯ python
Python 3.10.0 (default, Dec 19 2021, 22:01:54) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import web3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ianwhitestone/Library/Caches/pypoetry/virtualenvs/ethereum-etl-I6y7u93w-py3.10/lib/python3.10/site-packages/web3/__init__.py", line 7, in <module>
    from eth_account import Account  # noqa: E402
  File "/Users/ianwhitestone/Library/Caches/pypoetry/virtualenvs/ethereum-etl-I6y7u93w-py3.10/lib/python3.10/site-packages/eth_account/__init__.py", line 1, in <module>
    from eth_account.account import Account  # noqa: F401
  File "/Users/ianwhitestone/Library/Caches/pypoetry/virtualenvs/ethereum-etl-I6y7u93w-py3.10/lib/python3.10/site-packages/eth_account/account.py", line 1, in <module>
    from collections import (
ImportError: cannot import name 'Mapping' from 'collections' (/Users/ianwhitestone/.pyenv/versions/3.10.0/lib/python3.10/collections/__init__.py)

As a temporary fix you can try some monkey patch like this:

import collections
from collections.abc import Mapping, MutableMapping, Sequence, Iterable, Hashable, Generator


for patch_item in [Mapping, MutableMapping, Sequence, Iterable, Hashable, Generator]:
    setattr(collections, patch_item.__name__, patch_item)

At least it fixes an ImportError

@kclowes
Copy link
Collaborator

kclowes commented Feb 11, 2022

@pacrob or @fselmo - do one of you mind taking another look? Thanks for getting this going @Harmouch101!

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.

Just a couple of the circleci jobs are on the config twice but otherwise this looks good to me! Thanks @Harmouch101 and thanks @kclowes 👍 🎉

@@ -462,3 +528,12 @@ workflows:
- py39-integration-goethereum-ws
- py39-integration-ethtester-pyevm
- py39-wheel-cli
- py310-integration-ethtester-pyevm
Copy link
Collaborator

Choose a reason for hiding this comment

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

looks like py310-integration-ethtester-pyevm and py310-wheel-cli are on here twice

@kclowes kclowes merged commit 16aff7e into ethereum:master Feb 14, 2022
dsahdr added a commit to Rock-n-Block/web3.py that referenced this pull request Feb 15, 2022
* move default_account and default_block properties and setters to BaseEth so Eth and AsyncEth can access

* Feature/ens request (ethereum#2319)

* fixed ens contract function called twice

* newsfragment

* small typo in documentation

* add newsfragment

* Only apply ``to_hexbytes`` formatter if value is not null

* asyncify eth.get_logs (ethereum#2310)

* asyncify eth.get_logs

* factor out `assert_contains_log` function

Co-authored-by: Paul Robinson <[email protected]>

* Add Github link to the main doc landing

Because Github link is extremely useful

* Newsfragment for github link to docs

* Update typing extensions to allow v4 (ethereum#2217)

* Update typing extensions to allow v4

* Loosen typing-extensions version

* Add newsfragment for typing-extensions bump

* Try out new py-evm requirements in eth-tester

* Remove xfails for newly passing eth-tester tests

* Upgrade eth-account requirement

* Add newsfragment for eth-tester bump

* correct misspellings and update referenced geth version

* Compile release notes

* Bump version: 5.26.0 → 5.27.0

* Add Async Geth Personal module (ethereum#2299)

* fix: Missing commas (ethereum#2327)

* fix: Missing commas

* Add newsfragment for exception retry middleware whitelist

Co-authored-by: kclowes <[email protected]>

* Fixes ethereum#2259, remove dependency on eth_maxPriorityFeePerGas

* fix lint and integration tests

* refactor: utility for estimating maxPriorityFeePerGas via eth_feeHistory

Refactor idea from PR ethereum#2259 into sync and async fee utility methods. Change params passed into eth_feeHistory to values that allowed for better results when we tested locally. Add a min and max to the estimated fee history so that we don't allow unsuspecting users to contribute to fee bloating. Max and min values keep the priority fee within a range that healthy blocks should accept, so these transactions would be accepted when fee prices settle from high-fee periods.

* add tests for max_priority_fee when eth_maxPriorityFeePerGas is not available

* asyncify eth.syncing

* formatting and validation middleware async support

* Properly test unused code in test

* Align NamedTuples (ethereum#2312)

* Align NamedTuples

* Add NamedTuple alignment test.

* Add newsfragment for NamedTuple change

Co-authored-by: kclowes <[email protected]>

* rm ens.utils.dict_copy

Signed-off-by: Harmouch101 <[email protected]>

* fixed lint error

Signed-off-by: Harmouch101 <[email protected]>

* Update main.py

* add newsfragment

* Feature/async geth admin (ethereum#2329)

* Added BaseGethPersonal to geth.py

* Added AsyncGethPersonal and test

* Added Docs

* lint fixes

* news fragment update

* removed import_raw_key test for now

* mypy typing issues

* typo

* Added AsyncGethAdmin and BaseGethAdmin. Also, fixed test due to typing

* made suggested changes

* made suggested changes

* fixed spelling errors

* added test and docs

* newsfragment

* merge conflict

* remove setSolc

* copy in suggested test

* forgot to check liniting before commit

* linting

* linting

* Properly initialize external modules

Properly initialize modules that do not inherit from the `web3.module.Module` class. We weren't properly testing self-referential, non-static methods with this functionality and so a test was also added for this.

* correct docs for external modules

* Refactor attach_module logic

* Allow for accepting the ``Web3`` instance as the first argument in any module's ``__init()`` method, rather than requiring a module to inherit from ``web3.module.Module`` if it needs to make use of the ``Web3`` instance.

* Update tests to test the above change.

* Add a more friendly error message if the module has more than one __init__() argument. Add test for this error message / case.

* recorrect docs for external modules

* Compile release notes

* Bump version: 5.27.0 → 5.28.0

* Add 'Breaking Changes' and 'Deprecation' to our valid newsfragment types (ethereum#2340)

* Add 'Breaking Change' and 'Deprecation' to our valid newsfragment types

* Add newsfragment for new newsfragment categories

* Remove removal section of release notes

* Drop python 3.6 (ethereum#2343)

* Drop python 3.6

* Remove parity tests

* Add newsfragment for py36 drop

* Fix gas types (ethereum#2330)

* fix: correct type for effectiveGasPrice (Wei, not int)

* fix: correct type for gas and gas_limit (int, not Wei)

* lint: removed unused type imports of Wei

* Add newsfragment for Wei/int typing fixes

Co-authored-by: kclowes <[email protected]>

* Upgrade websockets dependency to v10+ (ethereum#2324)

* Require websockets v10+

- Remove event loop parameter

* Add newsfragment for websockets upgrade

* ➕ Add Python 3.10 support (ethereum#2175)

* ➕ Add Python 3.10 support to CI

* Dropped support for all parities

* Change docker image to use 3.10

* Update pytest-asyncio plugin

* Mark async fixture as such, clean up pytest DeprecationWarnings

Signed-off-by: Harmouch101 <[email protected]>

Co-authored-by: Felipe Selmo <[email protected]>
Co-authored-by: kclowes <[email protected]>

* add fork description

* [NBA-39] add multiple nodes for web3 HTTPProvider (#1)

* Update README.md

* Update README.md

* Update README.md

* typo fix

Co-authored-by: pacrob <[email protected]>
Co-authored-by: AlwaysData <[email protected]>
Co-authored-by: alex <[email protected]>
Co-authored-by: Felipe Selmo <[email protected]>
Co-authored-by: DefiDebauchery <[email protected]>
Co-authored-by: Mikko Ohtamaa <[email protected]>
Co-authored-by: kclowes <[email protected]>
Co-authored-by: Marek Šuppa <[email protected]>
Co-authored-by: broper2 <[email protected]>
Co-authored-by: Călina Cenan <[email protected]>
Co-authored-by: Harmouch101 <[email protected]>
Co-authored-by: Marc Garreau <[email protected]>
Co-authored-by: coccoinomane <[email protected]>
wiseaidev added a commit to wiseaidev/web3.py that referenced this pull request Feb 28, 2022
* ➕ Add Python 3.10 support to CI

* Dropped support for all parities

* Change docker image to use 3.10

* Update pytest-asyncio plugin

* Mark async fixture as such, clean up pytest DeprecationWarnings

Signed-off-by: Harmouch101 <[email protected]>

Co-authored-by: Felipe Selmo <[email protected]>
Co-authored-by: kclowes <[email protected]>
Signed-off-by: Harmouch101 <[email protected]>
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.

6 participants