Skip to content

Commit

Permalink
Fix mypy complaints, add 3.11 in test matrix, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
dorinclisu committed Mar 9, 2023
1 parent 040fc31 commit 523fcda
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10']
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -34,6 +34,7 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Check with mypy
run: |
mypy --version
mypy tests --namespace-packages
- name: Test with pytest
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10']
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -29,4 +29,5 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Check with mypy
run: |
mypy --version
mypy tests --namespace-packages
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name='fastapi-auth0',
version='0.3.2',
version='0.4.0',
description='Easy auth0.com integration for FastAPI',
long_description=readme,
long_description_content_type='text/markdown',
Expand Down
6 changes: 3 additions & 3 deletions src/fastapi_auth0/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from fastapi import HTTPException, Depends, Request
from fastapi.security import SecurityScopes, HTTPBearer, HTTPAuthorizationCredentials
from fastapi.security import OAuth2, OAuth2PasswordBearer, OAuth2AuthorizationCodeBearer, OpenIdConnect
from fastapi.openapi.models import OAuthFlows
from fastapi.openapi.models import OAuthFlows, OAuthFlowImplicit
from pydantic import BaseModel, Field, ValidationError
from typing_extensions import TypedDict

Expand Down Expand Up @@ -40,7 +40,7 @@ class HTTPAuth0Error(BaseModel):
class Auth0User(BaseModel):
id: str = Field(..., alias='sub')
permissions: Optional[List[str]]
email: Optional[str] = Field(None, alias=f'{auth0_rule_namespace}/email')
email: Optional[str] = Field(None, alias=f'{auth0_rule_namespace}/email') # type: ignore [literal-required]


class Auth0HTTPBearer(HTTPBearer):
Expand All @@ -53,7 +53,7 @@ def __init__(self,
scopes: Dict[str, str]={},
scheme_name: Optional[str]=None,
auto_error: bool=True):
flows = OAuthFlows(implicit={'authorizationUrl': authorizationUrl, 'scopes': scopes})
flows = OAuthFlows(implicit=OAuthFlowImplicit(authorizationUrl=authorizationUrl, scopes=scopes))
super().__init__(flows=flows, scheme_name=scheme_name, auto_error=auto_error)

async def __call__(self, request: Request) -> Optional[str]:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Env(BaseSettings):

auth0_test_permission: str

env = Env()
env = Env() # type: ignore [call-arg]

###############################################################################
class CustomAuth0User(Auth0User):
Expand Down

0 comments on commit 523fcda

Please sign in to comment.