duo-labs / py_webauthn

Pythonic WebAuthn 🐍
https://duo-labs.github.io/py_webauthn
BSD 3-Clause "New" or "Revised" License
856 stars 171 forks source link

Failure with latest pydantic 2.0 release #156

Closed jwag956 closed 1 year ago

jwag956 commented 1 year ago

pydantic just released 2.0 - which seems to break webauthn:

could not import 'webauthn': cannot import name 'ModelField' from 'pydantic.fields'

MasterKale commented 1 year ago

Hello @jwag956, py_webauthn hasn't updated for Pydantic 2.0 so I'm not surprised. Can a project not use py_webauthn (using a version of Pydantic 1.x) with Pydantic 2.0 explicitly installed as a project dependency as well?

jwag956 commented 1 year ago

Your dependencies just list pydantic>1.9 - so it installed 2.0 and broke. You might need to change your dependency to <2.0 until you transition.

sevdog commented 1 year ago

Are there any plans to update to the latest version of pydantic (v2) in a next major release?

MasterKale commented 1 year ago

Your dependencies just list pydantic>1.9 - so it installed 2.0 and broke. You might need to change your dependency to <2.0 until you transition.

I want to do a quick sanity check here, it looks like I can update this line in setup.py to say this instead:

pydantic>=1.9.0,<2.0.0

...And that should buy me some time to get the library updated to support Pydantic 2.0? 🤔

Edit: According to SO it looks like I should use <2.0a0 instead https://stackoverflow.com/a/14405269/2133271

jwag956 commented 1 year ago

If you need >1.9 I would leave that in

As an aside - in general I have read and agree that putting upper limits on a package in a middleware package such as pywebauthn is discouraged since it might block entire application's from updating - on the other hand the current situation is that many applications will have to pin pedantic which they don't even depend on.

So yes - should buy time - and it will be interesting to see how quickly all the folks that use pydantic convert

MasterKale commented 1 year ago

@jwag956 I've published webauthn==1.9.0 that pins Pydantic to >=1.9.0,<2.0a0. Can you give it a shot and see if it solves this particular issue?

jwag956 commented 1 year ago

Yes - seems to work great - thanks again for the quick response!