Merge branch '3.0.x'

This commit is contained in:
David Lord 2024-08-23 16:34:57 -07:00
commit 4e6384da32
No known key found for this signature in database
GPG key ID: 43368A7AA8CC5926
16 changed files with 112 additions and 104 deletions

View file

@ -1,18 +0,0 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
groups:
github-actions:
patterns:
- '*'
- package-ecosystem: pip
directory: /requirements/
schedule:
interval: monthly
groups:
python-requirements:
patterns:
- '*'

View file

@ -23,7 +23,7 @@ jobs:
- name: generate hash - name: generate hash
id: hash id: hash
run: cd dist && echo "hash=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT run: cd dist && echo "hash=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with: with:
path: ./dist path: ./dist
provenance: provenance:

View file

@ -2,7 +2,7 @@ ci:
autoupdate_schedule: monthly autoupdate_schedule: monthly
repos: repos:
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6 rev: v0.6.2
hooks: hooks:
- id: ruff - id: ruff
- id: ruff-format - id: ruff-format

View file

@ -142,6 +142,12 @@ The following configuration values are used internally by Flask:
Default: ``None`` Default: ``None``
.. warning::
If this is changed after the browser created a cookie is created with
one setting, it may result in another being created. Browsers may send
send both in an undefined order. In that case, you may want to change
:data:`SESSION_COOKIE_NAME` as well or otherwise invalidate old sessions.
.. versionchanged:: 2.3 .. versionchanged:: 2.3
Not set by default, does not fall back to ``SERVER_NAME``. Not set by default, does not fall back to ``SERVER_NAME``.

View file

@ -68,7 +68,7 @@ reverse proxy such as :doc:`nginx` or :doc:`apache-httpd` should be used
in front of Waitress. in front of Waitress.
You can bind to all external IPs on a non-privileged port by not You can bind to all external IPs on a non-privileged port by not
specifying the ``--host`` option. Don't do this when using a revers specifying the ``--host`` option. Don't do this when using a reverse
proxy setup, otherwise it will be possible to bypass the proxy. proxy setup, otherwise it will be possible to bypass the proxy.
``0.0.0.0`` is not a valid address to navigate to, you'd use a specific ``0.0.0.0`` is not a valid address to navigate to, you'd use a specific

View file

@ -375,7 +375,7 @@ Here's a simple example of how to render a template::
@app.route('/hello/') @app.route('/hello/')
@app.route('/hello/<name>') @app.route('/hello/<name>')
def hello(name=None): def hello(name=None):
return render_template('hello.html', name=name) return render_template('hello.html', person=name)
Flask will look for templates in the :file:`templates` folder. So if your Flask will look for templates in the :file:`templates` folder. So if your
application is a module, this folder is next to that module, if it's a application is a module, this folder is next to that module, if it's a
@ -404,8 +404,8 @@ Here is an example template:
<!doctype html> <!doctype html>
<title>Hello from Flask</title> <title>Hello from Flask</title>
{% if name %} {% if person %}
<h1>Hello {{ name }}!</h1> <h1>Hello {{ person }}!</h1>
{% else %} {% else %}
<h1>Hello, World!</h1> <h1>Hello, World!</h1>
{% endif %} {% endif %}
@ -419,7 +419,7 @@ know how that works, see :doc:`patterns/templateinheritance`. Basically
template inheritance makes it possible to keep certain elements on each template inheritance makes it possible to keep certain elements on each
page (like header, navigation and footer). page (like header, navigation and footer).
Automatic escaping is enabled, so if ``name`` contains HTML it will be escaped Automatic escaping is enabled, so if ``person`` contains HTML it will be escaped
automatically. If you can trust a variable and you know that it will be automatically. If you can trust a variable and you know that it will be
safe HTML (for example because it came from a module that converts wiki safe HTML (for example because it came from a module that converts wiki
markup to HTML) you can mark it as safe by using the markup to HTML) you can mark it as safe by using the

View file

