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

Bump flask from 2.1.3 to 2.2.1 #1616

Closed
wants to merge 1 commit into from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Aug 5, 2022

Bumps flask from 2.1.3 to 2.2.1.

Release notes

Sourced from flask's releases.

2.2.1

This is a fix release for the 2.2.0 feature release.

2.2.0

This is a feature release, which includes new features and removes previously deprecated code. The 2.2.x branch is now the supported bug fix branch, the 2.1.x branch will become a tag marking the end of support for that branch. We encourage everyone to upgrade, and to use a tool such as pip-tools to pin all dependencies and control upgrades.

Changelog

Sourced from flask's changelog.

Version 2.2.1

Released 2022-08-03

  • Setting or accessing json_encoder or json_decoder raises a deprecation warning. :issue:4732

Version 2.2.0

Released 2022-08-01

  • Remove previously deprecated code. :pr:4337

    • Old names for some send_file parameters have been removed. download_name replaces attachment_filename, max_age replaces cache_timeout, and etag replaces add_etags. Additionally, path replaces filename in send_from_directory.
    • The RequestContext.g property returning AppContext.g is removed.
  • Update Werkzeug dependency to >= 2.2.

  • The app and request contexts are managed using Python context vars directly rather than Werkzeug's LocalStack. This should result in better performance and memory use. :pr:4682

    • Extension maintainers, be aware that _app_ctx_stack.top and _request_ctx_stack.top are deprecated. Store data on g instead using a unique prefix, like g._extension_name_attr.
  • The FLASK_ENV environment variable and app.env attribute are deprecated, removing the distinction between development and debug mode. Debug mode should be controlled directly using the --debug option or app.run(debug=True). :issue:4714

  • Some attributes that proxied config keys on app are deprecated: session_cookie_name, send_file_max_age_default, use_x_sendfile, propagate_exceptions, and templates_auto_reload. Use the relevant config keys instead. :issue:4716

  • Add new customization points to the Flask app object for many previously global behaviors.

    • flask.url_for will call app.url_for. :issue:4568
    • flask.abort will call app.aborter. Flask.aborter_class and Flask.make_aborter can be used to customize this aborter. :issue:4567

... (truncated)

Commits
  • 85f79e1 Merge pull request #4736 from pallets/release-2.2.1
  • 52c54b2 release version 2.2.1
  • 0d87b22 update requirements
  • 723a3a6 Merge pull request #4735 from pallets/json_encoder-warning
  • 714ccef show deprecation warning on json_encoder/decoder access
  • 9a1b25f start version 2.2.1
  • b17bb9e Merge pull request #4710 from pallets/release-2.2.0
  • 292c7e5 release version 2.2.0
  • f3bb9b2 Merge branch '2.1.x'
  • ac1bb97 Merge pull request #4721 from pallets/pre-commit-ci-update-config
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [flask](https://github.com/pallets/flask) from 2.1.3 to 2.2.1.
- [Release notes](https://github.com/pallets/flask/releases)
- [Changelog](https://github.com/pallets/flask/blob/main/CHANGES.rst)
- [Commits](pallets/flask@2.1.3...2.2.1)

---
updated-dependencies:
- dependency-name: flask
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot added dependencies python Pull requests that update Python code labels Aug 5, 2022
@return42
Copy link
Member

return42 commented Aug 5, 2022

@dalf I am a little unsure: this release includes pallets/flask#4720 (see: pallets/flask#4714)

The FLASK_ENV environment variable and app.env attribute are deprecated, removing the distinction between development and debug mode. Debug mode should be controlled directly using the --debug option or app.run(debug=True)

In 6c39917 you added FLASK_APP (& FLASK_ENV), may you better know how to modify:

searxng/searx/webapp.py

Lines 1381 to 1390 in 225f8ca

# see https://flask.palletsprojects.com/en/1.1.x/cli/
# True if "FLASK_APP=searx/webapp.py FLASK_ENV=development flask run"
flask_run_development = (
os.environ.get("FLASK_APP") is not None and os.environ.get("FLASK_ENV") == 'development' and is_flask_run_cmdline()
)
# True if reload feature is activated of werkzeug, False otherwise (including uwsgi, etc..)
# __name__ != "__main__" if searx.webapp is imported (make test, make docs, uwsgi...)
# see run() at the end of this file : searx_debug activates the reload feature.
werkzeug_reloader = flask_run_development or (searx_debug and __name__ == "__main__")


In this context: do we need to support the flask command flask/cli.py?

searxng/searx/webutils.py

Lines 141 to 153 in cee5860

def is_flask_run_cmdline():
"""Check if the application was started using "flask run" command line
Inspect the callstack.
See https://github.com/pallets/flask/blob/master/src/flask/__main__.py
Returns:
bool: True if the application was started using "flask run".
"""
frames = inspect.stack()
if len(frames) < 2:
return False
return frames[-2].filename.endswith('flask/cli.py')

The common way we start the application on the command line is:

python -m searx.webapp

@dalf
Copy link
Member

dalf commented Aug 8, 2022

Thank you for point this out.
I've never used this feature, flask_run_development is here only because flask support it.
Since it is deprecated, we can safely remove it, so lines 1381 to 1390 becomes :

werkzeug_reloader = searx_debug and __name__ == "__main__")

and is_flask_run_cmdline can be removed.


It would good to test the plugins too:

self.request = request._get_current_object()

And regarding this and future release of Flask, see pallets/flask#4682

Currently we add attributes directly to the request object.

searxng/searx/webapp.py

Lines 196 to 205 in 925f3ff

class ExtendedRequest(flask.Request):
"""This class is never initialized and only used for type checking."""
preferences: Preferences
errors: List[str]
user_plugins: List[Plugin]
form: Dict[str, str]
start_time: float
render_time: float
timings: List[Timing]

We should use the g : https://flask.palletsprojects.com/en/2.2.x/api/?highlight=global%20context#application-globals

@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Aug 12, 2022

Superseded by #1656.

@dependabot dependabot bot closed this Aug 12, 2022
@dependabot dependabot bot deleted the dependabot/pip/master/flask-2.2.1 branch August 12, 2022 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants