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
13 changes: 4 additions & 9 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand All @@ -30,16 +30,11 @@ jobs:
- name: Install dependencies
run: |
poetry install --all-extras # also tests asymmetric with cryptography
pip install flake8 # for linting

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 fastapi_login examples tests --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 fastapi_login examples tests --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Lint
run: poetry run ruff format && poetry run ruff check

- name: Test with pytest
- name: Test
working-directory: ./tests
run: poetry run pytest

Expand Down
8 changes: 8 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extend-exclude = ["docs_src/", "examples/"]
line-length = 88

[lint]
ignore = ["E501", "W605", "E203"]

[lint.mccabe]
max-complexity = 10
26 changes: 13 additions & 13 deletions examples/full-example/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
annotated-types==0.7.0 ; python_version >= "3.8" and python_version < "4.0"
anyio==4.4.0 ; python_version >= "3.8" and python_version < "4.0"
bcrypt==4.2.0 ; python_version >= "3.8" and python_version < "4.0"
anyio==4.5.2 ; python_version >= "3.8" and python_version < "4.0"
bcrypt==4.2.1 ; python_version >= "3.8" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.8" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.8" and python_version < "4.0" and platform_system == "Windows"
dnspython==2.6.1 ; python_version >= "3.8" and python_version < "4.0"
email-validator==2.2.0 ; python_version >= "3.8" and python_version < "4.0"
exceptiongroup==1.2.2 ; python_version >= "3.8" and python_version < "3.11"
fastapi==0.115.0 ; python_version >= "3.8" and python_version < "4.0"
greenlet==3.1.0 ; python_version < "3.13" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and python_version >= "3.8"
fastapi==0.115.6 ; python_version >= "3.8" and python_version < "4.0"
greenlet==3.1.1 ; python_version < "3.13" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and python_version >= "3.8"
h11==0.14.0 ; python_version >= "3.8" and python_version < "4.0"
idna==3.10 ; python_version >= "3.8" and python_version < "4.0"
mypy-extensions==1.0.0 ; python_version >= "3.8" and python_version < "4.0"
mypy==1.11.2 ; python_version >= "3.8" and python_version < "4.0"
mypy==1.13.0 ; python_version >= "3.8" and python_version < "4.0"
passlib[bcrypt]==1.7.4 ; python_version >= "3.8" and python_version < "4.0"
pydantic-core==2.23.4 ; python_version >= "3.8" and python_version < "4.0"
pydantic-settings==2.5.2 ; python_version >= "3.8" and python_version < "4.0"
pydantic==2.9.2 ; python_version >= "3.8" and python_version < "4.0"
pydantic-core==2.27.1 ; python_version >= "3.8" and python_version < "4.0"
pydantic-settings==2.6.1 ; python_version >= "3.8" and python_version < "4.0"
pydantic==2.10.3 ; python_version >= "3.8" and python_version < "4.0"
pyjwt==2.9.0 ; python_version >= "3.8" and python_version < "4.0"
python-dotenv==1.0.1 ; python_version >= "3.8" and python_version < "4.0"
python-multipart==0.0.9 ; python_version >= "3.8" and python_version < "4.0"
python-multipart==0.0.19 ; python_version >= "3.8" and python_version < "4.0"
sniffio==1.3.1 ; python_version >= "3.8" and python_version < "4.0"
sqlalchemy-stubs==0.4 ; python_version >= "3.8" and python_version < "4.0"
sqlalchemy==2.0.35 ; python_version >= "3.8" and python_version < "4.0"
starlette==0.38.5 ; python_version >= "3.8" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.8" and python_version < "3.11"
sqlalchemy==2.0.36 ; python_version >= "3.8" and python_version < "4.0"
starlette==0.41.3 ; python_version >= "3.8" and python_version < "4.0"
tomli==2.2.1 ; python_version >= "3.8" and python_version < "3.11"
typing-extensions==4.12.2 ; python_version >= "3.8" and python_version < "4.0"
uvicorn==0.30.6 ; python_version >= "3.8" and python_version < "4.0"
uvicorn==0.32.1 ; python_version >= "3.8" and python_version < "4.0"
26 changes: 13 additions & 13 deletions examples/simple/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
annotated-types==0.7.0 ; python_version >= "3.8" and python_version < "4.0"
anyio==4.4.0 ; python_version >= "3.8" and python_version < "4.0"
bcrypt==4.2.0 ; python_version >= "3.8" and python_version < "4.0"
anyio==4.5.2 ; python_version >= "3.8" and python_version < "4.0"
bcrypt==4.2.1 ; python_version >= "3.8" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.8" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.8" and python_version < "4.0" and platform_system == "Windows"
dnspython==2.6.1 ; python_version >= "3.8" and python_version < "4.0"
email-validator==2.2.0 ; python_version >= "3.8" and python_version < "4.0"
exceptiongroup==1.2.2 ; python_version >= "3.8" and python_version < "3.11"
fastapi==0.115.0 ; python_version >= "3.8" and python_version < "4.0"
greenlet==3.1.0 ; python_version < "3.13" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and python_version >= "3.8"
fastapi==0.115.6 ; python_version >= "3.8" and python_version < "4.0"
greenlet==3.1.1 ; python_version < "3.13" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and python_version >= "3.8"
h11==0.14.0 ; python_version >= "3.8" and python_version < "4.0"
idna==3.10 ; python_version >= "3.8" and python_version < "4.0"
mypy-extensions==1.0.0 ; python_version >= "3.8" and python_version < "4.0"
mypy==1.11.2 ; python_version >= "3.8" and python_version < "4.0"
mypy==1.13.0 ; python_version >= "3.8" and python_version < "4.0"
passlib[bcrypt]==1.7.4 ; python_version >= "3.8" and python_version < "4.0"
pydantic-core==2.23.4 ; python_version >= "3.8" and python_version < "4.0"
pydantic-settings==2.5.2 ; python_version >= "3.8" and python_version < "4.0"
pydantic==2.9.2 ; python_version >= "3.8" and python_version < "4.0"
pydantic-core==2.27.1 ; python_version >= "3.8" and python_version < "4.0"
pydantic-settings==2.6.1 ; python_version >= "3.8" and python_version < "4.0"
pydantic==2.10.3 ; python_version >= "3.8" and python_version < "4.0"
pyjwt==2.9.0 ; python_version >= "3.8" and python_version < "4.0"
python-dotenv==1.0.1 ; python_version >= "3.8" and python_version < "4.0"
python-multipart==0.0.9 ; python_version >= "3.8" and python_version < "4.0"
python-multipart==0.0.19 ; python_version >= "3.8" and python_version < "4.0"
sniffio==1.3.1 ; python_version >= "3.8" and python_version < "4.0"
sqlalchemy-stubs==0.4 ; python_version >= "3.8" and python_version < "4.0"
sqlalchemy==2.0.35 ; python_version >= "3.8" and python_version < "4.0"
starlette==0.38.5 ; python_version >= "3.8" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.8" and python_version < "3.11"
sqlalchemy==2.0.36 ; python_version >= "3.8" and python_version < "4.0"
starlette==0.41.3 ; python_version >= "3.8" and python_version < "4.0"
tomli==2.2.1 ; python_version >= "3.8" and python_version < "3.11"
typing-extensions==4.12.2 ; python_version >= "3.8" and python_version < "4.0"
uvicorn==0.30.6 ; python_version >= "3.8" and python_version < "4.0"
uvicorn==0.32.1 ; python_version >= "3.8" and python_version < "4.0"
26 changes: 13 additions & 13 deletions examples/sqlalchemy/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
annotated-types==0.7.0 ; python_version >= "3.8" and python_version < "4.0"
anyio==4.4.0 ; python_version >= "3.8" and python_version < "4.0"
bcrypt==4.2.0 ; python_version >= "3.8" and python_version < "4.0"
anyio==4.5.2 ; python_version >= "3.8" and python_version < "4.0"
bcrypt==4.2.1 ; python_version >= "3.8" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.8" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.8" and python_version < "4.0" and platform_system == "Windows"
dnspython==2.6.1 ; python_version >= "3.8" and python_version < "4.0"
email-validator==2.2.0 ; python_version >= "3.8" and python_version < "4.0"
exceptiongroup==1.2.2 ; python_version >= "3.8" and python_version < "3.11"
fastapi==0.115.0 ; python_version >= "3.8" and python_version < "4.0"
greenlet==3.1.0 ; python_version < "3.13" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and python_version >= "3.8"
fastapi==0.115.6 ; python_version >= "3.8" and python_version < "4.0"
greenlet==3.1.1 ; python_version < "3.13" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and python_version >= "3.8"
h11==0.14.0 ; python_version >= "3.8" and python_version < "4.0"
idna==3.10 ; python_version >= "3.8" and python_version < "4.0"
mypy-extensions==1.0.0 ; python_version >= "3.8" and python_version < "4.0"
mypy==1.11.2 ; python_version >= "3.8" and python_version < "4.0"
mypy==1.13.0 ; python_version >= "3.8" and python_version < "4.0"
passlib[bcrypt]==1.7.4 ; python_version >= "3.8" and python_version < "4.0"
pydantic-core==2.23.4 ; python_version >= "3.8" and python_version < "4.0"
pydantic-settings==2.5.2 ; python_version >= "3.8" and python_version < "4.0"
pydantic==2.9.2 ; python_version >= "3.8" and python_version < "4.0"
pydantic-core==2.27.1 ; python_version >= "3.8" and python_version < "4.0"
pydantic-settings==2.6.1 ; python_version >= "3.8" and python_version < "4.0"
pydantic==2.10.3 ; python_version >= "3.8" and python_version < "4.0"
pyjwt==2.9.0 ; python_version >= "3.8" and python_version < "4.0"
python-dotenv==1.0.1 ; python_version >= "3.8" and python_version < "4.0"
python-multipart==0.0.9 ; python_version >= "3.8" and python_version < "4.0"
python-multipart==0.0.19 ; python_version >= "3.8" and python_version < "4.0"
sniffio==1.3.1 ; python_version >= "3.8" and python_version < "4.0"
sqlalchemy-stubs==0.4 ; python_version >= "3.8" and python_version < "4.0"
sqlalchemy==2.0.35 ; python_version >= "3.8" and python_version < "4.0"
starlette==0.38.5 ; python_version >= "3.8" and python_version < "4.0"
tomli==2.0.1 ; python_version >= "3.8" and python_version < "3.11"
sqlalchemy==2.0.36 ; python_version >= "3.8" and python_version < "4.0"
starlette==0.41.3 ; python_version >= "3.8" and python_version < "4.0"
tomli==2.2.1 ; python_version >= "3.8" and python_version < "3.11"
typing-extensions==4.12.2 ; python_version >= "3.8" and python_version < "4.0"
uvicorn==0.30.6 ; python_version >= "3.8" and python_version < "4.0"
uvicorn==0.32.1 ; python_version >= "3.8" and python_version < "4.0"
8 changes: 6 additions & 2 deletions fastapi_login/fastapi_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def create_access_token(
*,
data: dict,
expires: Optional[timedelta] = None,
scopes: Optional[Collection[str]] = None
scopes: Optional[Collection[str]] = None,
) -> str:
"""
Helper function to create the encoded access token using
Expand Down Expand Up @@ -347,7 +347,11 @@ async def _get_token(self, request: Request):

return token

async def __call__(self, request: Request, security_scopes: SecurityScopes = None) -> Any: # type: ignore
async def __call__(
self,
request: Request,
security_scopes: SecurityScopes = None, # type: ignore
) -> Any:
"""
Provides the functionality to act as a Dependency

Expand Down
Loading
Loading