Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ jobs:
version: "0.5.11"
python-version: ${{ matrix.python-version }}

# TODO(#257): Unpin OpenCV versions once we figure out why frame numbers are mismatching in tests.
- name: Install Dependencies
run: |
uv pip install --upgrade build wheel virtualenv
uv pip install opencv-python-headless\<4.13 opencv-contrib-python-headless\<4.13 --only-binary :all:
uv pip install -r requirements_headless.txt -r docs/requirements.txt
# TODO: Figure out how to avoid installing the original OpenCV package.
uv pip install -e ".[dev]" -r docs/requirements.txt
# TODO(#257): Unpin OpenCV versions once we figure out why frame numbers are mismatching in tests.
# Use headless OpenCV variant on CI to reduce download size.
uv pip uninstall opencv-python opencv-contrib-python
uv pip install "opencv-contrib-python-headless<4.13" --only-binary :all:

- name: Setup FFmpeg
# TODO: This action currently does not work for non-x64 builders (e.g. macos-14):
Expand All @@ -79,7 +82,7 @@ jobs:
- name: Build Package (Headless)
shell: bash
run: |
python dist/tweak_setup_cfg_for_headless.py
python dist/build_headless.py
python -m build
git reset --hard HEAD

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/check-code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ jobs:
- name: Install Dependencies
run: |
uv pip install --upgrade pip
uv pip install --upgrade yapf toml
uv pip install -r requirements_headless.txt
uv pip install --upgrade yapf toml ruff

- name: Check Code Format (yapf)
if: ${{ hashFiles('.style.yapf') != '' }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ jobs:
run: |
uv pip install --upgrade build wheel virtualenv
uv pip install opencv-python-headless opencv-contrib-python-headless --only-binary :all:
uv pip install -r requirements_headless.txt -r docs/requirements.txt
uv pip install -e . -r docs/requirements.txt

- name: Build Package
run: |
python dist/pre_release.py
python -m build
python dist/tweak_setup_cfg_for_headless.py
python dist/build_headless.py
python -m build
mkdir pkg
mv dist/*.tar.gz pkg/
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ site/
build/
# Working directory for distribution assembly
dist/dvr-scan/*
dist/dvr-scan-*
dist/dvr_scan-*

# Editors/environment
.DS_Store
Expand Down
4 changes: 4 additions & 0 deletions dist/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!*.py
!*.txt
!.gitignore
48 changes: 48 additions & 0 deletions dist/build_headless.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# DVR-Scan: Video Motion Event Detection & Extraction Tool
# --------------------------------------------------------------
# [ Site: https://www.dvr-scan.com/ ]
# [ Repo: https://github.com/Breakthrough/DVR-Scan ]
#
# Copyright (C) 2016 Brandon Castellano <http://www.bcastell.com>.
#

# This script generates a headless (no GUI) version of the package
# by modifying the pyproject.toml file. When the project is next built,
# the headless variant will be used.
#
# *WARNING*: This modifies the existing pyproject.toml file in place.
# The changes must be reverted to restore the full package.
#

import os
import re

# Correctly locate pyproject.toml relative to the script's location
script_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.abspath(os.path.join(script_dir, ".."))
pyproject_path = os.path.join(project_root, "pyproject.toml")

with open(pyproject_path, "r") as f:
content = f.read()

# Rename package to headless variant
assert 'name = "dvr-scan"' in content
content = content.replace('name = "dvr-scan"', 'name = "dvr-scan-headless"', 1)

# Remove dvr-scan-app entry point
assert "dvr-scan-app" in content
content = re.sub(r'^dvr-scan-app\s*=.*\n', "", content, flags=re.MULTILINE)

# Swap GUI opencv for headless opencv
assert "opencv-contrib-python<4.13" in content
content = content.replace('"opencv-contrib-python<4.13"', '"opencv-contrib-python-headless<4.13"', 1)

# Remove screeninfo (GUI dependency)
assert "screeninfo" in content
content = re.sub(r'^\s*"screeninfo",?\n', "", content, flags=re.MULTILINE)

with open(pyproject_path, "w") as f:
f.write(content)

print("Successfully generated headless pyproject.toml.")
59 changes: 0 additions & 59 deletions dist/tweak_setup_cfg_for_headless.py

This file was deleted.

76 changes: 75 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,79 @@
# LICENSE file, or visit one of the above pages for details.
#
[build-system]
requires = ["setuptools"]
requires = ["setuptools>=64"]
build-backend = "setuptools.build_meta"

[project]
name = "dvr-scan"
dynamic = ["version"]
description = "Tool for finding and extracting motion events in video files (e.g. security camera footage)."
readme = "README.md"
license = { text = "BSD-2-Clause" }
requires-python = ">=3.10"
authors = [
{ name = "Brandon Castellano", email = "brandon248@gmail.com" },
]
keywords = [
"analysis",
"computer-vision",
"video",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Environment :: Console :: Curses",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Multimedia :: Video",
"Topic :: Multimedia :: Video :: Conversion",
"Topic :: Multimedia :: Video :: Non-Linear Editor",
"Topic :: Utilities",
]
dependencies = [
"numpy",
"platformdirs",
"scenedetect>=0.6.2",
"tqdm",
"pillow",
# TODO(#257): Unpin OpenCV versions once we figure out why frame numbers are mismatching in tests.
"opencv-contrib-python<4.13",
"screeninfo",
]

[project.optional-dependencies]
dev = [
"pytest",
"ruff",
]

[project.scripts]
dvr-scan = "dvr_scan.__main__:main"
dvr-scan-app = "dvr_scan.app.__main__:main"

[project.urls]
"Bug Tracker" = "https://github.com/Breakthrough/DVR-Scan/issues"
Documentation = "https://www.dvr-scan.com/docs"
Homepage = "https://www.dvr-scan.com/"
Repository = "https://github.com/Breakthrough/DVR-Scan"

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
include = ["dvr_scan*"]

[tool.setuptools.dynamic]
version = {attr = "dvr_scan.__version__"}

[tool.ruff]
exclude = [
"docs"
Expand Down Expand Up @@ -43,3 +113,7 @@ select = [
]
fixable = ["ALL"]
unfixable = []

[tool.pytest.ini_options]
addopts = "--verbose"
python_files = ["tests/*.py"]
12 changes: 0 additions & 12 deletions requirements.txt

This file was deleted.

11 changes: 0 additions & 11 deletions requirements_headless.txt

This file was deleted.

17 changes: 0 additions & 17 deletions setup.py

This file was deleted.

Loading