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

Support Werkzeug 3.0 #573

Open
funsim opened this issue Oct 5, 2023 · 5 comments
Open

Support Werkzeug 3.0 #573

funsim opened this issue Oct 5, 2023 · 5 comments

Comments

@funsim
Copy link

funsim commented Oct 5, 2023

from werkzeug import __version__ as werkzeug_version
if werkzeug_version.split(".")[0] >= "2":
from werkzeug.wrappers import Response as BaseResponse
else:
from werkzeug.wrappers import BaseResponse

Should be replaced with

from importlib.metadata import version
  
if version("werkzeug").split(".")[0] >= "2": 
    from werkzeug.wrappers import Response as BaseResponse 
else: 
    from werkzeug.wrappers import BaseResponse 
@funsim funsim changed the title DeprecationWarning: The '__version__' attribute is deprecated and will be removed in Werkzeug 3.1. Use feature detection or 'importlib.metadata.version("werkzeug")' instead Support Werkzeug 3.0 Oct 5, 2023
@peter-doggart
Copy link
Contributor

Good spot, will make sure this gets updated along with the flask 3.0 support things.

@Ryu-CZ
Copy link
Contributor

Ryu-CZ commented Oct 6, 2023

Switch to importlib #562 is related to this issue. I will check project for other usages of __version__.

For @funsim: flask-restx dropped support of 3.7 python which could cause conflict of package versioning so please check your python version also. But I think werkzeug dropped 3.7 python support too.

Ryu-CZ pushed a commit to Ryu-CZ/flask-restx that referenced this issue Oct 6, 2023
Ryu-CZ pushed a commit to Ryu-CZ/flask-restx that referenced this issue Oct 6, 2023
Ryu-CZ pushed a commit to Ryu-CZ/flask-restx that referenced this issue Oct 25, 2023
@emily-coffin
Copy link

Is there any update on this?

peter-doggart added a commit that referenced this issue Dec 10, 2023
…rtlib (#573) (#575)

* fix: BaseResponse import - replace wekzeug old style import dunder version by importlib (#573)

* add: import_werkzeug_response test

* modify: changelog - note fix (#573)

---------

Co-authored-by: Tomáš Trval <trval@kajot.cz>
Co-authored-by: Peter Doggart <10991724+peter-doggart@users.noreply.github.com>
@peter-doggart
Copy link
Contributor

@funsim @emily-coffin This should be fixed on v1.3.0 which was released today. Please let me know if it is not. :)

@seanieb
Copy link
Contributor

seanieb commented Dec 10, 2023

Thanks for your work here Peter. It's much appreciated.

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

No branches or pull requests

5 participants