Skip to content

Commit c3155e4

Browse files
authored
Add GitHub Actions workflow for building and uploading scikit-downscale to PyPI (#152)
1 parent be16c86 commit c3155e4

4 files changed

Lines changed: 97 additions & 4 deletions

File tree

.github/workflows/pypi.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Publish scikit-downscale to PyPI
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
push:
8+
9+
jobs:
10+
build-artifacts:
11+
runs-on: ubuntu-latest
12+
if: github.repository == 'pangeo-data/scikit-downscale'
13+
steps:
14+
- uses: actions/checkout@v5
15+
with:
16+
fetch-depth: 0
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v7
19+
with:
20+
python-version: "3.13"
21+
22+
- name: Build tarball and wheels
23+
run: |
24+
git clean -xdf
25+
git restore -SW .
26+
uv build
27+
28+
- name: Check built artifacts
29+
run: |
30+
uv tool run twine check dist/*
31+
pwd
32+
if [ -f dist/scikit-downscale-unknown.tar.gz ]; then
33+
echo "❌ INVALID VERSION NUMBER"
34+
exit 1
35+
else
36+
echo "✅ Looks good"
37+
fi
38+
- uses: actions/upload-artifact@v5
39+
with:
40+
name: releases
41+
path: dist
42+
43+
test-built-dist:
44+
needs: build-artifacts
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Install uv
48+
uses: astral-sh/setup-uv@v7
49+
with:
50+
python-version: "3.13"
51+
- uses: actions/download-artifact@v6
52+
with:
53+
name: releases
54+
path: dist
55+
- name: List contents of built dist
56+
run: |
57+
ls -ltrh
58+
ls -ltrh dist
59+
60+
- name: Verify the built dist/wheel is valid
61+
if: github.event_name == 'push'
62+
run: |
63+
uv venv
64+
uv pip install dist/scikit_downscale*.whl
65+
uv run python -c "import skdownscale; print(skdownscale.__version__)"
66+
67+
upload-to-pypi:
68+
needs: test-built-dist
69+
if: github.event_name == 'release'
70+
runs-on: ubuntu-latest
71+
permissions:
72+
id-token: write
73+
steps:
74+
- uses: actions/download-artifact@v6
75+
with:
76+
name: releases
77+
path: dist
78+
- name: Publish package to PyPI
79+
uses: pypa/gh-action-pypi-publish@v1.13.0

MANIFEST.in

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
include LICENSE
2+
include README.md
3+
include pyproject.toml
4+
include skdownscale/py.typed
5+
6+
7+
recursive-include docs/*
8+
recursive-include skdownscale *.yaml
9+
recursive-include skdownscale *.py
10+
recursive-exclude * __pycache__
11+
recursive-exclude * *.py[co]
12+
prune tests*
13+
prune .github*
14+
prune .binder*

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
classifiers = [
88
"Development Status :: 2 - Pre-Alpha",
99
"Intended Audience :: Science/Research",
10-
"License :: OSI Approved :: Apache Software License",
1110
"Operating System :: OS Independent",
1211
"Programming Language :: Python :: 3",
1312
"Programming Language :: Python :: 3.12",
@@ -18,13 +17,14 @@
1817
dependencies = ["scikit-learn>=1.5", "xarray>=2024.10"]
1918
description = "Statistical downscaling and postprocessing models for climate and weather model simulations."
2019
dynamic = ["version"]
21-
license = { text = "Apache" }
20+
license = "Apache-2.0"
2221
name = "scikit-downscale"
2322
readme = "README.md"
2423
requires-python = ">=3.12"
2524

2625
[project.urls]
27-
Homepage = "https://github.com/pangeo-data/scikit-downscale"
26+
Documentation = "https://scikit-downscale.readthedocs.io/"
27+
Homepage = "https://github.com/pangeo-data/scikit-downscale"
2828

2929
[tool.setuptools.packages.find]
3030
include = ["skdownscale*"]
@@ -73,7 +73,7 @@
7373
"sphinx>=8.0",
7474
"sphinxext-opengraph>=0.13.0",
7575
"zarr>=2.18.2",
76-
]
76+
]
7777

7878
[tool.ruff]
7979
builtins = ["ellipsis"]

skdownscale/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)