Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
version: 2
updates:
- package-ecosystem: pip
- package-ecosystem: uv
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
interval: monthly
groups:
all-dependencies:
patterns: ["*"]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
groups:
all-actions:
patterns: ["*"]
74 changes: 43 additions & 31 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,57 @@ jobs:
fail-fast: false
matrix:
include:
- { name: "3.8", python: "3.8", tox: py38 }
- { name: "lowest", python: "3.8", tox: py38-lowest }
- { name: "3.12-apispecdev", python: "3.12", tox: py312-apispecdev }
- { name: "3.10", tox: py310 }
- { name: "3.14", tox: py314 }
- { name: "lowest", tox: py310-lowest }
- { name: "3.14-apispecdev", tox: py314-apispecdev }
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/setup-python@v4.3.0
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python }}
- run: python -m pip install --upgrade pip
- run: python -m pip install tox
- run: python -m tox -e ${{ matrix.tox }}

enable-cache: true
- run: uv run tox -e ${{ matrix.tox }}
build:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- run: uv build
- run: uvx twine check --strict dist/*
- name: Store the distribution packages
uses: actions/upload-artifact@v7
with:
name: python-package-distributions
path: dist/
# this duplicates pre-commit.ci, so only run it on tags
# it guarantees that linting is passing prior to a release
lint-pre-release:
name: lint
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/setup-python@v4.3.0
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"
- run: python -m pip install --upgrade pip
- run: python -m pip install tox
- run: python -m tox -e lint
release:
needs: [tests, lint-pre-release]
enable-cache: true
- run: uv run tox -e lint
publish-to-pypi:
name: PyPI release
if: startsWith(github.ref, 'refs/tags')
if: startsWith(github.ref, 'refs/tags/')
needs: [build, tests, lint-pre-release]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/apispec-webframeworks
permissions:
id-token: write
steps:
- uses: actions/checkout@v3.1.0
- uses: actions/setup-python@v4.3.0
- name: Download all the dists
uses: actions/download-artifact@v7
with:
python-version: "3.11"
- name: install requirements
run: python -m pip install build twine
- name: build dists
run: python -m build
- name: check package metadata
run: twine check dist/*
- name: publish
run: twine upload -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} dist/*
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ repos:
- id: mypy
files: ^src/apispec_webframeworks/
additional_dependencies: ["Flask==2.3.3", "tornado>=6", "bottle", "apispec[yaml]>=5.2.1", types-setuptools]
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.10.9
hooks:
- id: uv-lock
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
---------

unreleased
++++++++++

Other:

* Support Python 3.10-3.14. Older versions are no longer supported.

1.2.0 (2024-09-16)
++++++++++++++++++

Expand Down
18 changes: 10 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,38 @@ name = "apispec-webframeworks"
version = "1.2.0"
description = "Web framework plugins for apispec."
readme = "README.rst"
license = { file = "LICENSE" }
maintainers = [{ name = "Steven Loria", email = "sloria1@gmail.com" }]
license = "MIT"
maintainers = [{ name = "Steven Loria", email = "oss@stevenloria.com" }]
classifiers = [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
requires-python = ">=3.8"
requires-python = ">=3.10"
dependencies = ["apispec[yaml]>=6.0.0"]

[project.urls]
Funding = "https://opencollective.com/marshmallow"
Issues = "https://github.com/marshmallow-code/apispec-webframeworks/issues"
Source = "https://github.com/marshmallow-code/apispec-webframeworks"

[project.optional-dependencies]
[dependency-groups]
tests = [
"pytest",
"Flask>=2.3.3",
"tornado>=6",
"bottle>=0.12.25",
"aiohttp>=3.9.3",
]
dev = ["apispec-webframeworks[tests]", "tox", "pre-commit>=3.5,<5.0"]
dev = [{ include-group = "tests" }, "tox", "tox-uv", "pre-commit>=3.5,<5.0"]

[tool.uv]
default-groups = ["dev"]

[build-system]
requires = ["flit_core<4"]
Expand Down
12 changes: 6 additions & 6 deletions src/apispec_webframeworks/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def hello(request):

""" # noqa: E501

from typing import Any, List, Optional
from typing import Any

from aiohttp.web import AbstractRoute
from apispec import BasePlugin, yaml_utils
Expand All @@ -52,13 +52,13 @@ async def hello(request):
class AiohttpPlugin(BasePlugin):
def path_helper(
self,
path: Optional[str] = None,
operations: Optional[dict] = None,
parameters: Optional[List[dict]] = None,
path: str | None = None,
operations: dict | None = None,
parameters: list[dict] | None = None,
*,
route: Optional[AbstractRoute] = None,
route: AbstractRoute | None = None,
**kwargs: Any,
) -> Optional[str]:
) -> str | None:
"""Path helper that allows passing a aiohttp AbstractRoute"""
assert operations is not None
assert route is not None
Expand Down
13 changes: 7 additions & 6 deletions src/apispec_webframeworks/bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def gist_detail(gist_id):
""" # noqa: E501

import re
from typing import Any, Callable, List, Optional
from collections.abc import Callable
from typing import Any

from apispec import BasePlugin, yaml_utils
from apispec.exceptions import APISpecError
Expand Down Expand Up @@ -58,13 +59,13 @@ def _route_for_view(app: Bottle, view: Callable[..., Any]) -> Route:

def path_helper(
self,
path: Optional[str] = None,
operations: Optional[dict] = None,
parameters: Optional[List[dict]] = None,
path: str | None = None,
operations: dict | None = None,
parameters: list[dict] | None = None,
*,
view: Optional[Any] = None,
view: Any | None = None,
**kwargs: Any,
) -> Optional[str]:
) -> str | None:
"""Path helper that allows passing a bottle view function."""
assert operations is not None
assert view is not None
Expand Down
17 changes: 9 additions & 8 deletions src/apispec_webframeworks/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def post(self):
""" # noqa: E501

import re
from typing import TYPE_CHECKING, Any, Callable, List, Optional, Union
from collections.abc import Callable
from typing import TYPE_CHECKING, Any, Union

from apispec import BasePlugin, yaml_utils
from apispec.exceptions import APISpecError
Expand Down Expand Up @@ -103,7 +104,7 @@ def flaskpath2openapi(path: str) -> str:
@staticmethod
def _rule_for_view(
view: Union[Callable[..., Any], "RouteCallable"],
app: Optional[Flask] = None,
app: Flask | None = None,
) -> Rule:
if app is None:
app = current_app
Expand All @@ -122,14 +123,14 @@ def _rule_for_view(

def path_helper(
self,
path: Optional[str] = None,
operations: Optional[dict] = None,
parameters: Optional[List[dict]] = None,
path: str | None = None,
operations: dict | None = None,
parameters: list[dict] | None = None,
*,
view: Optional[Union[Callable[..., Any], "RouteCallable"]] = None,
app: Optional[Flask] = None,
view: Union[Callable[..., Any], "RouteCallable"] | None = None,
app: Flask | None = None,
**kwargs: Any,
) -> Optional[str]:
) -> str | None:
"""Path helper that allows passing a Flask view function."""
assert view is not None
assert operations is not None
Expand Down
15 changes: 8 additions & 7 deletions src/apispec_webframeworks/tornado.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def get(self):
""" # noqa: E501

import inspect
from typing import Any, Callable, Dict, Iterator, List, Optional, Union, cast
from collections.abc import Callable, Iterator
from typing import Any, cast

from apispec import BasePlugin, yaml_utils
from apispec.exceptions import APISpecError
Expand All @@ -46,7 +47,7 @@ class TornadoPlugin(BasePlugin):
@staticmethod
def _operations_from_methods(
handler_class: RequestHandler,
) -> Iterator[Dict[str, dict]]:
) -> Iterator[dict[str, dict]]:
"""Generator of operations described in handler's http methods

:param handler_class:
Expand Down Expand Up @@ -103,13 +104,13 @@ def _extensions_from_handler(handler_class: RequestHandler) -> dict:

def path_helper(
self,
path: Optional[str] = None,
operations: Optional[dict] = None,
parameters: Optional[List[dict]] = None,
path: str | None = None,
operations: dict | None = None,
parameters: list[dict] | None = None,
*,
urlspec: Optional[Union[URLSpec, tuple]] = None,
urlspec: URLSpec | tuple | None = None,
**kwargs: Any,
) -> Optional[str]:
) -> str | None:
"""Path helper that allows passing a Tornado URLSpec or tuple."""
assert operations is not None
assert urlspec is not None
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[tox]
envlist=
lint
py{38,39,310,311,312}
py312-apispecdev
py38-lowest
py{310,311,312,313,314}
py314-apispecdev
py310-lowest

[testenv]
extras = tests
dependency_groups = tests
deps =
apispecdev: https://github.com/marshmallow-code/apispec/archive/dev.tar.gz
lowest: aiohttp==3.9.3
Expand Down
Loading