pyobs-flipro 2.0.0.dev6__tar.gz → 2.0.0.dev9__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_flipro-2.0.0.dev9/.github/dependabot.yml +15 -0
- pyobs_flipro-2.0.0.dev9/.github/workflows/pypi.yml +65 -0
- pyobs_flipro-2.0.0.dev9/.github/workflows/pyrefly.yml +26 -0
- pyobs_flipro-2.0.0.dev9/.github/workflows/pytest.yml +28 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/PKG-INFO +3 -3
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/pyobs_flipro/fliprocamera.py +11 -7
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/pyproject.toml +19 -4
- pyobs_flipro-2.0.0.dev9/tests/test_fliprocamera.py +99 -0
- pyobs_flipro-2.0.0.dev9/tests/test_import.py +23 -0
- pyobs_flipro-2.0.0.dev9/uv.lock +3148 -0
- pyobs_flipro-2.0.0.dev6/.github/workflows/pypi.yml +0 -26
- pyobs_flipro-2.0.0.dev6/uv.lock +0 -2620
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/.github/workflows/ruff.yml +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/.pre-commit-config.yaml +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/.readthedocs.yml +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/CMakeLists.txt +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/LICENSE +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/README.md +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/docs/Makefile +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/docs/make.bat +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/docs/requirements.txt +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/docs/source/_static/pyobs.gif +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/docs/source/conf.py +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/docs/source/index.rst +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/lib/libflipro.h +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/lib/liblibflialgo.so +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/lib/liblibflipro.so +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/poetry.lock +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/pyobs_flipro/__init__.py +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/pyobs_flipro/fliprodriver.pyx +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/pyobs_flipro/gui.py +0 -0
- {pyobs_flipro-2.0.0.dev6 → pyobs_flipro-2.0.0.dev9}/pyobs_flipro/libflipro.pxd +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: Publish package to PyPI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags:
|
|
5
|
+
- 'v*'
|
|
6
|
+
jobs:
|
|
7
|
+
build-wheels:
|
|
8
|
+
name: Build wheels
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: Check out repository code
|
|
12
|
+
uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Build wheels
|
|
15
|
+
uses: pypa/cibuildwheel@v4.2.0
|
|
16
|
+
|
|
17
|
+
- name: Upload wheels
|
|
18
|
+
uses: actions/upload-artifact@v4
|
|
19
|
+
with:
|
|
20
|
+
name: wheels
|
|
21
|
+
path: wheelhouse/*.whl
|
|
22
|
+
|
|
23
|
+
build-sdist:
|
|
24
|
+
name: Build sdist
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- name: Check out repository code
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: Set up Python
|
|
31
|
+
uses: astral-sh/setup-uv@v5
|
|
32
|
+
with:
|
|
33
|
+
enable-cache: true
|
|
34
|
+
python-version: "3.13"
|
|
35
|
+
|
|
36
|
+
- name: Build sdist
|
|
37
|
+
run: uv build --sdist
|
|
38
|
+
|
|
39
|
+
- name: Upload sdist
|
|
40
|
+
uses: actions/upload-artifact@v4
|
|
41
|
+
with:
|
|
42
|
+
name: sdist
|
|
43
|
+
path: dist/*.tar.gz
|
|
44
|
+
|
|
45
|
+
publish:
|
|
46
|
+
name: Publish to PyPI
|
|
47
|
+
needs: [build-wheels, build-sdist]
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
- name: Download artifacts
|
|
51
|
+
uses: actions/download-artifact@v4
|
|
52
|
+
with:
|
|
53
|
+
path: dist
|
|
54
|
+
merge-multiple: true
|
|
55
|
+
|
|
56
|
+
- name: Set up Python
|
|
57
|
+
uses: astral-sh/setup-uv@v5
|
|
58
|
+
with:
|
|
59
|
+
enable-cache: false
|
|
60
|
+
python-version: "3.13"
|
|
61
|
+
|
|
62
|
+
- name: Publish
|
|
63
|
+
env:
|
|
64
|
+
PYPI_TOKEN: ${{ secrets.pypi_password }}
|
|
65
|
+
run: uv publish --token $PYPI_TOKEN dist/*
|
|
@@ -0,0 +1,26 @@
|
|
|
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 system dependencies
|
|
20
|
+
run: sudo apt-get install -y libcfitsio-dev libusb-1.0-0-dev
|
|
21
|
+
|
|
22
|
+
- name: Install packages
|
|
23
|
+
run: uv sync --all-extras --dev
|
|
24
|
+
|
|
25
|
+
- name: Run pyrefly
|
|
26
|
+
run: uv run pyrefly check
|
|
@@ -0,0 +1,28 @@
|
|
|
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 system dependencies
|
|
20
|
+
run: sudo apt-get install -y libcfitsio-dev libusb-1.0-0-dev
|
|
21
|
+
|
|
22
|
+
- name: Install packages
|
|
23
|
+
run: uv sync --all-extras --dev
|
|
24
|
+
|
|
25
|
+
- name: Run tests
|
|
26
|
+
run: uv run pytest tests
|
|
27
|
+
env:
|
|
28
|
+
CI: true
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyobs-flipro
|
|
3
|
-
Version: 2.0.0.
|
|
3
|
+
Version: 2.0.0.dev9
|
|
4
4
|
Summary: pyobs module for FLIPRO cameras
|
|
5
5
|
Author-Email: Tim-Oliver Husser <thusser@uni-goettingen.de>
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Requires-Python: >=3.11
|
|
8
8
|
Requires-Dist: astropy<8,>=7.0.1
|
|
9
9
|
Requires-Dist: numpy<3,>=2.2.5
|
|
10
|
-
Requires-Dist: pyobs-core<3,>=2.0.0.
|
|
10
|
+
Requires-Dist: pyobs-core<3,>=2.0.0.dev48
|
|
11
11
|
Provides-Extra: gui
|
|
12
|
-
Requires-Dist: pyobs-core[gui]<3,>=2.0.0.
|
|
12
|
+
Requires-Dist: pyobs-core[gui]<3,>=2.0.0.dev48; extra == "gui"
|
|
13
13
|
Requires-Dist: qasync>=0.27; extra == "gui"
|
|
14
14
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import asyncio
|
|
2
4
|
import logging
|
|
3
5
|
import math
|
|
@@ -5,18 +7,21 @@ import threading
|
|
|
5
7
|
import time
|
|
6
8
|
from collections.abc import Callable
|
|
7
9
|
from datetime import UTC, datetime
|
|
8
|
-
from typing import Any, TypeVar, cast
|
|
10
|
+
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
|
9
11
|
|
|
10
12
|
import numpy as np
|
|
11
13
|
from pyobs.images import Image
|
|
12
14
|
from pyobs.interfaces import IAbortable, IBinning, ICamera, ICooling, ITemperatures, IWindow
|
|
13
|
-
from pyobs.interfaces.IBinning import BinningCapabilities, BinningState
|
|
15
|
+
from pyobs.interfaces.IBinning import Binning, BinningCapabilities, BinningState
|
|
14
16
|
from pyobs.interfaces.ICooling import CoolingState
|
|
15
17
|
from pyobs.interfaces.ITemperatures import SensorReading, TemperaturesState
|
|
16
18
|
from pyobs.interfaces.IWindow import WindowCapabilities, WindowState
|
|
17
19
|
from pyobs.modules.camera.basecamera import BaseCamera
|
|
18
20
|
from pyobs.utils.enums import ExposureStatus
|
|
19
21
|
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from .fliprodriver import DeviceCaps, DeviceInfo, FliProDriver
|
|
24
|
+
|
|
20
25
|
log = logging.getLogger(__name__)
|
|
21
26
|
|
|
22
27
|
_T = TypeVar("_T")
|
|
@@ -46,7 +51,6 @@ class FliProCamera(BaseCamera, ICamera, IAbortable, IWindow, IBinning, ICooling,
|
|
|
46
51
|
setpoint: Cooling temperature setpoint.
|
|
47
52
|
"""
|
|
48
53
|
BaseCamera.__init__(self, **kwargs)
|
|
49
|
-
from .fliprodriver import DeviceCaps, DeviceInfo, FliProDriver # type: ignore
|
|
50
54
|
|
|
51
55
|
# variables
|
|
52
56
|
self._driver: FliProDriver | None = None
|
|
@@ -173,10 +177,10 @@ class FliProCamera(BaseCamera, ICamera, IAbortable, IWindow, IBinning, ICooling,
|
|
|
173
177
|
IBinning,
|
|
174
178
|
BinningCapabilities(
|
|
175
179
|
binnings=[
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
+
Binning(x=1, y=1),
|
|
181
|
+
Binning(x=2, y=2),
|
|
182
|
+
Binning(x=3, y=3),
|
|
183
|
+
Binning(x=4, y=4),
|
|
180
184
|
]
|
|
181
185
|
),
|
|
182
186
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pyobs-flipro"
|
|
3
|
-
version = "2.0.0.
|
|
3
|
+
version = "2.0.0.dev9"
|
|
4
4
|
description = "pyobs module for FLIPRO cameras"
|
|
5
5
|
authors = [{ name = "Tim-Oliver Husser", email = "thusser@uni-goettingen.de" }]
|
|
6
6
|
requires-python = ">=3.11"
|
|
@@ -8,21 +8,23 @@ license = "MIT"
|
|
|
8
8
|
dependencies = [
|
|
9
9
|
"astropy>=7.0.1,<8",
|
|
10
10
|
"numpy>=2.2.5,<3",
|
|
11
|
-
"pyobs-core>=2.0.0.
|
|
11
|
+
"pyobs-core>=2.0.0.dev48,<3",
|
|
12
12
|
]
|
|
13
13
|
|
|
14
14
|
[project.optional-dependencies]
|
|
15
15
|
gui = [
|
|
16
|
-
"pyobs-core[gui]>=2.0.0.
|
|
16
|
+
"pyobs-core[gui]>=2.0.0.dev48,<3",
|
|
17
17
|
"qasync>=0.27",
|
|
18
18
|
]
|
|
19
19
|
|
|
20
20
|
[dependency-groups]
|
|
21
21
|
dev = [
|
|
22
|
-
"black>=25.1.0,<
|
|
22
|
+
"black>=25.1.0,<27",
|
|
23
23
|
"pre-commit>=4.2.0,<5",
|
|
24
24
|
"ruff>=0.9.0",
|
|
25
25
|
"pyrefly>=1.1.1",
|
|
26
|
+
"pytest>=8.0.0",
|
|
27
|
+
"pytest-asyncio>=0.24.0",
|
|
26
28
|
]
|
|
27
29
|
|
|
28
30
|
[project.scripts]
|
|
@@ -31,6 +33,15 @@ flipro-gui = "pyobs_flipro.gui:main"
|
|
|
31
33
|
[tool.scikit-build]
|
|
32
34
|
wheel.packages = ["pyobs_flipro"]
|
|
33
35
|
|
|
36
|
+
[tool.cibuildwheel]
|
|
37
|
+
build = "cp311-* cp312-* cp313-* cp314-*"
|
|
38
|
+
skip = "*-musllinux_* *-manylinux_i686"
|
|
39
|
+
archs = ["x86_64"]
|
|
40
|
+
|
|
41
|
+
[tool.cibuildwheel.linux]
|
|
42
|
+
manylinux-x86_64-image = "manylinux_2_28"
|
|
43
|
+
before-all = "dnf install -y epel-release && dnf install -y cfitsio-devel libusbx-devel"
|
|
44
|
+
|
|
34
45
|
[build-system]
|
|
35
46
|
requires = ["scikit_build_core>=0.12", "cython>=3.0", "cython-cmake", "numpy>=2.0"]
|
|
36
47
|
build-backend = "scikit_build_core.build"
|
|
@@ -49,3 +60,7 @@ select = ["E", "F", "W", "I", "UP", "G"]
|
|
|
49
60
|
[tool.pyrefly]
|
|
50
61
|
python-version = "3.11"
|
|
51
62
|
ignore-missing-imports = []
|
|
63
|
+
project-excludes = ["pyobs_flipro/gui.py"]
|
|
64
|
+
|
|
65
|
+
[tool.pytest.ini_options]
|
|
66
|
+
asyncio_mode = "strict"
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""Unit tests for the non-hardware logic in FliProCamera: constructor defaults, the
|
|
2
|
+
window/binning setters, and the _run_blocking/_run_blocking_or_raise thread wrappers.
|
|
3
|
+
|
|
4
|
+
Hardware I/O (opening, exposing, reading out) is out of scope here.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import asyncio
|
|
8
|
+
import threading
|
|
9
|
+
from unittest.mock import AsyncMock
|
|
10
|
+
|
|
11
|
+
import pytest
|
|
12
|
+
from pyobs.interfaces import IBinning, IWindow
|
|
13
|
+
|
|
14
|
+
from pyobs_flipro import FliProCamera
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_constructor_defaults() -> None:
|
|
18
|
+
camera = FliProCamera(-20.0)
|
|
19
|
+
assert camera._temp_setpoint == -20.0
|
|
20
|
+
assert camera._cooling_enabled is False
|
|
21
|
+
assert camera._window == (0, 0, 0, 0)
|
|
22
|
+
assert camera._binning == (1, 1)
|
|
23
|
+
assert camera._driver is None
|
|
24
|
+
assert camera._device is None
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@pytest.mark.asyncio
|
|
28
|
+
async def test_set_window() -> None:
|
|
29
|
+
camera = FliProCamera(-20.0)
|
|
30
|
+
camera.comm.set_state = AsyncMock() # type: ignore[method-assign]
|
|
31
|
+
|
|
32
|
+
await camera.set_window(10, 20, 100, 200)
|
|
33
|
+
|
|
34
|
+
assert camera._window == (10, 20, 100, 200)
|
|
35
|
+
assert camera.comm.set_state.await_args is not None
|
|
36
|
+
interface, state = camera.comm.set_state.await_args.args
|
|
37
|
+
assert interface is IWindow
|
|
38
|
+
assert (state.x, state.y, state.width, state.height) == (10, 20, 100, 200)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@pytest.mark.asyncio
|
|
42
|
+
async def test_set_binning() -> None:
|
|
43
|
+
camera = FliProCamera(-20.0)
|
|
44
|
+
camera.comm.set_state = AsyncMock() # type: ignore[method-assign]
|
|
45
|
+
|
|
46
|
+
await camera.set_binning(2, 3)
|
|
47
|
+
|
|
48
|
+
assert camera._binning == (2, 3)
|
|
49
|
+
assert camera.comm.set_state.await_args is not None
|
|
50
|
+
interface, state = camera.comm.set_state.await_args.args
|
|
51
|
+
assert interface is IBinning
|
|
52
|
+
assert (state.x, state.y) == (2, 3)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@pytest.mark.asyncio
|
|
56
|
+
async def test_set_cooling_requires_driver() -> None:
|
|
57
|
+
camera = FliProCamera(-20.0)
|
|
58
|
+
with pytest.raises(ValueError):
|
|
59
|
+
await camera.set_cooling(True, -20.0)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@pytest.mark.asyncio
|
|
63
|
+
async def test_run_blocking_runs_func_and_returns_true() -> None:
|
|
64
|
+
ran: list[bool] = []
|
|
65
|
+
|
|
66
|
+
def fast() -> None:
|
|
67
|
+
ran.append(True)
|
|
68
|
+
|
|
69
|
+
assert await FliProCamera._run_blocking(fast) is True
|
|
70
|
+
assert ran == [True]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@pytest.mark.asyncio
|
|
74
|
+
async def test_run_blocking_times_out() -> None:
|
|
75
|
+
done = threading.Event()
|
|
76
|
+
|
|
77
|
+
def slow() -> None:
|
|
78
|
+
done.wait()
|
|
79
|
+
|
|
80
|
+
assert await FliProCamera._run_blocking(slow, timeout=0.01) is False
|
|
81
|
+
done.set()
|
|
82
|
+
await asyncio.sleep(0.05)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@pytest.mark.asyncio
|
|
86
|
+
async def test_run_blocking_or_raise_returns_value() -> None:
|
|
87
|
+
camera = FliProCamera(-20.0)
|
|
88
|
+
assert await camera._run_blocking_or_raise(lambda: 42) == 42
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@pytest.mark.asyncio
|
|
92
|
+
async def test_run_blocking_or_raise_reraises() -> None:
|
|
93
|
+
camera = FliProCamera(-20.0)
|
|
94
|
+
|
|
95
|
+
def boom() -> int:
|
|
96
|
+
raise ValueError("boom")
|
|
97
|
+
|
|
98
|
+
with pytest.raises(ValueError):
|
|
99
|
+
await camera._run_blocking_or_raise(boom)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Smoke tests: import the driver and instantiate it without hardware, asserting the
|
|
2
|
+
interfaces it claims.
|
|
3
|
+
|
|
4
|
+
The Cython extension (fliprodriver) links the bundled FLIPRO .so libraries during
|
|
5
|
+
install, but device enumeration/opening only happens inside open(), so instantiation
|
|
6
|
+
is safe with no FLIPRO hardware attached.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from pyobs.interfaces import IAbortable, IBinning, ICamera, ICooling, ITemperatures, IWindow
|
|
10
|
+
from pyobs.modules import Module
|
|
11
|
+
|
|
12
|
+
from pyobs_flipro import FliProCamera
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_instantiate_camera() -> None:
|
|
16
|
+
camera = FliProCamera(-20.0)
|
|
17
|
+
assert isinstance(camera, Module)
|
|
18
|
+
assert isinstance(camera, ICamera)
|
|
19
|
+
assert isinstance(camera, IWindow)
|
|
20
|
+
assert isinstance(camera, IBinning)
|
|
21
|
+
assert isinstance(camera, ICooling)
|
|
22
|
+
assert isinstance(camera, ITemperatures)
|
|
23
|
+
assert isinstance(camera, IAbortable)
|