Skip to content

Using typing-extensions 4 with web3.py and python < 3.8 #2216

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

Closed
LefterisJP opened this issue Nov 20, 2021 · 5 comments · Fixed by #2217
Closed

Using typing-extensions 4 with web3.py and python < 3.8 #2216

LefterisJP opened this issue Nov 20, 2021 · 5 comments · Fixed by #2217

Comments

@LefterisJP
Copy link

Hey guys,

This is question on typing-extensions package. In setup.py

web3.py/setup.py

Lines 88 to 89 in 74fbcd1

# remove typing_extensions after python_requires>=3.8, see web3._utils.compat
"typing-extensions>=3.7.4.1,<4;python_version<'3.8'",

you require <4 and python <3.8. From what I understand that is since these extensions you use have made it into stdlib's typing module from 3.8 and on.

But from what I see this requirement creates a probem for projects like ours which are still in python 3.7, use web3.py and want to use typing-extensions 4. Is there any reason for the < 4 requirement?

@kclowes
Copy link
Collaborator

kclowes commented Nov 20, 2021

I put up a PR to see what would happen if we bump it, and it looks like we have some dependency resolution errors if we use >=4.0.0 (see this CI run), but those aren't insurmountable. On quick glance, it doesn't look like anything would break from our end if we bump to v4+ once we figure out the dependency resolution. Out of curiosity, what feature is in typing-extensions v4 that you'd like to use?

@LefterisJP
Copy link
Author

I put up a PR to see what would happen if we bump it, and it looks like we have some dependency resolution errors if we use >=4.0.0 (see this CI run), but those aren't insurmountable. On quick glance, it doesn't look like anything would break from our end if we bump to v4+ once we figure out the dependency resolution. Out of curiosity, what feature is in typing-extensions v4 that you'd like to use?

Hey @kclowes thanks for the quick response.

The new additions in v4 are here: https://github.com/python/typing/blob/master/typing_extensions/CHANGELOG#L10-L13

I am most interested to try the TypedDict with certain fields marked as optional and certain as required: https://www.python.org/dev/peps/pep-0655/

@kclowes
Copy link
Collaborator

kclowes commented Nov 22, 2021

The new additions in v4 are here: https://github.com/python/typing/blob/master/typing_extensions/CHANGELOG#L10-L13

Ah, thanks! I don't see that we're using any of the features that were dropped, so I think we're safe to bump. Will put this in our backlog.

@LefterisJP
Copy link
Author

Just bumping this one since I saw a new release and it's not yet fixed. Should not be hard to adjust the dependency.

@LefterisJP
Copy link
Author

Thank you!

LefterisJP added a commit to LefterisJP/rotkehlchen that referenced this issue Feb 4, 2022
Also thanks to ethereum/web3.py#2216 being
fixed we can finally use the new typing extensions ... even though
we also just updated to python 3.9 and we probably no longer ... need them?
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 a pull request may close this issue.

2 participants