diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 74332a58..9dbcc2b8 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -7,25 +7,25 @@ on: jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flit - flit install --deps develop --extras oauth,redis - - name: Build - run: mkdocs build - - name: Deploy - uses: peaceiris/actions-gh-pages@v2.5.0 - env: - ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }} - PUBLISH_BRANCH: gh-pages - PUBLISH_DIR: ./site + - uses: actions/checkout@v3 + - name: Set up Python 3.7 + uses: actions/setup-python@v3 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flit + flit install --deps develop --extras oauth,redis + - name: Build + run: mkdocs build + - name: Get tag + run: | + python -c "from packaging import version; from fastapi_users import __version__; version = version.parse(__version__); print(f'DOCS_VERSION={version.major}.{version.minor}')" >> $GITHUB_ENV + - name: Deploy + run: | + git fetch origin gh-pages --depth=1 + mike deploy --push --update-aliases ${{ env.DOCS_VERSION }} latest diff --git a/docs/configuration/authentication/strategies/database.md b/docs/configuration/authentication/strategies/database.md index 2aa8cf34..58bd5972 100644 --- a/docs/configuration/authentication/strategies/database.md +++ b/docs/configuration/authentication/strategies/database.md @@ -37,12 +37,12 @@ It is structured like this: With Tortoise ORM, you need to define a proper Tortoise model for `AccessToken` and manually specify the user foreign key. Besides, you need to modify the Pydantic model a bit so that it works well with this Tortoise model. - === ":octicons-file-code-16: model.py" + === "model.py" ```py hl_lines="2 4 31-38" --8<-- "docs/src/db_tortoise_access_tokens_model.py" ``` - === ":octicons-file-code-16: adapter.py" + === "adapter.py" ```py hl_lines="2 4 13-14" --8<-- "docs/src/db_tortoise_access_tokens_adapter.py" ``` diff --git a/docs/configuration/full-example.md b/docs/configuration/full-example.md index f08beecf..a5cb56b6 100644 --- a/docs/configuration/full-example.md +++ b/docs/configuration/full-example.md @@ -8,39 +8,39 @@ Here is a full working example with JWT authentication to help get you started. ## SQLAlchemy -[Open :octicons-link-external-16:](https://github.com/fastapi-users/fastapi-users/tree/master/examples/sqlalchemy) +[Open :material-open-in-new:](https://github.com/fastapi-users/fastapi-users/tree/master/examples/sqlalchemy) -=== ":octicons-file-code-16: requirements.txt" +=== "requirements.txt" ``` --8<-- "examples/sqlalchemy/requirements.txt" ``` -=== ":octicons-file-code-16: main.py" +=== "main.py" ```py --8<-- "examples/sqlalchemy/main.py" ``` -=== ":octicons-file-code-16: app/app.py" +=== "app/app.py" ```py --8<-- "examples/sqlalchemy/app/app.py" ``` -=== ":octicons-file-code-16: app/db.py" +=== "app/db.py" ```py --8<-- "examples/sqlalchemy/app/db.py" ``` -=== ":octicons-file-code-16: app/models.py" +=== "app/models.py" ```py --8<-- "examples/sqlalchemy/app/models.py" ``` -=== ":octicons-file-code-16: app/users.py" +=== "app/users.py" ```py --8<-- "examples/sqlalchemy/app/users.py" @@ -48,39 +48,39 @@ Here is a full working example with JWT authentication to help get you started. ## MongoDB -[Open :octicons-link-external-16:](https://github.com/fastapi-users/fastapi-users/tree/master/examples/mongodb) +[Open :material-open-in-new:](https://github.com/fastapi-users/fastapi-users/tree/master/examples/mongodb) -=== ":octicons-file-code-16: requirements.txt" +=== "requirements.txt" ``` --8<-- "examples/mongodb/requirements.txt" ``` -=== ":octicons-file-code-16: main.py" +=== "main.py" ```py --8<-- "examples/mongodb/main.py" ``` -=== ":octicons-file-code-16: app/app.py" +=== "app/app.py" ```py --8<-- "examples/mongodb/app/app.py" ``` -=== ":octicons-file-code-16: app/db.py" +=== "app/db.py" ```py --8<-- "examples/mongodb/app/db.py" ``` -=== ":octicons-file-code-16: app/models.py" +=== "app/models.py" ```py --8<-- "examples/mongodb/app/models.py" ``` -=== ":octicons-file-code-16: app/users.py" +=== "app/users.py" ```py --8<-- "examples/mongodb/app/users.py" @@ -88,39 +88,39 @@ Here is a full working example with JWT authentication to help get you started. ## Tortoise ORM -[Open :octicons-link-external-16:](https://github.com/fastapi-users/fastapi-users/tree/master/examples/tortoise) +[Open :material-open-in-new:](https://github.com/fastapi-users/fastapi-users/tree/master/examples/tortoise) -=== ":octicons-file-code-16: requirements.txt" +=== "requirements.txt" ``` --8<-- "examples/tortoise/requirements.txt" ``` -=== ":octicons-file-code-16: main.py" +=== "main.py" ```py --8<-- "examples/tortoise/main.py" ``` -=== ":octicons-file-code-16: app/app.py" +=== "app/app.py" ```py --8<-- "examples/tortoise/app/app.py" ``` -=== ":octicons-file-code-16: app/db.py" +=== "app/db.py" ```py --8<-- "examples/tortoise/app/db.py" ``` -=== ":octicons-file-code-16: app/models.py" +=== "app/models.py" ```py --8<-- "examples/tortoise/app/models.py" ``` -=== ":octicons-file-code-16: app/users.py" +=== "app/users.py" ```py --8<-- "examples/tortoise/app/users.py" diff --git a/docs/configuration/oauth.md b/docs/configuration/oauth.md index e6ce5bcc..d10f9b98 100644 --- a/docs/configuration/oauth.md +++ b/docs/configuration/oauth.md @@ -123,39 +123,39 @@ app.include_router( #### SQLAlchemy -[Open :octicons-link-external-16:](https://github.com/fastapi-users/fastapi-users/tree/master/examples/sqlalchemy-oauth) +[Open :material-open-in-new:](https://github.com/fastapi-users/fastapi-users/tree/master/examples/sqlalchemy-oauth) -=== ":octicons-file-code-16: requirements.txt" +=== "requirements.txt" ``` --8<-- "examples/sqlalchemy-oauth/requirements.txt" ``` -=== ":octicons-file-code-16: main.py" +=== "main.py" ```py --8<-- "examples/sqlalchemy-oauth/main.py" ``` -=== ":octicons-file-code-16: app/app.py" +=== "app/app.py" ```py --8<-- "examples/sqlalchemy-oauth/app/app.py" ``` -=== ":octicons-file-code-16: app/db.py" +=== "app/db.py" ```py --8<-- "examples/sqlalchemy-oauth/app/db.py" ``` -=== ":octicons-file-code-16: app/models.py" +=== "app/models.py" ```py --8<-- "examples/sqlalchemy-oauth/app/models.py" ``` -=== ":octicons-file-code-16: app/users.py" +=== "app/users.py" ```py --8<-- "examples/sqlalchemy-oauth/app/users.py" @@ -163,39 +163,39 @@ app.include_router( #### MongoDB -[Open :octicons-link-external-16:](https://github.com/fastapi-users/fastapi-users/tree/master/examples/mongodb-oauth) +[Open :material-open-in-new:](https://github.com/fastapi-users/fastapi-users/tree/master/examples/mongodb-oauth) -=== ":octicons-file-code-16: requirements.txt" +=== "requirements.txt" ``` --8<-- "examples/mongodb-oauth/requirements.txt" ``` -=== ":octicons-file-code-16: main.py" +=== "main.py" ```py --8<-- "examples/mongodb-oauth/main.py" ``` -=== ":octicons-file-code-16: app/app.py" +=== "app/app.py" ```py --8<-- "examples/mongodb-oauth/app/app.py" ``` -=== ":octicons-file-code-16: app/db.py" +=== "app/db.py" ```py --8<-- "examples/mongodb-oauth/app/db.py" ``` -=== ":octicons-file-code-16: app/models.py" +=== "app/models.py" ```py --8<-- "examples/mongodb-oauth/app/models.py" ``` -=== ":octicons-file-code-16: app/users.py" +=== "app/users.py" ```py --8<-- "examples/mongodb-oauth/app/users.py" @@ -203,39 +203,39 @@ app.include_router( #### Tortoise ORM -[Open :octicons-link-external-16:](https://github.com/fastapi-users/fastapi-users/tree/master/examples/tortoise-oauth) +[Open :material-open-in-new:](https://github.com/fastapi-users/fastapi-users/tree/master/examples/tortoise-oauth) -=== ":octicons-file-code-16: requirements.txt" +=== "requirements.txt" ``` --8<-- "examples/tortoise-oauth/requirements.txt" ``` -=== ":octicons-file-code-16: main.py" +=== "main.py" ```py --8<-- "examples/tortoise-oauth/main.py" ``` -=== ":octicons-file-code-16: app/app.py" +=== "app/app.py" ```py --8<-- "examples/tortoise-oauth/app/app.py" ``` -=== ":octicons-file-code-16: app/db.py" +=== "app/db.py" ```py --8<-- "examples/tortoise-oauth/app/db.py" ``` -=== ":octicons-file-code-16: app/models.py" +=== "app/models.py" ```py --8<-- "examples/tortoise-oauth/app/models.py" ``` -=== ":octicons-file-code-16: app/users.py" +=== "app/users.py" ```py --8<-- "examples/tortoise-oauth/app/users.py" diff --git a/mkdocs.yml b/mkdocs.yml index 767d5389..64c8ea4c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -8,17 +8,25 @@ theme: primary: 'red' accent: 'red' toggle: - icon: material/lightbulb + icon: material/weather-sunny name: Switch to dark mode - scheme: slate primary: 'red' accent: 'red' toggle: - icon: material/lightbulb-outline + icon: material/weather-night name: Switch to light mode icon: logo: material/account-supervisor favicon: 'favicon.png' + features: + - navigation.instant + - navigation.top + - navigation.sections + - navigation.indexes + - search.suggest + - search.highlight + - content.code.annotate repo_name: frankie567/fastapi-users repo_url: https://github.com/fastapi-users/fastapi-users @@ -28,29 +36,34 @@ markdown_extensions: - toc: permalink: true - admonition - - codehilite + - pymdownx.details + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.inlinehilite + - pymdownx.snippets - pymdownx.superfences: custom_fences: - name: mermaid class: mermaid - format: !!python/name:mermaid2.fence_mermaid - - pymdownx.tasklist + format: !!python/name:pymdownx.superfences.fence_code_format + - pymdownx.tasklist: + custom_checkbox: true - pymdownx.tabbed: alternate_style: true - - pymdownx.snippets - pymdownx.emoji: emoji_index: !!python/name:materialx.emoji.twemoji emoji_generator: !!python/name:materialx.emoji.to_svg + - attr_list + - tables + - def_list plugins: - search - - mermaid2: - arguments: - theme: | - ^(JSON.parse(window.localStorage.getItem('/.__palette')).index == 1) ? 'dark' : 'light' + - mike -extra_javascript: - - https://unpkg.com/mermaid/dist/mermaid.min.js +extra: + version: + provider: mike nav: - About: index.md diff --git a/pyproject.toml b/pyproject.toml index b5602c5a..1e10b09c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,6 +86,7 @@ dev = [ "isort", "pytest-asyncio", "flake8-docstrings", + "mike", "mkdocs", "mkdocs-material", "mkdocs-mermaid2-plugin",