Skip to content

Commit 0092815

Browse files
committed
[dist] Split package into regular vs. headless variant
1 parent 7984791 commit 0092815

5 files changed

Lines changed: 52 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,21 @@ jobs:
9797
scenedetect -i tests/resources/testvideo.mp4 -b pyav time --end 2s
9898
python -m pip uninstall -y scenedetect
9999
100+
- name: Build Package (Headless)
101+
shell: bash
102+
run: |
103+
python packaging/build_headless.py
104+
python -m build
105+
git checkout pyproject.toml
106+
107+
- name: Smoke Test Package (Headless Wheel)
108+
run: |
109+
python -m pip install dist/scenedetect_headless-${{ env.scenedetect_version }}-py3-none-any.whl
110+
scenedetect version
111+
scenedetect -i tests/resources/testvideo.mp4 -b opencv time --end 2s
112+
scenedetect -i tests/resources/testvideo.mp4 -b pyav time --end 2s
113+
python -m pip uninstall -y scenedetect-headless
114+
100115
- name: Upload Package
101116
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
102117
uses: actions/upload-artifact@v6

.github/workflows/publish-pypi.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ jobs:
9999
100100
- name: Build Package
101101
run: |
102+
python -m build
103+
python packaging/build_headless.py
102104
python -m build
103105
mkdir pkg
104106
mv dist/*.tar.gz pkg/

.github/workflows/release-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ jobs:
4141
- name: Build and Check
4242
run: |
4343
python -m build
44+
python packaging/build_headless.py
45+
python -m build
46+
git checkout pyproject.toml
4447
twine check dist/*
4548
- name: pip-audit
4649
# CVE-2026-3219 in pip 26.0.1 has no fix version available upstream

RELEASE-PLAN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Version referenced below as `X.Y[.Z]` - replace with the real version throughout
3535
- [ ] `ruff check scenedetect/ tests/` and `ruff format --check scenedetect/ tests/` pass.
3636
- [ ] Release test suite green: tag a disposable `vX.Y.Z-release-rc` or use `workflow_dispatch` on `.github/workflows/release-test.yml` - all 4 jobs (`static`, `release-tests`, `install-matrix`, `long-stress`) green across the 3-OS × 2-Python matrix. See `RELEASE-TEST-PLAN.md` for what the suite covers.
3737
- [ ] `resources` branch has the artifacts the release tests need (goldens under `tests/resources/goldens/`, `tests/resources/stress_15min.mp4`). Re-push if any golden was regenerated.
38-
- [ ] Manual smoke: fresh venv, `pip install .` then `pip install .[opencv]` then `pip install .[pyav]`; run `scenedetect -i <video> detect-content list-scenes save-images` and eyeball the output.
38+
- [ ] Manual smoke: fresh venv, `pip install .` (pulls opencv-python automatically) then `pip install .[pyav]`; run `scenedetect -i <video> detect-content list-scenes save-images` and eyeball the output. Repeat after `python packaging/build_headless.py && pip install .` to verify the headless variant.
3939
- [ ] `pip-audit` clean (or exceptions documented in the changelog).
4040

4141
## 5. Windows installer
@@ -53,8 +53,8 @@ Version referenced below as `X.Y[.Z]` - replace with the real version throughout
5353

5454
## 7. Publish
5555

56-
- [ ] `publish-pypi.yml` ran on the tag and uploaded successfully. Verify at https://pypi.org/project/scenedetect/.
57-
- [ ] Smoke-test PyPI: in a fresh venv, `pip install scenedetect==X.Y.Z` (bare), then with `[opencv]` and `[pyav]`. CLI launches.
56+
- [ ] `publish-pypi.yml` ran on the tag and uploaded successfully. Verify both projects: https://pypi.org/project/scenedetect/ and https://pypi.org/project/scenedetect-headless/.
57+
- [ ] Smoke-test PyPI: in a fresh venv, `pip install scenedetect==X.Y.Z`; CLI launches and `pip show scenedetect` lists `opencv-python`. Repeat in a second venv with `pip install scenedetect-headless==X.Y.Z`; verify it lists `opencv-python-headless`.
5858
- [ ] Create GitHub Release from the `vX.Y[.Z]` tag, body = changelog section, attach Windows installer MSI + portable `.zip`.
5959
- [ ] Deploy website: `generate-website.yml` picks up the changelog / download page updates.
6060
- [ ] Deploy docs: `generate-docs.yml` publishes the new version.

packaging/build_headless.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# PySceneDetect: Python-Based Video Scene Detector
3+
# ---------------------------------------------------------------
4+
# [ Site: http://www.bcastell.com/projects/PySceneDetect/ ]
5+
# [ Github: https://github.com/Breakthrough/PySceneDetect/ ]
6+
# [ Documentation: http://www.scenedetect.com/docs/ ]
7+
#
8+
# Copyright (C) 2014 Brandon Castellano <http://www.bcastell.com>.
9+
#
10+
11+
# Generates the headless variant by mutating pyproject.toml in place.
12+
# Run this before `python -m build` to produce scenedetect-headless artifacts.
13+
# Modifies pyproject.toml in place; revert via `git checkout pyproject.toml`.
14+
15+
from pathlib import Path
16+
17+
PYPROJECT = Path(__file__).resolve().parent.parent / "pyproject.toml"
18+
19+
content = PYPROJECT.read_text()
20+
21+
assert 'name = "scenedetect"' in content
22+
content = content.replace('name = "scenedetect"', 'name = "scenedetect-headless"', 1)
23+
24+
assert '"opencv-python",' in content
25+
content = content.replace('"opencv-python",', '"opencv-python-headless",', 1)
26+
27+
PYPROJECT.write_text(content)
28+
29+
print("Generated headless pyproject.toml.")

0 commit comments

Comments
 (0)