update project files (#5457)

* update pre-commit hook
* upgrade pip with venv
* update description and version
* show url in publish environment
* update versions
* update versions, separate typing job
* use dependabot grouped updates
  ignore upload/download-artifact until slsa updates
* use sphinx.ext.extlinks instead of sphinx-issues
* update dev dependencies
* update editorconfig
* update gitignore
* update .readthedocs.yaml
* license is txt, readme is md
* update pyproject.toml
  add typed classifier
  add pyright config
  simplify urls
* tox builds docs in place
* update min test py version
* add tox env to update all dev dependencies
* update issue and pr templates
* rename security docs page to not conflict with org policy file
* simplify matrix
This commit is contained in:
David Lord 2024-04-07 10:24:40 -07:00 committed by GitHub
parent d5e321b792
commit 87d5f5b9a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
35 changed files with 382 additions and 322 deletions

View File

@ -1,9 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
python3 -m venv --upgrade-deps .venv
python3 -m venv .venv
. .venv/bin/activate . .venv/bin/activate
pip install -U pip
pip install -r requirements/dev.txt pip install -r requirements/dev.txt
pip install -e . pip install -e .
pre-commit install --install-hooks pre-commit install --install-hooks

View File

@ -9,5 +9,5 @@ end_of_line = lf
charset = utf-8 charset = utf-8
max_line_length = 88 max_line_length = 88
[*.{yml,yaml,json,js,css,html}] [*.{css,html,js,json,jsx,scss,ts,tsx,yaml,yml}]
indent_size = 2 indent_size = 2

View File

@ -5,7 +5,7 @@ about: Report a bug in Flask (not other projects which depend on Flask)
<!-- <!--
This issue tracker is a tool to address bugs in Flask itself. Please use This issue tracker is a tool to address bugs in Flask itself. Please use
Pallets Discord or Stack Overflow for questions about your own code. GitHub Discussions or the Pallets Discord for questions about your own code.
Replace this comment with a clear outline of what the bug is. Replace this comment with a clear outline of what the bug is.
--> -->

View File

@ -1,11 +1,11 @@
blank_issues_enabled: false blank_issues_enabled: false
contact_links: contact_links:
- name: Security issue - name: Security issue
url: security@palletsprojects.com url: https://github.com/pallets/flask/security/advisories/new
about: Do not report security issues publicly. Email our security contact. about: Do not report security issues publicly. Create a private advisory.
- name: Questions - name: Questions
url: https://stackoverflow.com/questions/tagged/flask?tab=Frequent url: https://github.com/pallets/flask/discussions/
about: Search for and ask questions about your code on Stack Overflow. about: Ask questions about your own code on the Discussions tab.
- name: Questions and discussions - name: Questions on
url: https://discord.gg/pallets url: https://discord.gg/pallets
about: Discuss questions about your code on our Discord chat. about: Ask questions about your own code on our Discord chat.

19
.github/SECURITY.md vendored
View File

@ -1,19 +0,0 @@
# Security Policy
If you believe you have identified a security issue with a Pallets
project, **do not open a public issue**. To responsibly report a
security issue, please email security@palletsprojects.com. A security
team member will contact you acknowledging the report and how to
continue.
Be sure to include as much detail as necessary in your report. As with
reporting normal issues, a minimal reproducible example will help the
maintainers address the issue faster. If you are able, you may also
include a fix for the issue generated with `git format-patch`.
The current and previous release will receive security patches, with
older versions evaluated based on usage information and severity.
After fixing an issue, we will make a security release along with an
announcement on our blog. We may obtain a CVE id as well. You may
include a name and link if you would like to be credited for the report.

View File

@ -1,9 +1,24 @@
version: 2 version: 2
updates: updates:
- package-ecosystem: "github-actions" - package-ecosystem: github-actions
directory: "/" directory: /
schedule: schedule:
interval: "monthly" interval: monthly
day: "monday" ignore:
time: "16:00" # slsa depends on upload/download v3
timezone: "UTC" - dependency-name: actions/upload-artifact
versions: '>= 4'
- dependency-name: actions/download-artifact
versions: '>= 4'
groups:
github-actions:
patterns:
- '*'
- package-ecosystem: pip
directory: /requirements/
schedule:
interval: monthly
groups:
python-requirements:
patterns:
- '*'

View File

@ -1,6 +1,7 @@
<!-- <!--
Before opening a PR, open a ticket describing the issue or feature the Before opening a PR, open a ticket describing the issue or feature the
PR will address. Follow the steps in CONTRIBUTING.rst. PR will address. An issue is not required for fixing typos in
documentation, or other simple non-code changes.
Replace this comment with a description of the change. Describe how it Replace this comment with a description of the change. Describe how it
addresses the linked ticket. addresses the linked ticket.
@ -9,22 +10,16 @@ addresses the linked ticket.
<!-- <!--
Link to relevant issues or previous PRs, one per line. Use "fixes" to Link to relevant issues or previous PRs, one per line. Use "fixes" to
automatically close an issue. automatically close an issue.
-->
- fixes #<issue number> fixes #<issue number>
-->
<!-- <!--
Ensure each step in CONTRIBUTING.rst is complete by adding an "x" to Ensure each step in CONTRIBUTING.rst is complete, especially the following:
each box below.
If only docs were changed, these aren't relevant and can be removed. - Add tests that demonstrate the correct behavior of the change. Tests
should fail without the change.
- Add or update relevant docs, in the docs folder and in code.
- Add an entry in CHANGES.rst summarizing the change and linking to the issue.
- Add `.. versionchanged::` entries in any relevant code docs.
--> -->
Checklist:
- [ ] Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
- [ ] Add or update relevant docs, in the docs folder and in code.
- [ ] Add an entry in `CHANGES.rst` summarizing the change and linking to the issue.
- [ ] Add `.. versionchanged::` entries in any relevant code docs.
- [ ] Run `pre-commit` hooks and fix any issues.
- [ ] Run `pytest` and `tox`, no tests failed.

View File

@ -1,8 +1,9 @@
name: 'Lock threads' name: Lock inactive closed issues
# Lock closed issues that have not received any further activity for # Lock closed issues that have not received any further activity for two weeks.
# two weeks. This does not close open issues, only humans may do that. # This does not close open issues, only humans may do that. It is easier to
# We find that it is easier to respond to new issues with fresh examples # respond to new issues with fresh examples rather than continuing discussions
# rather than continuing discussions on old issues. # on old issues.
on: on:
schedule: schedule:
- cron: '0 0 * * *' - cron: '0 0 * * *'
@ -15,7 +16,8 @@ jobs:
lock: lock:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: dessant/lock-threads@7de207be1d3ce97a9abe6ff1306222982d1ca9f9 - uses: dessant/lock-threads@7de207be1d3ce97a9abe6ff1306222982d1ca9f9 # v5.0.1
with: with:
issue-inactive-days: 14 issue-inactive-days: 14
pr-inactive-days: 14 pr-inactive-days: 14
discussion-inactive-days: 14

View File

@ -9,8 +9,8 @@ jobs:
outputs: outputs:
hash: ${{ steps.hash.outputs.hash }} hash: ${{ steps.hash.outputs.hash }}
steps: steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with: with:
python-version: '3.x' python-version: '3.x'
cache: pip cache: pip
@ -23,9 +23,8 @@ 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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with: with:
name: dist
path: ./dist path: ./dist
provenance: provenance:
needs: [build] needs: [build]
@ -34,7 +33,7 @@ jobs:
id-token: write id-token: write
contents: write contents: write
# Can't pin with hash due to how this workflow works. # Can't pin with hash due to how this workflow works.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.9.0 uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0
with: with:
base64-subjects: ${{ needs.build.outputs.hash }} base64-subjects: ${{ needs.build.outputs.hash }}
create-release: create-release:
@ -45,25 +44,30 @@ jobs:
permissions: permissions:
contents: write contents: write
steps: steps:
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- name: create release - name: create release
run: > run: >
gh release create --draft --repo ${{ github.repository }} gh release create --draft --repo ${{ github.repository }}
${{ github.ref_name }} ${{ github.ref_name }}
*.intoto.jsonl/* dist/* *.intoto.jsonl/* artifact/*
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
publish-pypi: publish-pypi:
needs: [provenance] needs: [provenance]
# Wait for approval before attempting to upload to PyPI. This allows reviewing the # Wait for approval before attempting to upload to PyPI. This allows reviewing the
# files in the draft release. # files in the draft release.
environment: publish environment:
name: publish
url: https://pypi.org/project/Flask/${{ github.ref_name }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
id-token: write id-token: write
steps: steps:
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- uses: pypa/gh-action-pypi-publish@f946db0f765b9ae754e44bfd5ae5b8b91cfb37ef - uses: pypa/gh-action-pypi-publish@68e62d4871ad9d14a9d55f114e6ac71f0b408ec0 # v1.8.14
with: with:
repository-url: https://test.pypi.org/legacy/ repository-url: https://test.pypi.org/legacy/
- uses: pypa/gh-action-pypi-publish@f946db0f765b9ae754e44bfd5ae5b8b91cfb37ef packages-dir: artifact/
- uses: pypa/gh-action-pypi-publish@68e62d4871ad9d14a9d55f114e6ac71f0b408ec0 # v1.8.14
with:
packages-dir: artifact/

View File

@ -15,35 +15,45 @@ on:
- '*.rst' - '*.rst'
jobs: jobs:
tests: tests:
name: ${{ matrix.name }} name: ${{ matrix.name || matrix.python }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- {name: Linux, python: '3.12', os: ubuntu-latest, tox: py312} - {python: '3.12'}
- {name: Windows, python: '3.12', os: windows-latest, tox: py312} - {name: Windows, python: '3.12', os: windows-latest}
- {name: Mac, python: '3.12', os: macos-latest, tox: py312} - {name: Mac, python: '3.12', os: macos-latest}
- {name: '3.11', python: '3.11', os: ubuntu-latest, tox: py311} - {python: '3.11'}
- {name: '3.10', python: '3.10', os: ubuntu-latest, tox: py310} - {python: '3.10'}
- {name: '3.9', python: '3.9', os: ubuntu-latest, tox: py39} - {python: '3.9'}
- {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38} - {python: '3.8'}
- {name: 'PyPy', python: 'pypy-3.10', os: ubuntu-latest, tox: pypy310} - {name: PyPy, python: 'pypy-3.10', tox: pypy310}
- {name: 'Minimum Versions', python: '3.12', os: ubuntu-latest, tox: py312-min} - {name: Minimum Versions, python: '3.12', tox: py-min}
- {name: 'Development Versions', python: '3.8', os: ubuntu-latest, tox: py38-dev} - {name: Development Versions, python: '3.8', tox: py-dev}
- {name: Typing, python: '3.12', os: ubuntu-latest, tox: typing}
steps: steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with: with:
python-version: ${{ matrix.python }} python-version: ${{ matrix.python }}
cache: 'pip' allow-prereleases: true
cache: pip
cache-dependency-path: requirements*/*.txt
- run: pip install tox
- run: tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }}
typing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.x'
cache: pip
cache-dependency-path: requirements*/*.txt cache-dependency-path: requirements*/*.txt
- name: cache mypy - name: cache mypy
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with: with:
path: ./.mypy_cache path: ./.mypy_cache
key: mypy|${{ matrix.python }}|${{ hashFiles('pyproject.toml') }} key: mypy|${{ hashFiles('pyproject.toml') }}
if: matrix.tox == 'typing'
- run: pip install tox - run: pip install tox
- run: tox run -e ${{ matrix.tox }} - run: tox run -e typing

12
.gitignore vendored
View File

@ -1,10 +1,10 @@
.idea/ .idea/
.vscode/ .vscode/
.venv*/
venv*/
__pycache__/ __pycache__/
.tox/
.coverage
.coverage.*
htmlcov/
docs/_build/
dist/ dist/
venv/ .coverage*
htmlcov/
.tox/
docs/_build/

View File

@ -2,12 +2,12 @@ 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.1.13 rev: v0.3.5
hooks: hooks:
- id: ruff - id: ruff
- id: ruff-format - id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0 rev: v4.6.0
hooks: hooks:
- id: check-merge-conflict - id: check-merge-conflict
- id: debug-statements - id: debug-statements

View File

@ -2,7 +2,7 @@ version: 2
build: build:
os: ubuntu-22.04 os: ubuntu-22.04
tools: tools:
python: "3.12" python: '3.12'
python: python:
install: install:
- requirements: requirements/docs.txt - requirements: requirements/docs.txt

65
README.md Normal file
View File

@ -0,0 +1,65 @@
# Flask
Flask is a lightweight [WSGI][] web application framework. It is designed
to make getting started quick and easy, with the ability to scale up to
complex applications. It began as a simple wrapper around [Werkzeug][]
and [Jinja][], and has become one of the most popular Python web
application frameworks.
Flask offers suggestions, but doesn't enforce any dependencies or
project layout. It is up to the developer to choose the tools and
libraries they want to use. There are many extensions provided by the
community that make adding new functionality easy.
[WSGI]: https://wsgi.readthedocs.io/
[Werkzeug]: https://werkzeug.palletsprojects.com/
[Jinja]: https://jinja.palletsprojects.com/
## Installing
Install and update from [PyPI][] using an installer such as [pip][]:
```
$ pip install -U Flask
```
[PyPI]: https://pypi.org/project/Flask/
[pip]: https://pip.pypa.io/en/stable/getting-started/
## A Simple Example
```python
# save this as app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"
```
```
$ flask run
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
```
## Contributing
For guidance on setting up a development environment and how to make a
contribution to Flask, see the [contributing guidelines][].
[contributing guidelines]: https://github.com/pallets/flask/blob/main/CONTRIBUTING.rst
## Donate
The Pallets organization develops and supports Flask and the libraries
it uses. In order to grow the community of contributors and users, and
allow the maintainers to devote more time to the projects, [please
donate today][].
[please donate today]: https://palletsprojects.com/donate

View File

@ -1,80 +0,0 @@
Flask
=====
Flask is a lightweight `WSGI`_ web application framework. It is designed
to make getting started quick and easy, with the ability to scale up to
complex applications. It began as a simple wrapper around `Werkzeug`_
and `Jinja`_ and has become one of the most popular Python web
application frameworks.
Flask offers suggestions, but doesn't enforce any dependencies or
project layout. It is up to the developer to choose the tools and
libraries they want to use. There are many extensions provided by the
community that make adding new functionality easy.
.. _WSGI: https://wsgi.readthedocs.io/
.. _Werkzeug: https://werkzeug.palletsprojects.com/
.. _Jinja: https://jinja.palletsprojects.com/
Installing
----------
Install and update using `pip`_:
.. code-block:: text
$ pip install -U Flask
.. _pip: https://pip.pypa.io/en/stable/getting-started/
A Simple Example
----------------
.. code-block:: python
# save this as app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"
.. code-block:: text
$ flask run
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Contributing
------------
For guidance on setting up a development environment and how to make a
contribution to Flask, see the `contributing guidelines`_.
.. _contributing guidelines: https://github.com/pallets/flask/blob/main/CONTRIBUTING.rst
Donate
------
The Pallets organization develops and supports Flask and the libraries
it uses. In order to grow the community of contributors and users, and
allow the maintainers to devote more time to the projects, `please
donate today`_.
.. _please donate today: https://palletsprojects.com/donate
Links
-----
- Documentation: https://flask.palletsprojects.com/
- Changes: https://flask.palletsprojects.com/changes/
- PyPI Releases: https://pypi.org/project/Flask/
- Source Code: https://github.com/pallets/flask/
- Issue Tracker: https://github.com/pallets/flask/issues/
- Chat: https://discord.gg/pallets

View File

@ -11,16 +11,22 @@ release, version = get_version("Flask")
# General -------------------------------------------------------------- # General --------------------------------------------------------------
master_doc = "index" default_role = "code"
extensions = [ extensions = [
"sphinx.ext.autodoc", "sphinx.ext.autodoc",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx", "sphinx.ext.intersphinx",
"sphinxcontrib.log_cabinet", "sphinxcontrib.log_cabinet",
"pallets_sphinx_themes",
"sphinx_issues",
"sphinx_tabs.tabs", "sphinx_tabs.tabs",
"pallets_sphinx_themes",
] ]
autodoc_member_order = "bysource"
autodoc_typehints = "description" autodoc_typehints = "description"
autodoc_preserve_defaults = True
extlinks = {
"issue": ("https://github.com/pallets/flask/issues/%s", "#%s"),
"pr": ("https://github.com/pallets/flask/pull/%s", "#%s"),
}
intersphinx_mapping = { intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None), "python": ("https://docs.python.org/3/", None),
"werkzeug": ("https://werkzeug.palletsprojects.com/", None), "werkzeug": ("https://werkzeug.palletsprojects.com/", None),
@ -31,7 +37,6 @@ intersphinx_mapping = {
"wtforms": ("https://wtforms.readthedocs.io/", None), "wtforms": ("https://wtforms.readthedocs.io/", None),
"blinker": ("https://blinker.readthedocs.io/", None), "blinker": ("https://blinker.readthedocs.io/", None),
} }
issues_github_path = "pallets/flask"
# HTML ----------------------------------------------------------------- # HTML -----------------------------------------------------------------
@ -57,10 +62,6 @@ html_logo = "_static/flask-vertical.png"
html_title = f"Flask Documentation ({version})" html_title = f"Flask Documentation ({version})"
html_show_sourcelink = False html_show_sourcelink = False
# LaTeX ----------------------------------------------------------------
latex_documents = [(master_doc, f"Flask-{version}.tex", html_title, author, "manual")]
# Local Extensions ----------------------------------------------------- # Local Extensions -----------------------------------------------------

View File

@ -54,7 +54,7 @@ community-maintained extensions to add even more functionality.
server server
shell shell
patterns/index patterns/index
security web-security
deploying/index deploying/index
async-await async-await

View File

@ -1,4 +1,5 @@
BSD-3-Clause License BSD-3-Clause License
==================== ====================
.. include:: ../LICENSE.rst .. literalinclude:: ../LICENSE.txt
:language: text

View File

