Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit dc892df

Browse files
committed
Switched to UV
1 parent 3ec12cf commit dc892df

24 files changed

+1449
-413
lines changed

.github/workflows/coverage.yml

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,20 @@ jobs:
1212
coverage:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Check out repository
16-
uses: actions/checkout@v4
15+
- uses: actions/checkout@v4
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v2
18+
with:
19+
enable-cache: true
20+
cache-dependency-glob: "uv.lock"
21+
- name: Setup Python
22+
run: uv python install
23+
- name: Run tests
24+
run: |
25+
uv run tox -e coverage
26+
uv run tox -e report
1727
18-
- name: Set up Python 3.12
19-
uses: actions/setup-python@v5
20-
with:
21-
python-version: 3.12
22-
23-
- name: Install dependencies
24-
run: |
25-
python -m pip install --upgrade pip
26-
pip install tox
27-
28-
- name: Run tests
29-
run: |
30-
tox -e coverage
31-
tox -e report
32-
33-
- name: Upload coverage reports to Codecov
34-
uses: codecov/codecov-action@v4.0.1
35-
with:
36-
token: ${{ secrets.CODECOV_TOKEN }}
28+
- name: Upload coverage reports to Codecov
29+
uses: codecov/codecov-action@v4.5.0
30+
with:
31+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/lint-commits.yml

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

.github/workflows/linting.yml

Lines changed: 25 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,41 @@
1-
name: Linting
1+
name: Lint
2+
23
on:
4+
push:
5+
branches:
6+
- main
37
pull_request:
48
branches:
59
- main
610

