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
25 changes: 6 additions & 19 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,28 @@
# This is a basic workflow to help you get started with Actions

name: mkdocs

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
docs:
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v5

- uses: actions/setup-python@v6
- uses: astral-sh/setup-uv@v6
with:
python-version: 3.x
cache: "pip"
cache-dependency-path: "requirements/doc.txt"
python-version: "3.x"
enable-cache: true

- name: Install dependencies
run: pip install -U -r ./requirements/doc.txt
run: uv sync --group doc --all-extras

- name: Build docs
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git fetch origin gh-pages:gh-pages
mike deploy v4.x
uv run mike deploy v4.x
git push origin gh-pages
25 changes: 11 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
# This workflow 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: publish

on:
release:
types: [ created ]

jobs:
deploy:

publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v6
with:
python-version: '3.x'
python-version: "3.x"
enable-cache: true

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
run: uv sync --group build --all-extras

- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
twine upload dist/*
uv run python -m build
uv run twine upload dist/*
35 changes: 13 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: tests

on:
Expand All @@ -10,6 +7,7 @@ on:
- "docs/**"
- "*.md"
- "*.rst"

pull_request:
branches: [ master ]
paths-ignore:
Expand All @@ -20,46 +18,39 @@ on:
jobs:
tests:
runs-on: ubuntu-latest

strategy:
max-parallel: 4
max-parallel: 5
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
flask-version: [ "Flask>=2.0,<3.0", "Flask>=3.0" ]
env:
PYTHONPATH: .

steps:
- uses: actions/checkout@v5

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
- uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
cache: "pip"
cache-dependency-path: "requirements/*.txt"
enable-cache: true

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U "${{ matrix.flask-version }}"
pip install -U pydantic
pip install -U -r ./requirements/test.txt
pip install -U -r ./requirements/ruff.txt
pip install -U -r ./requirements/mypy.txt
pip install -e .[swagger]
# pip install -e .[swagger,redoc,rapidoc,rapipdf,scalar,elements]
uv sync --all-extras --all-groups
uv add "${{ matrix.flask-version }}"

- name: Test with pytest
run: pytest tests
run: uv run pytest tests

- name: ruff
run: ruff check flask_openapi3 tests examples
run: uv run ruff check flask_openapi3 tests examples

- name: cache mypy
- name: Cache mypy
uses: actions/cache@v4
with:
path: ./.mypy_cache
key: mypy|${{ matrix.python-version }}|${{ hashFiles('pyproject.toml') }}

- name: mypy
run: mypy flask_openapi3
- name: Run mypy
run: uv run mypy flask_openapi3
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Before submitting pr, you need to complete the following steps:
1. Install requirements

```bash
pip install -U flask pydantic pyyaml pytest ruff mypy
uv sync --all-extras --all-groups
```

2. Running the tests
Expand Down
14 changes: 13 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ rapipdf = ["flask-openapi3-rapipdf"]
scalar = ["flask-openapi3-scalar"]
elements = ["flask-openapi3-elements"]

[dependency-groups]
build = ["hatchling", "build", "twine"]
doc = [
"mkdocs-static-i18n>=1.0",
"mkdocstrings[python]",
"mkdocs-material",
"mkdocs-glightbox",
"pyyaml",
"mike",
]
mypy = ["mypy"]
ruff = ["ruff"]
test = ["pytest", "asgiref", "pyyaml"]

[build-system]
requires = ["hatchling"]
Expand All @@ -59,7 +72,6 @@ path = "flask_openapi3/__version__.py"
include = [
"/flask_openapi3",
"/examples",
"/requirements",
"/tests",
"/CHANGELOG.md",
"/CONTRIBUTING.md",
Expand Down
1 change: 0 additions & 1 deletion requirements/build.txt

This file was deleted.

6 changes: 0 additions & 6 deletions requirements/doc.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements/mypy.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements/ruff.txt

This file was deleted.

3 changes: 0 additions & 3 deletions requirements/test.txt

This file was deleted.

Loading
Loading