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

Version 1.0.0 removed previously deprecated code #1714

Closed
evanlurvey opened this issue Feb 6, 2020 · 22 comments
Closed

Version 1.0.0 removed previously deprecated code #1714

evanlurvey opened this issue Feb 6, 2020 · 22 comments

Comments

@evanlurvey
Copy link

The 1.0.0 release that was pushed 2 hours ago published breaking changes for people using flask. Not sure if it was a desired effect and flask should pin their version or if changes in this project need to happen.

@ThiefMaster
Copy link
Member

Please post full tracebacks if you encounter any issues.

@davidism
Copy link
Member

davidism commented Feb 6, 2020

The issue is not with Flask, and Werkzeug will not continue supporting these deprecated imports. 0.16 has been issuing deprecation warnings for 5 months. Use that version as an intermediate step to identify what imports have changed.

You can help extensions and other projects by opening an issue or submitting a PR in the relevant project.

  • Flask-Admin 1.5.5
  • Flask-Babel 1.0
  • Flask-BabelEx 0.9.4
  • flask-restplus (not merged, unmaintained in favor of flask-restx)
  • flask-restx (merged, not released yet)
  • Flask-Testing 0.8.0
  • Flask-WTF 0.14.3
  • django-extensions 2.2.8
  • pytest-flask 0.15.1

@zoombear

This comment has been minimized.

@davidism

This comment has been minimized.

@seancannedham
Copy link

+1, having the following issue:

    from werkzeug import url_encode
ImportError: cannot import name 'url_encode'```

@yilunc

This comment has been minimized.

@pallets pallets locked as resolved and limited conversation to collaborators Feb 6, 2020
@pallets pallets unlocked this conversation Feb 6, 2020
@tjohnson4

This comment has been minimized.

@davidism

This comment has been minimized.

@mitsuhiko
Copy link
Contributor

mitsuhiko commented Feb 7, 2020

This is a completely awful user experience. Flask-WTF 0.14.3 with the fixes was released hours ago. How are we pushing out a release that removes support when massive parts of the ecosystem were not ready for this?

This is I believe the third time an update to one of the pallets libraries broke code I had running in less than six months.

@Abdelsalam-Abbas
Copy link

Abdelsalam-Abbas commented Feb 7, 2020

similar issue

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/swagger-codegen/samples/server/petstore/flaskConnexion/swagger_server/__main__.py", line 3, in <module>
    import connexion
  File "/home/ubuntu/.local/lib/python3.6/site-packages/connexion/__init__.py", line 3, in <module>
    from .apis import AbstractAPI  # NOQA
  File "/home/ubuntu/.local/lib/python3.6/site-packages/connexion/apis/__init__.py", line 1, in <module>
    from .abstract import AbstractAPI  # NOQA
  File "/home/ubuntu/.local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 14, in <module>
    from ..operation import Operation
  File "/home/ubuntu/.local/lib/python3.6/site-packages/connexion/operation.py", line 7, in <module>
    from .decorators import validation
  File "/home/ubuntu/.local/lib/python3.6/site-packages/connexion/decorators/validation.py", line 9, in <module>
    from werkzeug import FileStorage
ImportError: cannot import name 'FileStorage'

workaround
add werkzeug == 0.16.1 to requirements.txt solved it for me

@jugmac00
Copy link

jugmac00 commented Feb 7, 2020

@Abdelsalam-Abbas connexion fixed that import back in October 2019 - maybe you are running an old version?
https://github.com/zalando/connexion/releases/tag/2.4.0

@krsnv

This comment has been minimized.

@pymonger

This comment has been minimized.

@davidism davidism changed the title Version 1.0.0 Released breaking changes to PyPi Version 1.0.0 removed previously deprecated code Feb 7, 2020
@LucasLLC
Copy link

LucasLLC commented Feb 7, 2020

Would someone mind providing some insight into why my flask request object returned from werkzeug's LocalProxy is from a different version then what I have locally?

Since this release I'm getting this error:

    if current_app.config['JSONIFY_PRETTYPRINT_REGULAR'] and not request.is_xhr:
  File "/Users/lucas/Software/anaconda3/envs/pytest/lib/python3.6/site-packages/werkzeug/local.py", line 347, in __getattr__
    return getattr(self._get_current_object(), name)
AttributeError: 'Request' object has no attribute 'is_xhr'

is_xhr is a property that was removed in Flask 1.0, but locally I have 0.12.2 installed. Just to be clear, I'm posting this issue here because the bug is not in Flask, rather I'm just confused as to why/how LocalProxy is returning a newer version of this Flask app then I'm expecting.

@pgjones
Copy link
Member

pgjones commented Feb 9, 2020

@LucasLLC is_xhr was never directly part of Flask (is there a reference that states it was removed in Flask 1.0? I can't see it in the changelog) rather it has always been a Werkzeug API that Flask exposes. In terms of Werkzeug you can see it is removed in 81e10ef.

If you aren't already I'd recommend pinning your dependencies and periodically upgrading, a chore that is made easy by tools such as poetry.

@mitsuhiko
Copy link
Contributor

@pgjones ideally we do a bugfix release of flask 0.12 which pins werkzeug to < 1.0.0. This is afterall a bad pin in Flask.

@mitsuhiko
Copy link
Contributor

Also yes, this API is effectively Flask API and it was documented as such: https://flask.palletsprojects.com/en/0.12.x/api/#flask.Request.is_xhr

@LucasLLC
Copy link

@LucasLLC is_xhr was never directly part of Flask (is there a reference that states it was removed in Flask 1.0? I can't see it in the changelog) rather it has always been a Werkzeug API that Flask exposes. In terms of Werkzeug you can see it is removed in 81e10ef.

Ah, my mistake. I was referencing the warning generated in this method, and didn't realize it was coming from Werkzeug, that makes a lot more sense.

If you aren't already I'd recommend pinning your dependencies and periodically upgrading, a chore that is made easy by tools such as poetry.

Thanks for the tip! We'll look into poetry.

@swastik1990

This comment has been minimized.

@luhexcp

This comment has been minimized.

@drov0

This comment has been minimized.

@mrpiccirilli

This comment has been minimized.

@pallets pallets locked and limited conversation to collaborators Feb 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests