pyobs-v4l 2.0.0.dev4__tar.gz → 2.0.0.dev5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyobs_v4l-2.0.0.dev5/.github/dependabot.yml +15 -0
- pyobs_v4l-2.0.0.dev5/.github/workflows/pyrefly.yml +23 -0
- pyobs_v4l-2.0.0.dev5/.github/workflows/pytest.yml +25 -0
- pyobs_v4l-2.0.0.dev5/PKG-INFO +12 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/pyproject.toml +13 -6
- pyobs_v4l-2.0.0.dev5/tests/test_import.py +19 -0
- pyobs_v4l-2.0.0.dev5/tests/test_v4lcamera.py +45 -0
- pyobs_v4l-2.0.0.dev5/uv.lock +3154 -0
- pyobs_v4l-2.0.0.dev4/PKG-INFO +0 -12
- pyobs_v4l-2.0.0.dev4/uv.lock +0 -2464
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/.github/workflows/pypi.yml +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/.github/workflows/ruff.yml +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/.pre-commit-config.yaml +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/.readthedocs.yml +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/LICENSE +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/README.md +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/docs/Makefile +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/docs/make.bat +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/docs/requirements.txt +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/docs/source/_static/pyobs.gif +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/docs/source/conf.py +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/docs/source/index.rst +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/pyobs_v4l/__init__.py +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/pyobs_v4l/gui.py +0 -0
- {pyobs_v4l-2.0.0.dev4 → pyobs_v4l-2.0.0.dev5}/pyobs_v4l/v4lcamera.py +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: pyrefly
|
|
2
|
+
on: push
|
|
3
|
+
|
|
4
|
+
jobs:
|
|
5
|
+
pyrefly:
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
timeout-minutes: 10
|
|
8
|
+
|
|
9
|
+
steps:
|
|
10
|
+
- name: Check out repository code
|
|
11
|
+
uses: actions/checkout@v4
|
|
12
|
+
|
|
13
|
+
- name: Set up Python
|
|
14
|
+
uses: astral-sh/setup-uv@v5
|
|
15
|
+
with:
|
|
16
|
+
enable-cache: true
|
|
17
|
+
python-version: "3.13"
|
|
18
|
+
|
|
19
|
+
- name: Install packages
|
|
20
|
+
run: uv sync --all-extras --dev
|
|
21
|
+
|
|
22
|
+
- name: Run pyrefly
|
|
23
|
+
run: uv run pyrefly check
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: PyTest
|
|
2
|
+
on: push
|
|
3
|
+
|
|
4
|
+
jobs:
|
|
5
|
+
test:
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
timeout-minutes: 10
|
|
8
|
+
|
|
9
|
+
steps:
|
|
10
|
+
- name: Check out repository code
|
|
11
|
+
uses: actions/checkout@v4
|
|
12
|
+
|
|
13
|
+
- name: Set up Python
|
|
14
|
+
uses: astral-sh/setup-uv@v5
|
|
15
|
+
with:
|
|
16
|
+
enable-cache: true
|
|
17
|
+
python-version: "3.13"
|
|
18
|
+
|
|
19
|
+
- name: Install packages
|
|
20
|
+
run: uv sync --all-extras --dev
|
|
21
|
+
|
|
22
|
+
- name: Run tests
|
|
23
|
+
run: uv run pytest tests
|
|
24
|
+
env:
|
|
25
|
+
CI: true
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pyobs-v4l
|
|
3
|
+
Version: 2.0.0.dev5
|
|
4
|
+
Summary: pyobs module for V4L cameras
|
|
5
|
+
Author-email: Tim-Oliver Husser <thusser@uni-goettingen.de>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Requires-Dist: opencv-python<6,>=4.0
|
|
10
|
+
Requires-Dist: pyobs-core<3,>=2.0.0.dev48
|
|
11
|
+
Provides-Extra: gui
|
|
12
|
+
Requires-Dist: pyobs-core[gui]<3,>=2.0.0.dev48; extra == 'gui'
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pyobs-v4l"
|
|
3
|
-
version = "2.0.0.
|
|
3
|
+
version = "2.0.0.dev5"
|
|
4
4
|
description = "pyobs module for V4L cameras"
|
|
5
5
|
authors = [{ name = "Tim-Oliver Husser", email = "thusser@uni-goettingen.de" }]
|
|
6
|
-
requires-python = ">=3.11
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
7
|
license = "MIT"
|
|
8
8
|
dependencies = [
|
|
9
|
-
"opencv-python>=4.0,<
|
|
10
|
-
"pyobs-core>=2.0.0.
|
|
9
|
+
"opencv-python>=4.0,<6",
|
|
10
|
+
"pyobs-core>=2.0.0.dev48,<3",
|
|
11
11
|
]
|
|
12
12
|
|
|
13
13
|
[project.optional-dependencies]
|
|
14
14
|
gui = [
|
|
15
|
-
"pyobs-core[gui]>=2.0.0.
|
|
15
|
+
"pyobs-core[gui]>=2.0.0.dev48,<3",
|
|
16
16
|
]
|
|
17
17
|
|
|
18
18
|
[project.scripts]
|
|
@@ -20,10 +20,12 @@ v4l-gui = "pyobs_v4l.gui:main"
|
|
|
20
20
|
|
|
21
21
|
[dependency-groups]
|
|
22
22
|
dev = [
|
|
23
|
-
"black>=25.1.0,<
|
|
23
|
+
"black>=25.1.0,<27",
|
|
24
24
|
"ruff>=0.9.0",
|
|
25
25
|
"pyrefly>=1.1.1",
|
|
26
26
|
"pre-commit>=4.2.0,<5",
|
|
27
|
+
"pytest>=8.0.0",
|
|
28
|
+
"pytest-asyncio>=0.24.0",
|
|
27
29
|
]
|
|
28
30
|
|
|
29
31
|
[build-system]
|
|
@@ -43,3 +45,8 @@ select = ["E", "F", "W", "I", "UP", "G"]
|
|
|
43
45
|
|
|
44
46
|
[tool.pyrefly]
|
|
45
47
|
python-version = "3.11"
|
|
48
|
+
replace-imports-with-any = ["cv2"]
|
|
49
|
+
project-excludes = ["pyobs_v4l/gui.py"]
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
asyncio_mode = "strict"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Smoke tests: import the driver and instantiate it without hardware, asserting it
|
|
2
|
+
advertises the interfaces it claims.
|
|
3
|
+
|
|
4
|
+
The V4L2 device is only opened inside the capture loop (after open()), so
|
|
5
|
+
instantiation is safe. ``pyobs_v4l.gui`` is deliberately not imported here -- it pulls
|
|
6
|
+
in PySide6/qasync at module load and needs a display.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from pyobs.interfaces import IImageType, IVideo
|
|
10
|
+
from pyobs.modules import Module
|
|
11
|
+
|
|
12
|
+
from pyobs_v4l import v4lCamera
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_instantiate_camera() -> None:
|
|
16
|
+
camera = v4lCamera()
|
|
17
|
+
assert isinstance(camera, Module)
|
|
18
|
+
assert isinstance(camera, IVideo)
|
|
19
|
+
assert isinstance(camera, IImageType)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Unit tests for the non-hardware logic in v4lCamera: constructor state and the
|
|
2
|
+
_run_blocking timeout wrapper.
|
|
3
|
+
|
|
4
|
+
Opening the V4L2 device and reading frames is out of scope here.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import asyncio
|
|
8
|
+
import threading
|
|
9
|
+
|
|
10
|
+
import pytest
|
|
11
|
+
|
|
12
|
+
from pyobs_v4l import v4lCamera
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_constructor_defaults() -> None:
|
|
16
|
+
camera = v4lCamera()
|
|
17
|
+
assert camera._device == 0
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_constructor_device() -> None:
|
|
21
|
+
camera = v4lCamera(device=3)
|
|
22
|
+
assert camera._device == 3
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@pytest.mark.asyncio
|
|
26
|
+
async def test_run_blocking_runs_func_and_returns_true() -> None:
|
|
27
|
+
ran: list[bool] = []
|
|
28
|
+
|
|
29
|
+
def fast() -> None:
|
|
30
|
+
ran.append(True)
|
|
31
|
+
|
|
32
|
+
assert await v4lCamera._run_blocking(fast) is True
|
|
33
|
+
assert ran == [True]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@pytest.mark.asyncio
|
|
37
|
+
async def test_run_blocking_times_out() -> None:
|
|
38
|
+
done = threading.Event()
|
|
39
|
+
|
|
40
|
+
def slow() -> None:
|
|
41
|
+
done.wait()
|
|
42
|
+
|
|
43
|
+
assert await v4lCamera._run_blocking(slow, timeout=0.01) is False
|
|
44
|
+
done.set()
|
|
45
|
+
await asyncio.sleep(0.05) # let the daemon thread drain before the loop closes
|