@ -113,8 +113,12 @@ select = [
"UP", # pyupgrade "UP", # pyupgrade
"W", # pycodestyle warning "W", # pycodestyle warning
] ]
ignore-init-module-imports = true
[tool.ruff.lint.isort] [tool.ruff.lint.isort]
force-single-line = true force-single-line = true
order-by-type = false order-by-type = false
[tool.gha-update]
tag-only = [
"slsa-framework/slsa-github-generator",
]

View file

@ -6,7 +6,7 @@
# #
build==1.2.1 build==1.2.1
# via -r build.in # via -r build.in
packaging==24.0 packaging==24.1
# via build # via build
pyproject-hooks==1.0.0 pyproject-hooks==1.1.0
# via build # via build

View file

@ -4,7 +4,7 @@
# #
# pip-compile dev.in # pip-compile dev.in
# #
alabaster==0.7.16 alabaster==1.0.0
# via # via
# -r docs.txt # -r docs.txt
# sphinx # sphinx
@ -12,17 +12,17 @@ asgiref==3.8.1
# via # via
# -r tests.txt # -r tests.txt
# -r typing.txt # -r typing.txt
babel==2.14.0 babel==2.16.0
# via # via
# -r docs.txt # -r docs.txt
# sphinx # sphinx
cachetools==5.3.3 cachetools==5.5.0
# via tox # via tox
certifi==2024.2.2 certifi==2024.7.4
# via # via
# -r docs.txt # -r docs.txt
# requests # requests
cffi==1.16.0 cffi==1.17.0
# via # via
# -r typing.txt # -r typing.txt
# cryptography # cryptography
@ -36,22 +36,22 @@ charset-normalizer==3.3.2
# requests # requests
colorama==0.4.6 colorama==0.4.6
# via tox # via tox
cryptography==42.0.8 cryptography==43.0.0
# via -r typing.txt # via -r typing.txt
distlib==0.3.8 distlib==0.3.8
# via virtualenv # via virtualenv
docutils==0.20.1 docutils==0.21.2
# via # via
# -r docs.txt # -r docs.txt
# sphinx # sphinx
# sphinx-tabs # sphinx-tabs
filelock==3.13.3 filelock==3.15.4
# via # via
# tox # tox
# virtualenv # virtualenv
identify==2.5.35 identify==2.6.0
# via pre-commit # via pre-commit
idna==3.6 idna==3.8
# via # via
# -r docs.txt # -r docs.txt
# requests # requests
@ -64,7 +64,7 @@ iniconfig==2.0.0
# -r tests.txt # -r tests.txt
# -r typing.txt # -r typing.txt
# pytest # pytest
jinja2==3.1.3 jinja2==3.1.4
# via # via
# -r docs.txt # -r docs.txt
# sphinx # sphinx
@ -72,18 +72,18 @@ markupsafe==2.1.5
# via # via
# -r docs.txt # -r docs.txt
# jinja2 # jinja2
mypy==1.10.1 mypy==1.11.1
# via -r typing.txt # via -r typing.txt
mypy-extensions==1.0.0 mypy-extensions==1.0.0
# via # via
# -r typing.txt # -r typing.txt
# mypy # mypy
nodeenv==1.8.0 nodeenv==1.9.1
# via # via
# -r typing.txt # -r typing.txt
# pre-commit # pre-commit
# pyright # pyright
packaging==24.0 packaging==24.1
# via # via
# -r docs.txt # -r docs.txt
# -r tests.txt # -r tests.txt
@ -95,7 +95,7 @@ packaging==24.0
# tox # tox
pallets-sphinx-themes==2.1.3 pallets-sphinx-themes==2.1.3
# via -r docs.txt # via -r docs.txt
platformdirs==4.2.0 platformdirs==4.2.2
# via # via
# tox # tox
# virtualenv # virtualenv
@ -105,22 +105,22 @@ pluggy==1.5.0
# -r typing.txt # -r typing.txt
# pytest # pytest
# tox # tox
pre-commit==3.7.1 pre-commit==3.8.0
# via -r dev.in # via -r dev.in
pycparser==2.22 pycparser==2.22
# via # via
# -r typing.txt # -r typing.txt
# cffi # cffi
pygments==2.17.2 pygments==2.18.0
# via # via
# -r docs.txt # -r docs.txt
# sphinx # sphinx
# sphinx-tabs # sphinx-tabs
pyproject-api==1.6.1 pyproject-api==1.7.1
# via tox # via tox
pyright==1.1.369 pyright==1.1.377
# via -r typing.txt # via -r typing.txt
pytest==8.2.2 pytest==8.3.2
# via # via
# -r tests.txt # -r tests.txt
# -r typing.txt # -r typing.txt
@ -128,9 +128,9 @@ python-dotenv==1.0.1
# via # via
# -r tests.txt # -r tests.txt
# -r typing.txt # -r typing.txt
pyyaml==6.0.1 pyyaml==6.0.2
# via pre-commit # via pre-commit
requests==2.31.0 requests==2.32.3
# via # via
# -r docs.txt # -r docs.txt
# sphinx # sphinx
@ -138,7 +138,7 @@ snowballstemmer==2.2.0
# via # via
# -r docs.txt # -r docs.txt
# sphinx # sphinx
sphinx==7.3.7 sphinx==8.0.2
# via # via
# -r docs.txt # -r docs.txt
# pallets-sphinx-themes # pallets-sphinx-themes
@ -146,15 +146,15 @@ sphinx==7.3.7
# sphinxcontrib-log-cabinet # sphinxcontrib-log-cabinet
sphinx-tabs==3.4.5 sphinx-tabs==3.4.5
# via -r docs.txt # via -r docs.txt
sphinxcontrib-applehelp==1.0.8 sphinxcontrib-applehelp==2.0.0
# via # via
# -r docs.txt # -r docs.txt
# sphinx # sphinx
sphinxcontrib-devhelp==1.0.6 sphinxcontrib-devhelp==2.0.0
# via # via
# -r docs.txt # -r docs.txt
# sphinx # sphinx
sphinxcontrib-htmlhelp==2.0.5 sphinxcontrib-htmlhelp==2.1.0
# via # via
# -r docs.txt # -r docs.txt
# sphinx # sphinx
@ -164,32 +164,29 @@ sphinxcontrib-jsmath==1.0.1
# sphinx # sphinx
sphinxcontrib-log-cabinet==1.0.1 sphinxcontrib-log-cabinet==1.0.1
# via -r docs.txt # via -r docs.txt
sphinxcontrib-qthelp==1.0.7 sphinxcontrib-qthelp==2.0.0
# via # via
# -r docs.txt # -r docs.txt
# sphinx # sphinx
sphinxcontrib-serializinghtml==1.1.10 sphinxcontrib-serializinghtml==2.0.0
# via # via
# -r docs.txt # -r docs.txt
# sphinx # sphinx
tox==4.15.1 tox==4.18.0
# via -r dev.in # via -r dev.in
types-contextvars==2.4.7.3 types-contextvars==2.4.7.3
# via -r typing.txt # via -r typing.txt
types-dataclasses==0.6.6 types-dataclasses==0.6.6
# via -r typing.txt # via -r typing.txt
typing-extensions==4.11.0 typing-extensions==4.12.2
# via # via
# -r typing.txt # -r typing.txt
# mypy # mypy
urllib3==2.2.1 urllib3==2.2.2
# via # via
# -r docs.txt # -r docs.txt
# requests # requests
virtualenv==20.25.1 virtualenv==20.26.3
# via # via
# pre-commit # pre-commit
# tox # tox
# The following packages are considered to be unsafe in a requirements file:
# setuptools

