Skip to content

Commit 19229bb

Browse files
Python (fix): explicit extras for build to exclude docs, dev (#305)
1 parent d21ade2 commit 19229bb

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

.github/workflows/python_build.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,14 @@ jobs:
124124
shell: bash
125125
run: |
126126
# Generate requirements file with all extras
127-
pip-compile pyproject.toml --all-extras -o requirements-all.txt
127+
pip-compile pyproject.toml \
128+
--extra build \
129+
--extra tdms \
130+
--extra hdf5 \
131+
--extra sift-stream \
132+
--extra rosbags \
133+
--extra openssl \
134+
-o requirements-all.txt
128135
129136
- name: Build dependency wheels
130137
working-directory: python

python/pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ tdms = ["npTDMS~=1.9"]
6262
rosbags = ["rosbags~=0.0"]
6363
sift-stream = ["sift-stream-bindings>=0.1.2"]
6464
hdf5 = ["h5py~=3.11", "polars~=1.8"]
65+
# Ensure any new user build extras are added to .github/workflows/python_build.yaml
66+
6567
[build-system]
6668
requires = ["setuptools"]
6769
build-backend = "setuptools.build_meta"

python/scripts/build_utils.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,25 @@ def get_extras_from_wheel(wheel_path: str) -> List[str]:
3434
return extras
3535

3636

37-
def get_extra_combinations(extras: List[str]) -> List[str]:
37+
def get_extra_combinations(extras: List[str], exclude: Optional[List[str]] = None) -> List[str]:
3838
"""Generate all possible combinations of extras.
3939
4040
Args:
4141
extras: List of extra names to generate combinations from.
42+
exclude: Optional list of extra names to exclude from combinations.
4243
4344
Returns:
4445
List of comma-separated strings representing each combination of extras.
4546
"""
47+
# Filter out excluded extras
48+
if exclude:
49+
filtered_extras = [extra for extra in extras if extra not in exclude]
50+
else:
51+
filtered_extras = extras
52+
4653
all_combinations = []
47-
for r in range(len(extras) + 1):
48-
all_combinations.extend(",".join(c) for c in combinations(extras, r))
54+
for r in range(len(filtered_extras) + 1):
55+
all_combinations.extend(",".join(c) for c in combinations(filtered_extras, r))
4956
return all_combinations
5057

5158

@@ -100,7 +107,7 @@ def main():
100107

101108
# Get all extras from the wheel
102109
extras = get_extras_from_wheel(str(wheel_file))
103-
combinations = get_extra_combinations(extras)
110+
combinations = get_extra_combinations(extras, ["development", "docs"])
104111

105112
# Test base installation first
106113
test_install(

0 commit comments

Comments
 (0)