Skip to content

Commit 8070637

Browse files
committed
Configure ty type checker, migrate CI to uv
- Add ty configuration: python-version 3.10, exclude tests/ and docs/ - All ty rules at default severity (no downgrades) - Add lint CI job (ruff check, ruff format, ty check) - Migrate test matrix job from pip to uv - Remove redundant uv-test job (now covered by test matrix) - Keep multiarch job on pip (uv not available on ppc64le) - Move docs from optional dependency to dependency group - Include docs group in test group (tests/test_docs.py needs docutils) - Migrate ReadTheDocs to uv
1 parent 5bca612 commit 8070637

3 files changed

Lines changed: 61 additions & 56 deletions

File tree

.github/workflows/bugwarrior.yml

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,18 @@ jobs:
1414
steps:
1515
- name: Checkout code
1616
uses: actions/checkout@v4
17-
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v5
19-
with:
20-
python-version: ${{ matrix.python-version }}
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v6
2119
- name: Run tests
2220
run: |
2321
sudo apt-get update -qq
24-
sudo apt-get install -qq -y \
25-
libffi-dev libssl-dev python3-venv taskwarrior
22+
sudo apt-get install -qq -y taskwarrior
2623
task --version
27-
28-
mkdir .venv
29-
python3 -m venv .venv
30-
source .venv/bin/activate
31-
pip install --upgrade pip setuptools
32-
33-
pip install -e ".[all]"
34-
35-
bugwarrior --version
36-
pytest
24+
uv sync --all-extras --group test --python ${{ matrix.python-version }}
25+
uv run bugwarrior --version
26+
uv run pytest
27+
# Cannot migrate to uv: astral-sh/setup-uv does not support ppc64le,
28+
# and uraimo/run-on-arch-action runs inside a Docker container.
3729
bugwarrior-multiarch-test:
3830
runs-on: ubuntu-latest
3931
# We're currently seeing these complete in 10-30 minutes.
@@ -64,32 +56,26 @@ jobs:
6456
mkdir .venv
6557
python3 -m venv .venv
6658
source .venv/bin/activate
67-
pip install --upgrade pip setuptools
59+
pip install --upgrade "pip>=25.1" setuptools
6860
6961
pip install -e .[all]
62+
pip install --group test
7063
7164
bugwarrior --version
7265
pytest
73-
bugwarrior-development-uv-test:
66+
bugwarrior-lint:
7467
runs-on: ubuntu-latest
75-
# We're currently seeing these complete in 1 minute.
7668
timeout-minutes: 5
7769
steps:
7870
- name: Checkout code
7971
uses: actions/checkout@v4
80-
- name: Set up Python
81-
uses: actions/setup-python@v5
82-
- name: Install Dependencies
83-
run: |
84-
sudo apt-get update -qq
85-
sudo apt-get install -qq -y \
86-
libffi-dev libssl-dev taskwarrior
87-
task --version
8872
- name: Install uv
8973
uses: astral-sh/setup-uv@v6
90-
- name: Install Editable Installation
91-
run: uv sync --all-extras
92-
- name: Run tests
93-
run: |
94-
uv run bugwarrior --version
95-
uv run pytest
74+
- name: Install dependencies
75+
run: uv sync --all-extras --group dev
76+
- name: Ruff check
77+
run: uv run ruff check
78+
- name: Ruff format
79+
run: uv run ruff format --check
80+
- name: Type check
81+
run: uv run ty check

.readthedocs.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# .readthedocs.yaml
22
# Read the Docs configuration file
33
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
# uv setup: https://docs.readthedocs.com/platform/stable/build-customization.html#install-dependencies-with-uv
45

56
# Required
67
version: 2
@@ -10,11 +11,12 @@ build:
1011
os: ubuntu-22.04
1112
tools:
1213
python: "3.10"
13-
14-
# Optionally declare the Python requirements required to build your docs
15-
python:
16-
install:
17-
- method: pip
18-
path: .
19-
extra_requirements:
20-
- all
14+
jobs:
15+
pre_create_environment:
16+
- asdf plugin add uv
17+
- asdf install uv latest
18+
- asdf global uv latest
19+
create_environment:
20+
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
21+
install:
22+
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --all-extras --group docs

pyproject.toml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,10 @@ jira = ["jira>=3.10.0"]
3535
kanboard = ["kanboard"]
3636
keyring = ["keyring"]
3737
phabricator = ["phabricator"]
38-
test = [
39-
# sphinx-inline-tabs is incompatible with docutils-0.22 https://github.com/pradyunsg/sphinx-inline-tabs/pull/51
40-
"docutils<0.22",
41-
"pytest",
42-
"pytest-subtests",
43-
"responses",
44-
"ruff",
45-
"sphinx>=1.0,<9.0 ; python_version <= '3.10'",
46-
"sphinx>=9.0.3 ; python_version >= '3.11'",
47-
"sphinx-click",
48-
"sphinx-inline-tabs",
49-
# To make this installable with uvx/pipx and no additional options needed.
50-
"setuptools",
51-
]
5238
todoist = ["todoist_api_python>=3.0.0"]
5339
trac = ["offtrac"]
5440

55-
all = ["bugwarrior[bts,bugzilla,gmail,ini2toml,jira,kanboard,keyring,phabricator,test,todoist,trac]"]
41+
all = ["bugwarrior[bts,bugzilla,gmail,ini2toml,jira,kanboard,keyring,phabricator,todoist,trac]"]
5642

5743
[project.urls]
5844
documentation = "https://bugwarrior.readthedocs.io/en/stable/"
@@ -112,6 +98,37 @@ max-line-length = 100
11298
[tool.setuptools.packages.find]
11399
include = ["bugwarrior*"]
114100

101+
[tool.ty.environment]
102+
python-version = "3.10"
103+
104+
[tool.ty.src]
105+
exclude = ["tests/", "bugwarrior/docs/"]
106+
115107
[build-system]
116108
requires = ["setuptools"]
117109
build-backend = "setuptools.build_meta"
110+
111+
# PEP 735 — Dependency Groups in pyproject.toml
112+
# https://peps.python.org/pep-0735/
113+
[dependency-groups]
114+
docs = [
115+
# sphinx-inline-tabs is incompatible with docutils-0.22 https://github.com/pradyunsg/sphinx-inline-tabs/pull/51
116+
"docutils<0.22",
117+
"sphinx>=1.0,<9.0 ; python_version <= '3.10'",
118+
"sphinx>=9.0.3 ; python_version >= '3.11'",
119+
"sphinx-click",
120+
"sphinx-inline-tabs",
121+
# To make this installable with uvx/pipx and no additional options needed.
122+
"setuptools",
123+
]
124+
test = [
125+
{include-group = "docs"},
126+
"pytest",
127+
"pytest-subtests",
128+
"responses",
129+
]
130+
dev = [
131+
{include-group = "test"},
132+
"ruff",
133+
"ty>=0.0.23",
134+
]

0 commit comments

Comments
 (0)