View file

@ -4,41 +4,41 @@
# #
# pip-compile docs.in # pip-compile docs.in
# #
alabaster==0.7.16 alabaster==1.0.0
# via sphinx # via sphinx
babel==2.14.0 babel==2.16.0
# via sphinx # via sphinx
certifi==2024.2.2 certifi==2024.7.4
# via requests # via requests
charset-normalizer==3.3.2 charset-normalizer==3.3.2
# via requests # via requests
docutils==0.20.1 docutils==0.21.2
# via # via
# sphinx # sphinx
# sphinx-tabs # sphinx-tabs
idna==3.6 idna==3.8
# via requests # via requests
imagesize==1.4.1 imagesize==1.4.1
# via sphinx # via sphinx
jinja2==3.1.3 jinja2==3.1.4
# via sphinx # via sphinx
markupsafe==2.1.5 markupsafe==2.1.5
# via jinja2 # via jinja2
packaging==24.0 packaging==24.1
# via # via
# pallets-sphinx-themes # pallets-sphinx-themes
# sphinx # sphinx
pallets-sphinx-themes==2.1.3 pallets-sphinx-themes==2.1.3
# via -r docs.in # via -r docs.in
pygments==2.17.2 pygments==2.18.0
# via # via
# sphinx # sphinx
# sphinx-tabs # sphinx-tabs
requests==2.31.0 requests==2.32.3
# via sphinx # via sphinx
snowballstemmer==2.2.0 snowballstemmer==2.2.0
# via sphinx # via sphinx
sphinx==7.3.7 sphinx==8.0.2
# via # via
# -r docs.in # -r docs.in
# pallets-sphinx-themes # pallets-sphinx-themes
@ -46,19 +46,19 @@ sphinx==7.3.7
# sphinxcontrib-log-cabinet # sphinxcontrib-log-cabinet
sphinx-tabs==3.4.5 sphinx-tabs==3.4.5
# via -r docs.in # via -r docs.in
sphinxcontrib-applehelp==1.0.8 sphinxcontrib-applehelp==2.0.0
# via sphinx # via sphinx
sphinxcontrib-devhelp==1.0.6 sphinxcontrib-devhelp==2.0.0
# via sphinx # via sphinx
sphinxcontrib-htmlhelp==2.0.5 sphinxcontrib-htmlhelp==2.1.0
# via sphinx # via sphinx
sphinxcontrib-jsmath==1.0.1 sphinxcontrib-jsmath==1.0.1
# via sphinx # via sphinx
sphinxcontrib-log-cabinet==1.0.1 sphinxcontrib-log-cabinet==1.0.1
# via -r docs.in # via -r docs.in
sphinxcontrib-qthelp==1.0.7 sphinxcontrib-qthelp==2.0.0
# via sphinx # via sphinx
sphinxcontrib-serializinghtml==1.1.10 sphinxcontrib-serializinghtml==2.0.0
# via sphinx # via sphinx
urllib3==2.2.1 urllib3==2.2.2
# via requests # via requests

