Skip to content

Commit 0b99c39

Browse files
authored
Fix wheel package discovery and validate artifacts (DOI-USGS#347)
1 parent 09b5665 commit 0b99c39

2 files changed

Lines changed: 43 additions & 2 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,47 @@ jobs:
2727
ruff check . --output-format=github
2828
ruff format --check .
2929
30+
package-artifact:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v6
34+
- name: Set up Python 3.13
35+
uses: actions/setup-python@v6
36+
with:
37+
python-version: "3.13"
38+
cache: "pip"
39+
- name: Build wheel
40+
run: |
41+
python -m pip install --upgrade pip
42+
python -m pip wheel --no-deps --wheel-dir wheelhouse .
43+
- name: Smoke test installed wheel outside the checkout
44+
run: |
45+
venv="$RUNNER_TEMP/dataretrieval-wheel-smoke"
46+
python -m venv "$venv"
47+
"$venv/bin/python" -m pip install "$GITHUB_WORKSPACE"/wheelhouse/*.whl
48+
cd "$RUNNER_TEMP"
49+
"$venv/bin/python" -I - <<'PY'
50+
import importlib.util
51+
import os
52+
from importlib.resources import files
53+
from pathlib import Path
54+
55+
import dataretrieval
56+
from dataretrieval import ngwmn, waterdata, wateruse
57+
from dataretrieval.ogc import engine
58+
59+
checkout = Path(os.environ["GITHUB_WORKSPACE"]).resolve()
60+
installed = Path(dataretrieval.__file__).resolve()
61+
assert not installed.is_relative_to(checkout), (installed, checkout)
62+
assert importlib.util.find_spec("dataretrieval.waterdata.api") is not None
63+
assert importlib.util.find_spec("dataretrieval.ogc.engine") is not None
64+
assert files("dataretrieval").joinpath("py.typed").is_file()
65+
assert waterdata.get_daily
66+
assert ngwmn.get_sites
67+
assert wateruse.get_wateruse
68+
assert engine.get_ogc_data
69+
PY
70+
3071
type-check:
3172
runs-on: ubuntu-latest
3273
steps:

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ dependencies = [
3636
]
3737
dynamic = ["version"]
3838

39-
[tool.setuptools]
40-
packages = ["dataretrieval", "dataretrieval.codes"]
39+
[tool.setuptools.packages.find]
40+
include = ["dataretrieval*"]
4141

4242
[tool.setuptools.package-data]
4343
dataretrieval = ["py.typed"]

0 commit comments

Comments
 (0)