diff --git a/.github/workflows/python-publish.yml b/.github/workflows/cd.yml similarity index 60% rename from .github/workflows/python-publish.yml rename to .github/workflows/cd.yml index 2e83191..35875b7 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/cd.yml @@ -1,7 +1,4 @@ -# This workflows will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -name: Upload Python Package +name: Publish on: release: @@ -18,7 +15,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.13" cache: "poetry" - name: Setup poetry diff --git a/.github/workflows/python-tests.yml b/.github/workflows/ci.yml similarity index 77% rename from .github/workflows/python-tests.yml rename to .github/workflows/ci.yml index 64c92e9..fe2ad5e 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,4 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python package +name: Build on: push: @@ -41,3 +38,4 @@ jobs: - name: Test pydantic v1 compatibility working-directory: ./tests run: poetry run pip install 'pydantic<2' && poetry run pytest + - run: poetry build diff --git a/CHANGELOG.md b/CHANGELOG.md index 782818d..6571776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.10.3 + +- Bump dependencies + ## 1.10.2 - Bump dependencies diff --git a/README.md b/README.md index 5116e99..2e333b5 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ pip install fastapi-login ## Usage -To begin we have to setup our FastAPI app: +To begin we have to set up our FastAPI app: ```python from fastapi import FastAPI @@ -31,10 +31,9 @@ SECRET = 'your-secret-key' app = FastAPI() ``` -To obtain a suitable secret key you can run ``import os; print(os.urandom(24).hex())``. +To obtain a suitable secret key you can run `import secrets; secrets.token_hex(24)`. -Now we can import and setup the LoginManager, which will handle the process of -encoding and decoding our Json Web Tokens. +Now we can import and setup the `LoginManager`, which will handle the process of encoding and decoding our Json Web Tokens. ```python from fastapi_login import LoginManager @@ -114,7 +113,7 @@ app.add_exception_handler(NotAuthenticatedException, exc_handler) ``` To change the expiration date of the token use the ``expires_delta`` argument of the `create_access_token` method -with a timedelta. The default is set 15 min. Please be aware that setting a long expiry date is not considered a good practice +with `timedelta`. The default is set 15 min. Please be aware that setting a long expiry date is not considered a good practice as it would allow an attacker with the token to use your application as long as he wants. ```python @@ -161,5 +160,4 @@ def auth(response: Response, user=Depends(manager)): ) manager.set_cookie(response, token) return response - ``` diff --git a/poetry.lock b/poetry.lock index 4802986..c0f50a7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2018,4 +2018,4 @@ asymmetric = ["cryptography"] [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "13ab9550af5bdf1dddfa8ec4921490df3148aff68637650623d571e6d2a1fc99" +content-hash = "9622f6d4055fc7a83f876be53d785f404dbab28ca2fe795ef17f8a737ac63951" diff --git a/pyproject.toml b/pyproject.toml index 8d8bb4e..2ba9526 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ ruff = "^0.8.2" [tool.poetry.group.test.dependencies] async-asgi-testclient = "*" -pytest = ">=7" +pytest = ">=8" pytest-asyncio = "*" pytest-lazy-fixtures = "^1.1.1"