View file

@ -8,11 +8,11 @@ asgiref==3.8.1
# via -r tests.in # via -r tests.in
iniconfig==2.0.0 iniconfig==2.0.0
# via pytest # via pytest
packaging==24.0 packaging==24.1
# via pytest # via pytest
pluggy==1.5.0 pluggy==1.5.0
# via pytest # via pytest
pytest==8.2.2 pytest==8.3.2
# via -r tests.in # via -r tests.in
python-dotenv==1.0.1 python-dotenv==1.0.1
# via -r tests.in # via -r tests.in

View file

@ -6,27 +6,27 @@
# #
asgiref==3.8.1 asgiref==3.8.1
# via -r typing.in # via -r typing.in
cffi==1.16.0 cffi==1.17.0
# via cryptography # via cryptography
cryptography==42.0.8 cryptography==43.0.0
# via -r typing.in # via -r typing.in
iniconfig==2.0.0 iniconfig==2.0.0
# via pytest # via pytest
mypy==1.10.1 mypy==1.11.1
# via -r typing.in # via -r typing.in
mypy-extensions==1.0.0 mypy-extensions==1.0.0
# via mypy # via mypy
nodeenv==1.8.0 nodeenv==1.9.1
# via pyright # via pyright
packaging==24.0 packaging==24.1
# via pytest # via pytest
pluggy==1.5.0 pluggy==1.5.0
# via pytest # via pytest
pycparser==2.22 pycparser==2.22
# via cffi # via cffi
pyright==1.1.369 pyright==1.1.377
# via -r typing.in # via -r typing.in
pytest==8.2.2 pytest==8.3.2
# via -r typing.in # via -r typing.in
python-dotenv==1.0.1 python-dotenv==1.0.1
# via -r typing.in # via -r typing.in
@ -34,8 +34,5 @@ types-contextvars==2.4.7.3
# via -r typing.in # via -r typing.in
types-dataclasses==0.6.6 types-dataclasses==0.6.6
# via -r typing.in # via -r typing.in
typing-extensions==4.11.0 typing-extensions==4.12.2
# via mypy # via mypy
# The following packages are considered to be unsafe in a requirements file:
# setuptools

