Skip to content

Commit

Permalink
Merge branch 'pgjones:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
iasukas authored Apr 12, 2024
2 parents a59fa9d + dec9fde commit ecd6c9d
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 19 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:
fail-fast: false
matrix:
include:
- {name: '3.12', python: '3.12', tox: py312}
- {name: '3.11', python: '3.11', tox: py311}
- {name: '3.10', python: '3.10', tox: py310}
- {name: '3.9', python: '3.9', tox: py39}
- {name: '3.8', python: '3.8', tox: py38}
- {name: '3.7', python: '3.7', tox: py37}
- {name: 'format', python: '3.11', tox: format}
- {name: 'mypy', python: '3.11', tox: mypy}
- {name: 'pep8', python: '3.11', tox: pep8}
- {name: 'package', python: '3.11', tox: package}
- {name: 'format', python: '3.12', tox: format}
- {name: 'mypy', python: '3.12', tox: mypy}
- {name: 'pep8', python: '3.12', tox: pep8}
- {name: 'package', python: '3.12', tox: package}

steps:
- uses: actions/checkout@v3
Expand All @@ -38,7 +38,7 @@ jobs:
redis-tox:
runs-on: ubuntu-latest

container: python:3.11
container: python:3.12

services:
redis:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v3
with:
python-version: 3.12

- run: |
pip install poetry
poetry build
- uses: actions/upload-artifact@v3
with:
path: ./dist

pypi-publish:
needs: ['build']
environment: 'publish'

name: upload release to PyPI
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v3

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: artifact/
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.9.0 2023-10-07
----------------

* Officially support Python 3.12 drop Python 3.7.
* Support Quart 0.19 onwards.

0.8.0 2023-01-21
----------------

Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "quart-rate-limiter"
version = "0.8.0"
version = "0.9.0"
description = "A Quart extension to provide rate limiting support"
authors = ["pgjones <philip.graham.jones@googlemail.com>"]
classifiers = [
Expand All @@ -11,11 +11,11 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"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",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries :: Python Modules",
]
Expand All @@ -26,7 +26,7 @@ repository = "https://github.com/pgjones/quart-rate-limiter/"

[tool.black]
line-length = 100
target-version = ["py37"]
target-version = ["py38"]

[tool.isort]
combine_as_imports = true
Expand Down Expand Up @@ -61,8 +61,8 @@ module =["redis.*"]
ignore_missing_imports = true

[tool.poetry.dependencies]
python = ">=3.7"
quart = ">=0.15"
python = ">=3.8"
quart = ">=0.19"
redis = { version = ">=4.4.0", optional = true }

[tool.poetry.dev-dependencies]
Expand Down
5 changes: 3 additions & 2 deletions src/quart_rate_limiter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from datetime import datetime, timedelta
from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple, TypeVar, Union

from quart import Blueprint, current_app, Quart, request, Response
from flask.sansio.blueprints import Blueprint
from quart import current_app, Quart, request, Response
from quart.typing import RouteCallable, WebsocketCallable
from werkzeug.exceptions import TooManyRequests

Expand Down Expand Up @@ -103,7 +104,7 @@ def decorator(func: T) -> T:
return decorator


def rate_exempt(func: Callable) -> Callable:
def rate_exempt(func: T) -> T:
"""A decorator to mark the route as exempt from rate limits.
This should be used to wrap a route handler (or view function) to
Expand Down
12 changes: 6 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = format,mypy,py37,py38,py39,py310,py311,pep8,package
envlist = format,mypy,py38,py39,py310,py311,py312,pep8,package
isolated_build = True

[testenv]
Expand All @@ -12,7 +12,7 @@ deps =
commands = pytest --cov=quart_rate_limiter {posargs}

[testenv:redis]
basepython = python3.11
basepython = python3.12
deps =
redis
pytest
Expand All @@ -22,7 +22,7 @@ deps =
commands = pytest --cov=quart_rate_limiter --redis-host="redis" {posargs}

[testenv:format]
basepython = python3.11
basepython = python3.12
deps =
black
isort
Expand All @@ -31,15 +31,15 @@ commands =
isort --check --diff src/quart_rate_limiter/ tests

[testenv:pep8]
basepython = python3.11
basepython = python3.12
deps =
flake8
pep8-naming
flake8-print
commands = flake8 src/quart_rate_limiter/ tests/

[testenv:mypy]
basepython = python3.11
basepython = python3.12
deps =
redis
mypy
Expand All @@ -48,7 +48,7 @@ commands =
mypy src/quart_rate_limiter/ tests/

[testenv:package]
basepython = python3.11
basepython = python3.12
deps =
poetry
twine
Expand Down

0 comments on commit ecd6c9d

Please sign in to comment.