711
jobs:
8-
lint-flake8:
9-
name: Linting with flake8
12+
linting:
13+
name: Linting
1014
runs-on: ubuntu-latest
1115
steps:
1216
- uses: actions/checkout@v4
13-
- name: Setup Python
14-
uses: actions/setup-python@v5
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v2
1519
with:
16-
python-version: '3.11'
17-
cache: 'pip'
18-
cache-dependency-path: |
19-
requirements.txt
20-
requirements-dev.txt
21-
- uses: actions/cache@v4
22-
with:
23-
path: ~/.cache/pip
24-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
25-
restore-keys: |
26-
${{ runner.os }}-pip-
27-
- name: Install requirements
28-
run: |
29-
python -m pip install --upgrade pip
30-
pip install -r requirements-dev.txt
31-
- name: Lint with flake8
32-
run: |
33-
flake8 --version # Verify flake8 is picking up flake8-bugbear
34-
flake8 --max-line-length=120 . --exclude env,configuration,venv,src,scripts,.venv,e2e
35-
36-
lint-black:
37-
name: Linting with black
38-
runs-on: ubuntu-latest
39-
steps:
40-
- uses: actions/checkout@v4
20+
enable-cache: true
21+
cache-dependency-glob: "uv.lock"
4122
- name: Setup Python
42-
uses: actions/setup-python@v5
43-
with:
44-
python-version: '3.11'
45-
cache: 'pip'
46-
cache-dependency-path: |
47-
requirements.txt
48-
requirements-dev.txt
49-
- uses: actions/cache@v4
50-
with:
51-
path: ~/.cache/pip
52-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
53-
restore-keys: |
54-
${{ runner.os }}-pip-
55-
- name: Install requirements
56-
run: |
57-
python -m pip install --upgrade pip
58-
pip install -r requirements-dev.txt
59-
- name: Lint with black
60-
run: black flask_utils -l119 --check
61-
62-
lint-imports-order:
63-
name: Checking imports order
23+
run: uv python install
24+
- name: Run Ruff
25+
run: uv run ruff check --output-format=github .
26+
type-checking:
27+
name: Type Checking
6428
runs-on: ubuntu-latest
6529
steps:
6630
- uses: actions/checkout@v4
67-
- name: Setup Python
68-
uses: actions/setup-python@v5
69-
with:
70-
python-version: '3.11'
71-
cache: 'pip'
72-
cache-dependency-path: |
73-
requirements.txt
74-
requirements-dev.txt
75-
- uses: actions/cache@v4
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v2
7633
with:
77-
path: ~/.cache/pip
78-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
79-
restore-keys: |
80-
${{ runner.os }}-pip-
81-
- name: Install requirements
82-
run: |
83-
python -m pip install --upgrade pip
84-
pip install -r requirements-dev.txt
85-
- name: Lint with reorder-python-imports
86-
run: reorder-python-imports flask_utils/**/*.py tests/*.py
87-
88-
lint-typing:
89-
name: Checking Typing with MyPy
90-
runs-on: ubuntu-latest
91-
steps:
92-
- uses: actions/checkout@v4
34+
enable-cache: true
35+
cache-dependency-glob: "uv.lock"
9336
- name: Setup Python
94-
uses: actions/setup-python@v5
95-
with:
96-
python-version: '3.11'
97-
cache: 'pip'
98-
cache-dependency-path: |
99-
requirements.txt
100-
requirements-dev.txt
101-
- uses: actions/cache@v4
102-
with:
103-
path: ~/.cache/pip
104-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
105-
restore-keys: |
106-
${{ runner.os }}-pip-
107-
- name: Install requirements
108-
run: |
109-
python -m pip install --upgrade pip
110-
pip install -r requirements-dev.txt
111-
pip install types-flask
112-
- name: Lint with mypy
113-
run: mypy flask_utils
114-
115-
lint-sphinx:
116-
name: Checking documentation with Sphinx
117-
runs-on: ubuntu-latest
118-
steps:
119-
- uses: actions/checkout@v4
120-
- name: Setup Python
121-
uses: actions/setup-python@v5
122-
with:
123-
python-version: '3.11'
124-
cache: 'pip'
125-
cache-dependency-path: |
126-
requirements.txt
127-
requirements-dev.txt
128-
- uses: actions/cache@v4
129-
with:
130-
path: ~/.cache/pip
131-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
132-
restore-keys: |
133-
${{ runner.os }}-pip-
134-
- name: Install requirements
135-
run: |
136-
python -m pip install --upgrade pip
137-
pip install -r requirements-dev.txt
138-
- name: Lint with sphinx
139-
run: sphinx-lint -i .venv -i .tox
37+
run: uv python install
38+
- name: Run mypy
39+
# Using strict mode.
40+
# Waiting for https://github.com/python/mypy/pull/17771
41+
run: uv run mypy --strict flask_utils

.github/workflows/publish.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
- name: Set up Python
14-
uses: actions/setup-python@v5
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v2
1515
with:
16-
python-version: '3.11'
17-
- name: Install dependencies
18-
run: |
19-
python3.11 -m pip install --upgrade pip
20-
python3.11 -m pip install --upgrade setuptools wheel twine build
16+
enable-cache: true
17+
cache-dependency-glob: "uv.lock"
18+
- name: Setup Python
19+
run: uv python install
2120
- name: Create Github Release
2221
id: create_release
2322
uses: softprops/action-gh-release@v2
@@ -28,8 +27,9 @@ jobs:
2827
generate_release_notes: true
2928
- name: Build and publish on private PyPI
3029
run: |
31-
python3.11 -m build
32-
# twine upload dist/*
30+
uv build
31+
# TODO: Uncomment when flask-utils had been freed from pypi
32+
# uvx twine upload dist/*
3333
- name: Upload .whl artifact to GitHub release
3434
uses: actions/upload-release-asset@v1
3535
env:

.github/workflows/tests.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,17 @@ jobs:
2020
- name: Check out repository
2121
uses: actions/checkout@v4
2222

23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v5
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v2
2525
with:
26-
python-version: ${{ matrix.python-version }}
26+
enable-cache: true
27+
cache-dependency-glob: "uv.lock"
2728

28-
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install tox
29+
- name: Setup Python
30+
run: uv python install ${{ matrix.python-version }}
3231

3332
- name: Run tests
3433
run: |
3534
PYTHON_VERSION=${{ matrix.python-version }}
3635
TOX_ENV=`tox --listenvs | grep "py${PYTHON_VERSION//./}-" | tr '\n' ','`
37-
tox -e $TOX_ENV
36+
uv run tox -e $TOX_ENV

.github/workflows/version-check.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ jobs:
1212
- uses: actions/checkout@v4
1313
with:
1414
fetch-depth: 0
15-
- name: Setup Python
16-
uses: actions/setup-python@v5
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v2
1717
with:
18-
python-version: '3.11'
18+
enable-cache: true
19+
cache-dependency-glob: "uv.lock"
20+
- name: Setup Python
21+
run: uv python install
1922
- name: Check version
2023
run: |
21-
pip install packaging
22-
python scripts/check_version.py
24+
uv run -- python scripts/check_version.py

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ target/
8181
profile_default/
8282
ipython_config.py
8383

84-
# pyenv
85-
.python-version
86-
8784
# pipenv
8885
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
8986
# However, in case of collaboration, if having platform-specific dependencies or dependencies

0 commit comments

Comments
 (0)