Skip to content
Myr

Merge branch '2.0.x'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parents bc094db, d6496c8 · Browse files · 23 files+221 added−180 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

23 files+221 added−180 removed

  • tests:+16 added−4 removed
  • other:+205 added−176 removed

23 files+221 added−180 removed

modified:.github/workflows/tests.yaml+2 added-8 removed
modified:.github/dependabot.yml-10 removed
modified:docs/patterns/appfactories.rst+14 added
96 unmodified lines
9798 $ export FLASK_APP=myapp99 $ flask run100101 .. group-tab:: Fish102103 .. code-block:: text104105 $ set -x FLASK_APP myapp106 $ flask run107108 .. group-tab:: CMD109110 .. code-block:: text111
18 unmodified lines
130131 $ export FLASK_APP="myapp:create_app('dev')"132 $ flask run133134 .. group-tab:: Fish135136 .. code-block:: text137138 $ set -x FLASK_APP "myapp:create_app('dev')"139 $ flask run140141 .. group-tab:: CMD142143 .. code-block:: text144
25 unmodified lines
modified:docs/patterns/packages.rst+12 added
65 unmodified lines
66 .. code-block:: text6768 $ export FLASK_APP=yourapplication6970 .. group-tab:: Fish7172 .. code-block:: text7374 $ set -x FLASK_APP yourapplication7576 .. group-tab:: CMD7778 .. code-block:: text79
16 unmodified lines
96 .. code-block:: text9798 $ export FLASK_ENV=development99100 .. group-tab:: Fish101102 .. code-block:: text103104 $ set -x FLASK_ENV development105106 .. group-tab:: CMD107108 .. code-block:: text109
78 unmodified lines
modified:docs/tutorial/deploy.rst+7 added
55 unmodified lines
5657 $ export FLASK_APP=flaskr58 $ flask init-db5960 .. group-tab:: Fish6162 .. code-block:: text6364 $ set -x FLASK_APP flaskr65 $ flask init-db6667 .. group-tab:: CMD6869 .. code-block:: text70
76 unmodified lines
modified:docs/tutorial/factory.rst+8 added
143 unmodified lines
144 $ export FLASK_APP=flaskr145 $ export FLASK_ENV=development146 $ flask run147148 .. group-tab:: Fish149150 .. code-block:: text151152 $ set -x FLASK_APP flaskr153 $ set -x FLASK_ENV development154 $ flask run155156 .. group-tab:: CMD157158 .. code-block:: text159
34 unmodified lines
modified:docs/cli.rst+53 added
25 unmodified lines
2627 $ export FLASK_APP=hello28 $ flask run2930 .. group-tab:: Fish3132 .. code-block:: text3334 $ set -x FLASK_APP hello35 $ flask run3637 .. group-tab:: CMD3839 .. code-block:: text40
121 unmodified lines
162 * Restarting with inotify reloader163 * Debugger is active!164 * Debugger PIN: 223-456-919165166 .. group-tab:: Fish167168 .. code-block:: text169170 $ set -x FLASK_ENV development171 $ flask run172 * Serving Flask app "hello"173 * Environment: development174 * Debug mode: on175 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)176 * Restarting with inotify reloader177 * Debugger is active!178 * Debugger PIN: 223-456-919179180 .. group-tab:: CMD181182 .. code-block:: text183
43 unmodified lines
227 $ flask run228 * Running on http://127.0.0.1:8000/229 * Detected change in '/path/to/file1', reloading230231 .. group-tab:: Fish232233 .. code-block:: text234235 $ flask run --extra-files file1:dirA/file2:dirB/236 # or237 $ set -x FLASK_RUN_EXTRA_FILES file1 dirA/file2 dirB/238 $ flask run239 * Running on http://127.0.0.1:8000/240 * Detected change in '/path/to/file1', reloading241242 .. group-tab:: CMD243244 .. code-block:: text245
72 unmodified lines
318 $ export FLASK_RUN_PORT=8000319 $ flask run320 * Running on http://127.0.0.1:8000/321322 .. group-tab:: Fish323324 .. code-block:: text325326 $ set -x FLASK_RUN_PORT 8000327 $ flask run328 * Running on http://127.0.0.1:8000/329330 .. group-tab:: CMD331332 .. code-block:: text333
39 unmodified lines
373374 $ export FLASK_SKIP_DOTENV=1375 $ flask run376377 .. group-tab:: Fish378379 .. code-block:: text380381 $ set -x FLASK_SKIP_DOTENV 1382 $ flask run383384 .. group-tab:: CMD385386 .. code-block:: text387
22 unmodified lines
410 Unix Bash, :file:`venv/bin/activate`::411412 $ export FLASK_APP=hello413414 .. group-tab:: Fish415416 Fish, :file:`venv/bin/activate.fish`::417418 $ set -x FLASK_APP hello419420 .. group-tab:: CMD421422 Windows CMD, :file:`venv\\Scripts\\activate.bat`::423
288 unmodified lines
modified:docs/config.rst+24 added
74 unmodified lines
7576 $ export FLASK_ENV=development77 $ flask run7879 .. group-tab:: Fish8081 .. code-block:: text8283 $ set -x FLASK_ENV development84 $ flask run8586 .. group-tab:: CMD8788 .. code-block:: text89
361 unmodified lines
451 $ export YOURAPPLICATION_SETTINGS=/path/to/settings.cfg452 $ flask run453 * Running on http://127.0.0.1:5000/454455 .. group-tab:: Fish456457 .. code-block:: text458459 $ set -x YOURAPPLICATION_SETTINGS /path/to/settings.cfg460 $ flask run461 * Running on http://127.0.0.1:5000/462463 .. group-tab:: CMD464465 .. code-block:: text466
64 unmodified lines
531 $ export MAIL_ENABLED=false532 $ flask run533 * Running on http://127.0.0.1:5000/534535 .. group-tab:: Fish536537 .. code-block:: text538539 $ set -x SECRET_KEY "5f352379324c22463451387a0aec5d2f"540 $ set -x MAIL_ENABLED false541 $ flask run542 * Running on http://127.0.0.1:5000/543544 .. group-tab:: CMD545546 .. code-block:: text547
245 unmodified lines
modified:docs/debugging.rst+14 added
51 unmodified lines
5253 $ export FLASK_ENV=development54 $ flask run5556 .. group-tab:: Fish5758 .. code-block:: text5960 $ set -x FLASK_ENV development61 $ flask run6263 .. group-tab:: CMD6465 .. code-block:: text66
45 unmodified lines
112113 $ export FLASK_ENV=development114 $ flask run --no-debugger --no-reload115116 .. group-tab:: Fish117118 .. code-block:: text119120 $ set -x FLASK_ENV development121 $ flask run --no-debugger --no-reload122123 .. group-tab:: CMD124125 .. code-block:: text126
21 unmodified lines
modified:docs/quickstart.rst+15 added
52 unmodified lines
53 $ export FLASK_APP=hello54 $ flask run55 * Running on http://127.0.0.1:5000/5657 .. group-tab:: Fish5859 .. code-block:: text6061 $ set -x FLASK_APP hello62 $ flask run63 * Running on http://127.0.0.1:5000/6465 .. group-tab:: CMD6667 .. code-block:: text68
104 unmodified lines
173174 $ export FLASK_ENV=development175 $ flask run176177 .. group-tab:: Fish178179 .. code-block:: text180181 $ set -x FLASK_ENV development182 $ flask run183184 .. group-tab:: CMD185186 .. code-block:: text187
771 unmodified lines
modified:docs/security.rst-12 removed
171 unmodified lines
172 response.headers['X-Frame-Options'] = 'SAMEORIGIN'173174- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options175176X-XSS-Protection177~~~~~~~~~~~~~~~~178179The browser will try to prevent reflected XSS attacks by not loading the page180if the request contains something that looks like JavaScript and the response181contains the same data. ::182183 response.headers['X-XSS-Protection'] = '1; mode=block'184185- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection186187176.. _security-cookie:177178Set-Cookie options179~~~~~~~~~~~~~~~~~~
95 unmodified lines
modified:docs/server.rst+8 added
31 unmodified lines
32 $ export FLASK_APP=hello33 $ export FLASK_ENV=development34 $ flask run3536 .. group-tab:: Fish3738 .. code-block:: text3940 $ set -x FLASK_APP hello41 $ export FLASK_ENV=development42 $ flask run4344 .. group-tab:: CMD4546 .. code-block:: text47
118 unmodified lines
modified:requirements/dev.in+1 added-1 removed
1-r docs.in2-r tests.in3-r typing.in4pip-tools4pip-compile-multi5pre-commit6tox
modified:requirements/dev.txt+17 added-121 removed
1# SHA1:54b5b77ec8c7a0064ffa93b2fd16cb0130ba177c2#2# This file is autogenerated by pip-compile with python 3.103# This file is autogenerated by pip-compile-multi4# To update, run:5#5# pip-compile requirements/dev.in6# pip-compile-multi7#7alabaster==0.7.128 # via sphinx9asgiref==3.4.110 # via -r requirements/tests.in11attrs==21.4.012 # via pytest13babel==2.9.114 # via sphinx15blinker==1.416 # via -r requirements/tests.in17certifi==2021.10.818 # via requests19cffi==1.15.020 # via cryptography8-r docs.txt9-r tests.txt10-r typing.txt11cfgv==3.3.112 # via pre-commit23charset-normalizer==2.0.1024 # via requests13click==8.0.326 # via pip-tools27cryptography==36.0.128 # via -r requirements/typing.in14 # via15 # pip-compile-multi16 # pip-tools17distlib==0.3.418 # via virtualenv31docutils==0.1632 # via33 # sphinx34 # sphinx-tabs19filelock==3.4.220 # via21 # tox22 # virtualenv23greenlet==1.1.2 ; python_version < "3.11"24 # via -r requirements/tests.in41identify==2.4.325identify==2.4.826 # via pre-commit43idna==3.344 # via requests45imagesize==1.3.046 # via sphinx47iniconfig==1.1.148 # via pytest49jinja2==3.0.350 # via sphinx51markupsafe==2.0.152 # via jinja253mypy==0.93154 # via -r requirements/typing.in55mypy-extensions==0.4.356 # via mypy27nodeenv==1.6.028 # via pre-commit59packaging==21.360 # via61 # pallets-sphinx-themes62 # pytest63 # sphinx64 # tox65pallets-sphinx-themes==2.0.266 # via -r requirements/docs.in29pep517==0.12.030 # via pip-tools69pip-tools==6.4.031pip-compile-multi==2.4.332 # via -r requirements/dev.in33pip-tools==6.5.134 # via pip-compile-multi35platformdirs==2.4.136 # via virtualenv73pluggy==1.0.074 # via75 # pytest76 # tox77pre-commit==2.16.037pre-commit==2.17.038 # via -r requirements/dev.in79py==1.11.080 # via81 # pytest82 # tox83pycparser==2.2184 # via cffi85pygments==2.11.286 # via87 # sphinx88 # sphinx-tabs89pyparsing==3.0.690 # via packaging91pytest==6.2.592 # via -r requirements/tests.in93python-dotenv==0.19.294 # via -r requirements/tests.in95pytz==2021.396 # via babel39pyyaml==6.040 # via pre-commit99requests==2.27.1100 # via sphinx41six==1.16.042 # via43 # tox44 # virtualenv105snowballstemmer==2.2.0106 # via sphinx107sphinx==4.3.2108 # via109 # -r requirements/docs.in110 # pallets-sphinx-themes111 # sphinx-issues112 # sphinx-tabs113 # sphinxcontrib-log-cabinet114sphinx-issues==3.0.1115 # via -r requirements/docs.in116sphinx-tabs==3.2.0117 # via -r requirements/docs.in118sphinxcontrib-applehelp==1.0.2119 # via sphinx120sphinxcontrib-devhelp==1.0.2121 # via sphinx122sphinxcontrib-htmlhelp==2.0.0123 # via sphinx124sphinxcontrib-jsmath==1.0.1125 # via sphinx126sphinxcontrib-log-cabinet==1.0.1127 # via -r requirements/docs.in128sphinxcontrib-qthelp==1.0.3129 # via sphinx130sphinxcontrib-serializinghtml==1.1.5131 # via sphinx132toml==0.10.2133 # via134 # pre-commit135 # pytest136 # tox137tomli==2.0.0138 # via139 # mypy140 # pep51745toposort==1.746 # via pip-compile-multi47tox==3.24.548 # via -r requirements/dev.in143types-contextvars==2.4.1144 # via -r requirements/typing.in145types-dataclasses==0.6.4146 # via -r requirements/typing.in147types-setuptools==57.4.7148 # via -r requirements/typing.in149typing-extensions==4.0.1150 # via mypy151urllib3==1.26.8152 # via requests153virtualenv==20.13.049virtualenv==20.13.150 # via51 # pre-commit52 # tox53wheel==0.37.1
5 unmodified lines
modified:requirements/docs.txt+6 added-8 removed
1# SHA1:34fd4ca6516e97c7348e6facdd9c4ebb68209d1c2#2# This file is autogenerated by pip-compile with python 3.103# This file is autogenerated by pip-compile-multi4# To update, run:5#5# pip-compile requirements/docs.in6# pip-compile-multi7#8alabaster==0.7.129 # via sphinx10babel==2.9.111 # via sphinx12certifi==2021.10.813 # via requests13charset-normalizer==2.0.1014charset-normalizer==2.0.1115 # via requests16docutils==0.1617 # via18 # sphinx
15 unmodified lines
34pygments==2.11.235 # via36 # sphinx37 # sphinx-tabs37pyparsing==3.0.638pyparsing==3.0.739 # via packaging40pytz==2021.341 # via babel42requests==2.27.143 # via sphinx44snowballstemmer==2.2.045 # via sphinx45sphinx==4.3.246sphinx==4.4.047 # via48 # -r requirements/docs.in49 # pallets-sphinx-themes50 # sphinx-issues
18 unmodified lines
69sphinxcontrib-serializinghtml==1.1.570 # via sphinx71urllib3==1.26.872 # via requests7273# The following packages are considered to be unsafe in a requirements file:74# setuptools
modified:requirements/tests-pallets-dev.txt+3 added-2 removed
1# SHA1:692b640e7f835e536628f76de0afff12965241222#2# This file is autogenerated by pip-compile with python 3.103# This file is autogenerated by pip-compile-multi4# To update, run:5#5# pip-compile requirements/tests-pallets-dev.in6# pip-compile-multi7#8click @ https://github.com/pallets/click/archive/refs/heads/main.tar.gz9 # via -r requirements/tests-pallets-dev.in10itsdangerous @ https://github.com/pallets/itsdangerous/archive/refs/heads/main.tar.gz
9 unmodified lines
modified:requirements/tests-pallets-min.txt+3 added-2 removed
1# SHA1:4de7d9e6254a945fd97ec10880dd23b6cd43b70d2#2# This file is autogenerated by pip-compile with python 3.103# This file is autogenerated by pip-compile-multi4# To update, run:5#5# pip-compile requirements/tests-pallets-min.in6# pip-compile-multi7#8click==8.0.09 # via -r requirements/tests-pallets-min.in10itsdangerous==2.0.0
9 unmodified lines
modified:requirements/tests.in+2 added-2 removed
1pytest2asgiref1pytest<72asgiref<3.53blinker4greenlet ; python_version < "3.11"5python-dotenv
modified:requirements/tests.txt+4 added-3 removed
1# SHA1:39a475af80093ba5deaee28d9ac0851afb91b6a92#2# This file is autogenerated by pip-compile with python 3.103# This file is autogenerated by pip-compile-multi4# To update, run:5#5# pip-compile requirements/tests.in6# pip-compile-multi7#8asgiref==3.4.19 # via -r requirements/tests.in10attrs==21.4.0
9 unmodified lines
20pluggy==1.0.021 # via pytest22py==1.11.023 # via pytest23pyparsing==3.0.624pyparsing==3.0.725 # via packaging26pytest==6.2.527 # via -r requirements/tests.in28python-dotenv==0.19.2
3 unmodified lines
modified:requirements/typing.txt+6 added-5 removed
1# SHA1:7cc3f64d4e78db89d81680ac81503d5ac35d31a92#2# This file is autogenerated by pip-compile with python 3.103# This file is autogenerated by pip-compile-multi4# To update, run:5#5# pip-compile requirements/typing.in6# pip-compile-multi7#8cffi==1.15.09 # via cryptography10cryptography==36.0.1
3 unmodified lines
14mypy-extensions==0.4.315 # via mypy16pycparser==2.2117 # via cffi17tomli==2.0.018tomli==2.0.119 # via mypy19types-contextvars==2.4.120types-contextvars==2.4.221 # via -r requirements/typing.in22types-dataclasses==0.6.423 # via -r requirements/typing.in23types-setuptools==57.4.724types-setuptools==57.4.925 # via -r requirements/typing.in26typing-extensions==4.0.127 # via mypy
modified:tests/test_basic.py+10 added-3 removed
1import gc2import re3import time4import uuid5import warnings6import weakref7from datetime import datetime8from platform import python_implementation9from threading import Thread
1515 unmodified lines
1525 app.config["SERVER_NAME"] = "dev.local"1526 rv = client.get("/", "https://dev.local")1527 assert rv.data == b"default"15281528 # suppress Werkzeug 1.0 warning about name mismatch1529 with pytest.warns(None):1529 # suppress Werkzeug 0.15 warning about name mismatch1530 with warnings.catch_warnings():1531 warnings.filterwarnings(1532 "ignore", "Current server name", UserWarning, "flask.app"1533 )1534 rv = client.get("/", "http://foo.localhost")1535 assert rv.status_code == 40415361537 rv = client.get("/", "http://foo.dev.local")
358 unmodified lines
1896 def index():1897 return "", 20418981899 # suppress Werkzeug 0.15 warning about name mismatch1896 with pytest.warns(None):1900 with warnings.catch_warnings():1901 warnings.filterwarnings(1902 "ignore", "Current server name", UserWarning, "flask.app"1903 )1904 # ip address can't match name1905 rv = client.get("/", "http://127.0.0.1:3000/")1906 assert rv.status_code == 404 if matching else 2041907
126 unmodified lines
modified:tests/test_reqctx.py+6 added-1 removed
1import warnings23import pytest45import flask6from flask.sessions import SecureCookieSessionInterface
75 unmodified lines
82 == "http://foo.localhost.localdomain:5000/"83 )8485 # suppress Werkzeug 0.15 warning about name mismatch84 with pytest.warns(None):86 with warnings.catch_warnings():87 warnings.filterwarnings(88 "ignore", "Current server name", UserWarning, "flask.app"89 )90 with app.test_request_context(91 "/", environ_overrides={"HTTP_HOST": "localhost"}92 ):93 pass
232 unmodified lines
modified:.pre-commit-config.yaml+6 added-2 removed
6 unmodified lines
7 hooks:8 - id: pyupgrade9 args: ["--py36-plus"]10 - repo: https://github.com/asottile/reorder_python_imports11 rev: v2.6.011 rev: v2.7.112 hooks:13 - id: reorder-python-imports14 name: Reorder Python imports (src, tests)15 files: "^(?!examples/)"16 args: ["--application-directories", "src"]17 - repo: https://github.com/psf/black18 rev: 21.12b018 rev: 22.1.019 hooks:20 - id: black21 - repo: https://github.com/PyCQA/flake822 rev: 4.0.1
1 unmodified line
24 - id: flake825 additional_dependencies:26 - flake8-bugbear27 - flake8-implicit-str-concat28 - repo: https://github.com/peterdemin/pip-compile-multi29 rev: v2.4.330 hooks:31 - id: pip-compile-multi-verify32 - repo: https://github.com/pre-commit/pre-commit-hooks33 rev: v4.1.034 hooks:35 - id: fix-byte-order-marker
2 unmodified lines