View file

@ -47,9 +47,21 @@ def get_load_dotenv(default: bool = True) -> bool:
return val.lower() in ("0", "false", "no") return val.lower() in ("0", "false", "no")
@t.overload
def stream_with_context(
generator_or_function: t.Iterator[t.AnyStr],
) -> t.Iterator[t.AnyStr]: ...
@t.overload
def stream_with_context(
generator_or_function: t.Callable[..., t.Iterator[t.AnyStr]],
) -> t.Callable[[t.Iterator[t.AnyStr]], t.Iterator[t.AnyStr]]: ...
def stream_with_context( def stream_with_context(
generator_or_function: t.Iterator[t.AnyStr] | t.Callable[..., t.Iterator[t.AnyStr]], generator_or_function: t.Iterator[t.AnyStr] | t.Callable[..., t.Iterator[t.AnyStr]],
) -> t.Iterator[t.AnyStr]: ) -> t.Iterator[t.AnyStr] | t.Callable[[t.Iterator[t.AnyStr]], t.Iterator[t.AnyStr]]:
"""Request contexts disappear when the response is started on the server. """Request contexts disappear when the response is started on the server.
This is done for efficiency reasons and to make it less likely to encounter This is done for efficiency reasons and to make it less likely to encounter
memory leaks with badly written WSGI middlewares. The downside is that if memory leaks with badly written WSGI middlewares. The downside is that if

View file

@ -113,7 +113,7 @@ def _default(o: t.Any) -> t.Any:
return str(o) return str(o)
if dataclasses and dataclasses.is_dataclass(o): if dataclasses and dataclasses.is_dataclass(o):
return dataclasses.asdict(o) return dataclasses.asdict(o) # type: ignore[call-overload]
if hasattr(o, "__html__"): if hasattr(o, "__html__"):
return str(o.__html__()) return str(o.__html__())

View file

@ -291,7 +291,7 @@ class App(Scaffold):
instance_path: str | None = None, instance_path: str | None = None,
instance_relative_config: bool = False, instance_relative_config: bool = False,
root_path: str | None = None, root_path: str | None = None,
): ) -> None:
super().__init__( super().__init__(
import_name=import_name, import_name=import_name,
static_folder=static_folder, static_folder=static_folder,

28
tox.ini
View file

@ -34,16 +34,26 @@ commands = mypy
deps = -r requirements/docs.txt deps = -r requirements/docs.txt
commands = sphinx-build -E -W -b dirhtml docs docs/_build/dirhtml commands = sphinx-build -E -W -b dirhtml docs docs/_build/dirhtml
[testenv:update-actions]
labels = update
deps = gha-update
commands = gha-update
[testenv:update-pre_commit]
labels = update
deps = pre-commit
skip_install = true
commands = pre-commit autoupdate -j4
[testenv:update-requirements] [testenv:update-requirements]
deps = base_python = 3.12
pip-tools labels = update
pre-commit deps = pip-tools
skip_install = true skip_install = true
change_dir = requirements change_dir = requirements
commands = commands =
pre-commit autoupdate -j4 pip-compile build.in -q {posargs:-U}
pip-compile -U build.in pip-compile docs.in -q {posargs:-U}
pip-compile -U docs.in pip-compile tests.in -q {posargs:-U}
pip-compile -U tests.in pip-compile typing.in -q {posargs:-U}
pip-compile -U typing.in pip-compile dev.in -q {posargs:-U}
pip-compile -U dev.in