Skip to content

Commit 2d77c7d

Browse files
committed
Use uv
1 parent aef3902 commit 2d77c7d

File tree

11 files changed

+1365
-69
lines changed

11 files changed

+1365
-69
lines changed

.github/workflows/docs.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,28 @@
1-
# This is a basic workflow to help you get started with Actions
2-
31
name: mkdocs
42

5-
# Controls when the action will run.
63
on:
7-
# Triggers the workflow on push or pull request events but only for the master branch
84
push:
95
branches: [ master ]
106

11-
# Allows you to run this workflow manually from the Actions tab
12-
workflow_dispatch:
13-
14-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
157
jobs:
16-
# This workflow contains a single job called "build"
17-
build:
18-
# The type of runner that the job will run on
8+
docs:
199
runs-on: ubuntu-latest
2010

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

26-
- uses: actions/setup-python@v6
14+
- uses: astral-sh/setup-uv@v6
2715
with:
28-
python-version: 3.x
29-
cache: "pip"
30-
cache-dependency-path: "requirements/doc.txt"
16+
python-version: "3.x"
17+
enable-cache: true
3118

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

3522
- name: Build docs
3623
run: |
3724
git config --local user.email "action@github.com"
3825
git config --local user.name "GitHub Action"
3926
git fetch origin gh-pages:gh-pages
40-
mike deploy v4.x
27+
uv run mike deploy v4.x
4128
git push origin gh-pages

.github/workflows/publish.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
1-
# This workflow will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
41
name: publish
52

63
on:
74
release:
85
types: [ created ]
96

107
jobs:
11-
deploy:
12-
8+
publish:
139
runs-on: ubuntu-latest
1410

1511
steps:
16-
- uses: actions/checkout@v5
17-
- name: Set up Python
18-
uses: actions/setup-python@v6
12+
- uses: actions/checkout@v4
13+
14+
- uses: astral-sh/setup-uv@v6
1915
with:
20-
python-version: '3.x'
16+
python-version: "3.x"
17+
enable-cache: true
18+
2119
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install build twine
20+
run: uv sync --group build --all-extras
21+
2522
- name: Build and publish
2623
env:
2724
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
2825
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2926
run: |
30-
python -m build
31-
twine upload dist/*
27+
uv run python -m build
28+
uv run twine upload dist/*

.github/workflows/tests.yml

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
41
name: tests
52

63
on:
@@ -10,6 +7,7 @@ on:
107
- "docs/**"
118
- "*.md"
129
- "*.rst"
10+
1311
pull_request:
1412
branches: [ master ]
1513
paths-ignore:
@@ -20,46 +18,39 @@ on:
2018
jobs:
2119
tests:
2220
runs-on: ubuntu-latest
21+
2322
strategy:
24-
max-parallel: 4
23+
max-parallel: 5
2524
matrix:
2625
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
2726
flask-version: [ "Flask>=2.0,<3.0", "Flask>=3.0" ]
2827
env:
2928
PYTHONPATH: .
29+
3030
steps:
3131
- uses: actions/checkout@v5
3232

33-
- name: Set up Python ${{ matrix.python-version }}
34-
uses: actions/setup-python@v6
33+
- uses: astral-sh/setup-uv@v6
3534
with:
3635
python-version: ${{ matrix.python-version }}
37-
allow-prereleases: true
38-
cache: "pip"
39-
cache-dependency-path: "requirements/*.txt"
36+
enable-cache: true
4037

4138
- name: Install dependencies
4239
run: |
43-
python -m pip install --upgrade pip
44-
pip install -U "${{ matrix.flask-version }}"
45-
pip install -U pydantic
46-
pip install -U -r ./requirements/test.txt
47-
pip install -U -r ./requirements/ruff.txt
48-
pip install -U -r ./requirements/mypy.txt
49-
pip install -e .[swagger]
50-
# pip install -e .[swagger,redoc,rapidoc,rapipdf,scalar,elements]
40+
uv sync --all-extras --all-groups
41+
uv add "${{ matrix.flask-version }}"
5142
5243
- name: Test with pytest
53-
run: pytest tests
44+
run: uv run pytest tests
5445

5546
- name: ruff
56-
run: ruff check flask_openapi3 tests examples
47+
run: uv run ruff check flask_openapi3 tests examples
5748

58-
- name: cache mypy
49+
- name: Cache mypy
5950
uses: actions/cache@v4
6051
with:
6152
path: ./.mypy_cache
6253
key: mypy|${{ matrix.python-version }}|${{ hashFiles('pyproject.toml') }}
6354

64-
- name: mypy
65-
run: mypy flask_openapi3
55+
- name: Run mypy
56+
run: uv run mypy flask_openapi3

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Before submitting pr, you need to complete the following steps:
1010
1. Install requirements
1111

1212
```bash
13-
pip install -U flask pydantic pyyaml pytest ruff mypy
13+
uv sync --all-extras --all-groups
1414
```
1515

1616
2. Running the tests

pyproject.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ rapipdf = ["flask-openapi3-rapipdf"]
4747
scalar = ["flask-openapi3-scalar"]
4848
elements = ["flask-openapi3-elements"]
4949

50+
[dependency-groups]
51+
build = ["hatchling", "build", "twine"]
52+
doc = [
53+
"mkdocs-static-i18n>=1.0",
54+
"mkdocstrings[python]",
55+
"mkdocs-material",
56+
"mkdocs-glightbox",
57+
"pyyaml",
58+
"mike",
59+
]
60+
mypy = ["mypy"]
61+
ruff = ["ruff"]
62+
test = ["pytest", "asgiref", "pyyaml"]
5063

5164
[build-system]
5265
requires = ["hatchling"]
@@ -59,7 +72,6 @@ path = "flask_openapi3/__version__.py"
5972
include = [
6073
"/flask_openapi3",
6174
"/examples",
62-
"/requirements",
6375
"/tests",
6476
"/CHANGELOG.md",
6577
"/CONTRIBUTING.md",

requirements/build.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements/doc.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

requirements/mypy.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements/ruff.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements/test.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)