Skip to content

Commit 46a39e9

Browse files
authored
Tighten extras policy and CI validation (#318)
* Add extras guardrail check and docs/release notes * Align gcsfs pin with main for extras subset check
1 parent 3ae2af5 commit 46a39e9

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

.github/workflows/ci-build.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,39 @@ on:
2424
workflow_dispatch:
2525

2626
jobs:
27+
validate-metadata:
28+
name: "validate package metadata"
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v6
32+
- name: Set up Python 3.11
33+
uses: actions/setup-python@v6
34+
with:
35+
python-version: "3.11"
36+
- name: Validate optional dependency relationships
37+
run: |
38+
python - <<'PY'
39+
import tomllib
40+
from pathlib import Path
41+
42+
pyproject = Path("pyproject.toml")
43+
data = tomllib.loads(pyproject.read_text())
44+
optional = data["project"]["optional-dependencies"]
45+
46+
dataflow = set(optional.get("dataflow", []))
47+
examples = set(optional.get("examples", []))
48+
49+
missing = sorted(dataflow - examples)
50+
if missing:
51+
print("The [examples] extra must include all [dataflow] dependencies.")
52+
print("Missing from examples:")
53+
for dep in missing:
54+
print(f"- {dep}")
55+
raise SystemExit(1)
56+
57+
print("Optional dependency check passed: dataflow is a subset of examples.")
58+
PY
59+
2760
build:
2861
name: "python ${{ matrix.python-version }} tests"
2962
runs-on: ubuntu-latest

docs/releasing.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,13 @@ Use this to finalize a tested release branch.
5959
- Avoid creating stable releases directly from `main`; use the release branch path.
6060
- If a stable release was published by mistake, coordinate with maintainers before
6161
deleting tags or editing release records.
62+
63+
## Dependency extras guardrails
64+
65+
- `dataflow` is intended for production export workflows.
66+
- `examples` may include `dataflow` dependencies plus any additional packages used
67+
by user-facing examples.
68+
- Keep `examples` explicit (do not use self-referential extras like
69+
`xee[dataflow]` inside `project.optional-dependencies`).
70+
- CI enforces that every dependency in `dataflow` is also present in `examples`
71+
(subset check in `.github/workflows/ci-build.yml`).

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,14 @@ dataflow = [
4949
"gcsfs<=2026.4.0",
5050
"xarray-beam",
5151
]
52+
# Keep examples equivalent to dataflow, but avoid self-referential extras
53+
# ("xee[dataflow]") which can confuse dependency resolvers.
5254
examples = [
53-
"xee[dataflow]",
55+
"absl-py",
56+
"apache-beam[gcp]",
57+
"gcsfs<=2026.4.0",
58+
"matplotlib",
59+
"xarray-beam",
5460
]
5561

5662
[project.urls]

0 commit comments

Comments
 (0)