Skip to content

Commit 52eb9ac

Browse files
committed
Merge remote-tracking branch 'origin/main' into model-init-params
* origin/main: Setup stub creation with docstub in CI (scikit-image#7802)
2 parents 6964b30 + e3c3726 commit 52eb9ac

File tree

5 files changed

+72
-0
lines changed

5 files changed

+72
-0
lines changed

.github/workflows/typing.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Workflow to generate and test type annotations
2+
name: Typing
3+
4+
on: [push, pull_request, merge_group]
5+
6+
concurrency:
7+
# Cancel previously triggered workflows for the same PR
8+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
# Many color libraries just need this variable to be set to any value.
16+
# Set it to 3 to support 8-bit color graphics (256 colors per channel)
17+
# for libraries that care about the value set.
18+
FORCE_COLOR: 3
19+
MYPYPATH: ${{ github.workspace }}/stubs
20+
21+
jobs:
22+
docstub:
23+
name: Test docstub
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Clone scikit-image
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
persist-credentials: false
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: 3.13
37+
cache: "pip"
38+
cache-dependency-path: "requirements/*.txt"
39+
40+
- name: Install build dependencies
41+
env:
42+
PIP_FLAGS: ${{ matrix.PIP_FLAGS }}
43+
run: |
44+
source .github/scripts/setup-build-env.sh
45+
46+
- name: Build and install from source
47+
run: |
48+
pip install -v --no-build-isolation .
49+
50+
- name: Install docstub
51+
run: |
52+
pip install docstub==0.3.0.post0
53+
docstub --version
54+
55+
- name: Create stubs with docstub
56+
run: |
57+
docstub run --verbose --group-errors --allow-errors=722 \
58+
--out-dir ${MYPYPATH}/skimage skimage/
59+
60+
- uses: actions/upload-artifact@v4
61+
with:
62+
name: skimage-stubs
63+
path: ${MYPYPATH}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ skimage/morphology/_skeletonize_lee_cy.pyx
4141
.vscode/
4242
.mesonpy-native-file.ini
4343
/.pyodide-xbuildenv-*
44+
stubs/

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ dependencies:
2424
# developer
2525
- pre-commit
2626
- ipython
27+
- docstub==0.3.0.post0
2728
# docs
2829
- sphinx>=8.0
2930
- sphinx-gallery>=0.18

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ data = ['pooch>=1.6.0']
5858
developer = [
5959
'pre-commit',
6060
'ipython',
61+
'docstub==0.3.0.post0',
6162
]
6263
docs = [
6364
'sphinx>=8.0',
@@ -202,3 +203,8 @@ ignored_user_logins = [
202203
"web-flow",
203204
"pre-commit-ci[bot]"
204205
]
206+
207+
208+
[tool.docstub.type_prefixes]
209+
matplotlib = "matplotlib"
210+
scipy = "scipy"

requirements/developer.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
# Do not edit this file; modify pyproject.toml instead.
33
pre-commit
44
ipython
5+
docstub==0.3.0.post0

0 commit comments

Comments
 (0)