@ -2,8 +2,8 @@
name = "Flask" name = "Flask"
version = "3.0.2" version = "3.0.2"
description = "A simple framework for building complex web applications." description = "A simple framework for building complex web applications."
readme = "README.rst" readme = "README.md"
license = {file = "LICENSE.rst"} license = {file = "LICENSE.txt"}
maintainers = [{name = "Pallets", email = "contact@palletsprojects.com"}] maintainers = [{name = "Pallets", email = "contact@palletsprojects.com"}]
classifiers = [ classifiers = [
"Development Status :: 5 - Production/Stable", "Development Status :: 5 - Production/Stable",
@ -17,6 +17,7 @@ classifiers = [
"Topic :: Internet :: WWW/HTTP :: WSGI", "Topic :: Internet :: WWW/HTTP :: WSGI",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Application Frameworks",
"Typing :: Typed",
] ]
requires-python = ">=3.8" requires-python = ">=3.8"
dependencies = [ dependencies = [
@ -32,8 +33,7 @@ dependencies = [
Donate = "https://palletsprojects.com/donate" Donate = "https://palletsprojects.com/donate"
Documentation = "https://flask.palletsprojects.com/" Documentation = "https://flask.palletsprojects.com/"
Changes = "https://flask.palletsprojects.com/changes/" Changes = "https://flask.palletsprojects.com/changes/"
"Source Code" = "https://github.com/pallets/flask/" Source = "https://github.com/pallets/flask/"
"Issue Tracker" = "https://github.com/pallets/flask/issues/"
Chat = "https://discord.gg/pallets" Chat = "https://discord.gg/pallets"
[project.optional-dependencies] [project.optional-dependencies]
@ -93,11 +93,16 @@ module = [
] ]
ignore_missing_imports = true ignore_missing_imports = true
[tool.pyright]
pythonVersion = "3.8"
include = ["src/flask", "tests"]
typeCheckingMode = "basic"
[tool.ruff] [tool.ruff]
src = ["src"] src = ["src"]
fix = true fix = true
show-fixes = true show-fixes = true
show-source = true output-format = "full"
[tool.ruff.lint] [tool.ruff.lint]
select = [ select = [

View File

@ -1,12 +1,12 @@
# #
# This file is autogenerated by pip-compile with Python 3.11 # This file is autogenerated by pip-compile with Python 3.12
# by the following command: # by the following command:
# #
# pip-compile build.in # pip-compile build.in
# #
build==1.0.3 build==1.2.1
# via -r build.in # via -r build.in
packaging==23.2 packaging==24.0
# via build # via build
pyproject-hooks==1.0.0 pyproject-hooks==1.0.0
# via build # via build

View File

@ -1,6 +1,5 @@
-r docs.in -r docs.txt
-r tests.in -r tests.txt
-r typing.in -r typing.txt
pip-tools
pre-commit pre-commit
tox tox

View File

@ -1,151 +1,195 @@
# #
# This file is autogenerated by pip-compile with Python 3.11 # This file is autogenerated by pip-compile with Python 3.12
# by the following command: # by the following command:
# #
# pip-compile dev.in # pip-compile dev.in
# #
alabaster==0.7.16 alabaster==0.7.16
# via sphinx
asgiref==3.7.2
# via # via
# -r tests.in # -r docs.txt
# -r typing.in # sphinx
asgiref==3.8.1
# via
# -r tests.txt
# -r typing.txt
babel==2.14.0 babel==2.14.0
# via sphinx # via
build==1.0.3 # -r docs.txt
# via pip-tools # sphinx
cachetools==5.3.2 cachetools==5.3.3
# via tox # via tox
certifi==2023.11.17 certifi==2024.2.2
# via requests # via
# -r docs.txt
# requests
cffi==1.16.0 cffi==1.16.0
# via cryptography # via
# -r typing.txt
# cryptography
cfgv==3.4.0 cfgv==3.4.0
# via pre-commit # via pre-commit
chardet==5.2.0 chardet==5.2.0
# via tox # via tox
charset-normalizer==3.3.2 charset-normalizer==3.3.2
# via requests # via
click==8.1.7 # -r docs.txt
# via pip-tools # requests
colorama==0.4.6 colorama==0.4.6
# via tox # via tox
cryptography==41.0.7 cryptography==42.0.5
# via -r typing.in # via -r typing.txt
distlib==0.3.8 distlib==0.3.8
# via virtualenv # via virtualenv
docutils==0.18.1 docutils==0.20.1
# via # via
# -r docs.txt
# sphinx # sphinx
# sphinx-tabs # sphinx-tabs
filelock==3.13.1 filelock==3.13.3
# via # via
# tox # tox
# virtualenv # virtualenv
identify==2.5.33 identify==2.5.35
# via pre-commit # via pre-commit
idna==3.6 idna==3.6
# via requests
imagesize==1.4.1
# via sphinx
iniconfig==2.0.0
# via pytest
jinja2==3.1.3
# via sphinx
markupsafe==2.1.3
# via jinja2
mypy==1.8.0
# via -r typing.in
mypy-extensions==1.0.0
# via mypy
nodeenv==1.8.0
# via pre-commit
packaging==23.2
# via # via
# build # -r docs.txt
# requests
imagesize==1.4.1
# via
# -r docs.txt
# sphinx
iniconfig==2.0.0
# via
# -r tests.txt
# -r typing.txt
# pytest
jinja2==3.1.3
# via
# -r docs.txt
# sphinx
markupsafe==2.1.5
# via
# -r docs.txt
# jinja2
mypy==1.9.0
# via -r typing.txt
mypy-extensions==1.0.0
# via
# -r typing.txt
# mypy
nodeenv==1.8.0
# via
# -r typing.txt
# pre-commit
# pyright
packaging==24.0
# via
# -r docs.txt
# -r tests.txt
# -r typing.txt
# pallets-sphinx-themes # pallets-sphinx-themes
# pyproject-api # pyproject-api
# pytest # pytest
# sphinx # sphinx
# tox # tox
pallets-sphinx-themes==2.1.1 pallets-sphinx-themes==2.1.1
# via -r docs.in # via -r docs.txt
pip-tools==7.3.0 platformdirs==4.2.0
# via -r dev.in
platformdirs==4.1.0
# via # via
# tox # tox
# virtualenv # virtualenv
pluggy==1.3.0 pluggy==1.4.0
# via # via
# -r tests.txt
# -r typing.txt
# pytest # pytest
# tox # tox
pre-commit==3.6.0 pre-commit==3.7.0
# via -r dev.in # via -r dev.in
pycparser==2.21 pycparser==2.22
# via cffi # via
# -r typing.txt
# cffi
pygments==2.17.2 pygments==2.17.2
# via # via
# -r docs.txt
# sphinx # sphinx
# sphinx-tabs # sphinx-tabs
pyproject-api==1.6.1 pyproject-api==1.6.1
# via tox # via tox
pyproject-hooks==1.0.0 pyright==1.1.357
# via build # via -r typing.txt
pytest==7.4.4 pytest==8.1.1
# via -r tests.in
python-dotenv==1.0.0
# via # via
# -r tests.in # -r tests.txt
# -r typing.in # -r typing.txt
python-dotenv==1.0.1
# via
# -r tests.txt
# -r typing.txt
pyyaml==6.0.1 pyyaml==6.0.1
# via pre-commit # via pre-commit
requests==2.31.0 requests==2.31.0
# via sphinx # via
# -r docs.txt
# sphinx
snowballstemmer==2.2.0 snowballstemmer==2.2.0
# via sphinx # via
# -r docs.txt
# sphinx
sphinx==7.2.6 sphinx==7.2.6
# via # via
# -r docs.in # -r docs.txt
# pallets-sphinx-themes # pallets-sphinx-themes
# sphinx-issues
# sphinx-tabs # sphinx-tabs
# sphinxcontrib-log-cabinet # sphinxcontrib-log-cabinet
sphinx-issues==3.0.1 sphinx-tabs==3.4.5
# via -r docs.in # via -r docs.txt
sphinx-tabs==3.4.4
# via -r docs.in
sphinxcontrib-applehelp==1.0.8 sphinxcontrib-applehelp==1.0.8
# via sphinx # via
# -r docs.txt
# sphinx
sphinxcontrib-devhelp==1.0.6 sphinxcontrib-devhelp==1.0.6
# via sphinx # via
# -r docs.txt
# sphinx
sphinxcontrib-htmlhelp==2.0.5 sphinxcontrib-htmlhelp==2.0.5
# via sphinx # via
# -r docs.txt
# sphinx
sphinxcontrib-jsmath==1.0.1 sphinxcontrib-jsmath==1.0.1
# via sphinx # via
# -r docs.txt
# sphinx
sphinxcontrib-log-cabinet==1.0.1 sphinxcontrib-log-cabinet==1.0.1
# via -r docs.in # via -r docs.txt
sphinxcontrib-qthelp==1.0.7 sphinxcontrib-qthelp==1.0.7
# via sphinx # via
# -r docs.txt
# sphinx
sphinxcontrib-serializinghtml==1.1.10 sphinxcontrib-serializinghtml==1.1.10
# via sphinx # via
tox==4.12.0 # -r docs.txt
# sphinx
tox==4.14.2
# via -r dev.in # via -r dev.in
types-contextvars==2.4.7.3 types-contextvars==2.4.7.3
# via -r typing.in # via -r typing.txt
types-dataclasses==0.6.6 types-dataclasses==0.6.6
# via -r typing.in # via -r typing.txt
typing-extensions==4.9.0 typing-extensions==4.11.0
# via mypy # via
urllib3==2.1.0 # -r typing.txt
# via requests # mypy
virtualenv==20.25.0 urllib3==2.2.1
# via
# -r docs.txt
# requests
virtualenv==20.25.1
# via # via
# pre-commit # pre-commit
# tox # tox
wheel==0.42.0
# via pip-tools
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools # setuptools

View File

@ -1,5 +1,4 @@
pallets-sphinx-themes pallets-sphinx-themes
sphinx sphinx
sphinx-issues
sphinxcontrib-log-cabinet sphinxcontrib-log-cabinet
sphinx-tabs sphinx-tabs

View File

@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile with Python 3.11 # This file is autogenerated by pip-compile with Python 3.12
# by the following command: # by the following command:
# #
# pip-compile docs.in # pip-compile docs.in
@ -8,11 +8,11 @@ alabaster==0.7.16
# via sphinx # via sphinx
babel==2.14.0 babel==2.14.0
# via sphinx # via sphinx
certifi==2023.11.17 certifi==2024.2.2
# via requests # via requests
charset-normalizer==3.3.2 charset-normalizer==3.3.2
# via requests # via requests
docutils==0.18.1 docutils==0.20.1
# via # via
# sphinx # sphinx
# sphinx-tabs # sphinx-tabs
@ -22,9 +22,9 @@ imagesize==1.4.1
# via sphinx # via sphinx
jinja2==3.1.3 jinja2==3.1.3
# via sphinx # via sphinx
markupsafe==2.1.3 markupsafe==2.1.5
# via jinja2 # via jinja2
packaging==23.2 packaging==24.0
# via # via
# pallets-sphinx-themes # pallets-sphinx-themes
# sphinx # sphinx
@ -42,12 +42,9 @@ sphinx==7.2.6
# via # via
# -r docs.in # -r docs.in
# pallets-sphinx-themes # pallets-sphinx-themes
# sphinx-issues
# sphinx-tabs # sphinx-tabs
# sphinxcontrib-log-cabinet # sphinxcontrib-log-cabinet
sphinx-issues==3.0.1 sphinx-tabs==3.4.5
# via -r docs.in
sphinx-tabs==3.4.4
# via -r docs.in # via -r docs.in
sphinxcontrib-applehelp==1.0.8 sphinxcontrib-applehelp==1.0.8
# via sphinx # via sphinx
@ -63,5 +60,5 @@ sphinxcontrib-qthelp==1.0.7
# via sphinx # via sphinx
sphinxcontrib-serializinghtml==1.1.10 sphinxcontrib-serializinghtml==1.1.10
# via sphinx # via sphinx
urllib3==2.1.0 urllib3==2.2.1
# via requests # via requests

View File

@ -1,18 +1,18 @@
# #
# This file is autogenerated by pip-compile with Python 3.11 # This file is autogenerated by pip-compile with Python 3.12
# by the following command: # by the following command:
# #
# pip-compile tests.in # pip-compile tests.in
# #
asgiref==3.7.2 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==23.2 packaging==24.0
# via pytest # via pytest
pluggy==1.3.0 pluggy==1.4.0
# via pytest # via pytest
pytest==7.4.4 pytest==8.1.1
# via -r tests.in # via -r tests.in
python-dotenv==1.0.0 python-dotenv==1.0.1
# via -r tests.in # via -r tests.in

View File

@ -1,4 +1,6 @@
mypy mypy
pyright
pytest
types-contextvars types-contextvars
types-dataclasses types-dataclasses
asgiref asgiref

View File

@ -1,26 +1,41 @@
# #
# This file is autogenerated by pip-compile with Python 3.11 # This file is autogenerated by pip-compile with Python 3.12
# by the following command: # by the following command:
# #
# pip-compile typing.in # pip-compile typing.in
# #
asgiref==3.7.2 asgiref==3.8.1
# via -r typing.in # via -r typing.in
cffi==1.16.0 cffi==1.16.0
# via cryptography # via cryptography
cryptography==41.0.7 cryptography==42.0.5
# via -r typing.in # via -r typing.in
mypy==1.8.0 iniconfig==2.0.0
# via pytest
mypy==1.9.0
# via -r typing.in # via -r typing.in
mypy-extensions==1.0.0 mypy-extensions==1.0.0
# via mypy # via mypy
pycparser==2.21 nodeenv==1.8.0
# via pyright
packaging==24.0
# via pytest
pluggy==1.4.0
# via pytest
pycparser==2.22
# via cffi # via cffi
python-dotenv==1.0.0 pyright==1.1.357
# via -r typing.in
pytest==8.1.1
# via -r typing.in
python-dotenv==1.0.1
# via -r typing.in # via -r typing.in
types-contextvars==2.4.7.3 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.9.0 typing-extensions==4.11.0
# via mypy # via mypy
# The following packages are considered to be unsafe in a requirements file:
# setuptools

View File

@ -229,15 +229,13 @@ def prepare_import(path: str) -> str:
@t.overload @t.overload
def locate_app( def locate_app(
module_name: str, app_name: str | None, raise_if_not_found: t.Literal[True] = True module_name: str, app_name: str | None, raise_if_not_found: t.Literal[True] = True
) -> Flask: ) -> Flask: ...
...
@t.overload @t.overload
def locate_app( def locate_app(
module_name: str, app_name: str | None, raise_if_not_found: t.Literal[False] = ... module_name: str, app_name: str | None, raise_if_not_found: t.Literal[False] = ...
) -> Flask | None: ) -> Flask | None: ...
...
def locate_app( def locate_app(

View File

@ -27,12 +27,10 @@ class ConfigAttribute(t.Generic[T]):
self.get_converter = get_converter self.get_converter = get_converter
@t.overload @t.overload
def __get__(self, obj: None, owner: None) -> te.Self: def __get__(self, obj: None, owner: None) -> te.Self: ...
...
@t.overload @t.overload
def __get__(self, obj: App, owner: type[App]) -> T: def __get__(self, obj: App, owner: type[App]) -> T: ...
...
def __get__(self, obj: App | None, owner: type[App] | None = None) -> T | te.Self: def __get__(self, obj: App | None, owner: type[App] | None = None) -> T | te.Self:
if obj is None: if obj is None:

View File

@ -40,6 +40,7 @@ be processed before ``dict``.
app.session_interface.serializer.register(TagOrderedDict, index=0) app.session_interface.serializer.register(TagOrderedDict, index=0)
""" """
from __future__ import annotations from __future__ import annotations
import typing as t import typing as t

View File

@ -176,7 +176,7 @@ def test_jsonify_aware_datetimes(tz):
def test_jsonify_uuid_types(app, client): def test_jsonify_uuid_types(app, client):
"""Test jsonify with uuid.UUID types""" """Test jsonify with uuid.UUID types"""
test_uuid = uuid.UUID(bytes=b"\xDE\xAD\xBE\xEF" * 4) test_uuid = uuid.UUID(bytes=b"\xde\xad\xbe\xef" * 4)
url = "/uuid_test" url = "/uuid_test"
app.add_url_rule(url, url, lambda: flask.jsonify(x=test_uuid)) app.add_url_rule(url, url, lambda: flask.jsonify(x=test_uuid))

View File

@ -17,20 +17,16 @@ async def after_async(response: Response) -> Response:
@app.before_request @app.before_request
def before_sync() -> None: def before_sync() -> None: ...
...
@app.before_request @app.before_request
async def before_async() -> None: async def before_async() -> None: ...
...
@app.teardown_appcontext @app.teardown_appcontext
def teardown_sync(exc: BaseException | None) -> None: def teardown_sync(exc: BaseException | None) -> None: ...
...
@app.teardown_appcontext @app.teardown_appcontext
async def teardown_async(exc: BaseException | None) -> None: async def teardown_async(exc: BaseException | None) -> None: ...
...

20
tox.ini
View File

@ -2,7 +2,7 @@
envlist = envlist =
py3{12,11,10,9,8} py3{12,11,10,9,8}
pypy310 pypy310
py311-min py312-min
py38-dev py38-dev
style style
typing typing
@ -19,7 +19,7 @@ deps =
-r requirements/tests.txt -r requirements/tests.txt
min: -r requirements-skip/tests-min.txt min: -r requirements-skip/tests-min.txt
dev: -r requirements-skip/tests-dev.txt dev: -r requirements-skip/tests-dev.txt
commands = pytest -v --tb=short --basetemp={envtmpdir} {posargs:tests} commands = pytest -v --tb=short --basetemp={envtmpdir} {posargs}
[testenv:style] [testenv:style]
deps = pre-commit deps = pre-commit
@ -32,4 +32,18 @@ commands = mypy
[testenv:docs] [testenv:docs]
deps = -r requirements/docs.txt deps = -r requirements/docs.txt
commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html commands = sphinx-build -W -b dirhtml docs docs/_build/dirhtml
[testenv:update-requirements]
deps =
pip-tools
pre-commit
skip_install = true
change_dir = requirements
commands =
pre-commit autoupdate -j4
pip-compile -U build.in
pip-compile -U docs.in
pip-compile -U tests.in
pip-compile -U typing.in
pip-compile -U dev.in