pyobs-sbig 2.0.0.dev6__tar.gz → 2.0.0.dev8__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.
Files changed (39) hide show
  1. pyobs_sbig-2.0.0.dev8/.github/dependabot.yml +15 -0
  2. pyobs_sbig-2.0.0.dev8/.github/workflows/pypi.yml +65 -0
  3. pyobs_sbig-2.0.0.dev8/.github/workflows/pyrefly.yml +26 -0
  4. pyobs_sbig-2.0.0.dev8/.github/workflows/pytest.yml +28 -0
  5. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/CMakeLists.txt +8 -7
  6. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/PKG-INFO +4 -4
  7. pyobs_sbig-2.0.0.dev8/lib/libsbigudrv.so +0 -0
  8. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/pyproject.toml +20 -5
  9. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/pyobs_sbig/sbigcamera.py +2 -2
  10. pyobs_sbig-2.0.0.dev8/tests/test_import.py +35 -0
  11. pyobs_sbig-2.0.0.dev8/tests/test_sbigcamera.py +90 -0
  12. pyobs_sbig-2.0.0.dev8/tests/test_sbigfiltercamera.py +30 -0
  13. pyobs_sbig-2.0.0.dev8/uv.lock +3184 -0
  14. pyobs_sbig-2.0.0.dev6/.github/workflows/pypi.yml +0 -26
  15. pyobs_sbig-2.0.0.dev6/uv.lock +0 -2952
  16. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/.github/workflows/ruff.yml +0 -0
  17. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/.pre-commit-config.yaml +0 -0
  18. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/.readthedocs.yml +0 -0
  19. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/CHANGELOG.rst +0 -0
  20. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/LICENSE +0 -0
  21. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/README.md +0 -0
  22. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/docs/Makefile +0 -0
  23. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/docs/make.bat +0 -0
  24. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/docs/requirements.txt +0 -0
  25. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/docs/source/_static/pyobs.gif +0 -0
  26. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/docs/source/conf.py +0 -0
  27. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/docs/source/index.rst +0 -0
  28. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/pyobs_sbig/__init__.py +0 -0
  29. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/pyobs_sbig/gui.py +0 -0
  30. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/pyobs_sbig/sbig6303e.py +0 -0
  31. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/pyobs_sbig/sbigfiltercamera.py +0 -0
  32. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/pyobs_sbig/sbigudrv.pxd +0 -0
  33. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/pyobs_sbig/sbigudrv.pyx +0 -0
  34. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/sbigudrv/csbigcam.cpp +0 -0
  35. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/sbigudrv/csbigcam.h +0 -0
  36. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/sbigudrv/csbigimg.cpp +0 -0
  37. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/sbigudrv/csbigimg.h +0 -0
  38. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/sbigudrv/lpardrv.h +0 -0
  39. {pyobs_sbig-2.0.0.dev6 → pyobs_sbig-2.0.0.dev8}/src/sbigudrv/sbigudrv.h +0 -0
@@ -0,0 +1,15 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "uv"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ day: "tuesday"
8
+ target-branch: "develop"
9
+ groups:
10
+ patch-and-minor:
11
+ update-types:
12
+ - "minor"
13
+ - "patch"
14
+ labels:
15
+ - "dependencies"
@@ -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
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
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
@@ -57,24 +57,25 @@ set_target_properties(sbigudrv PROPERTIES
57
57
  OUTPUT_NAME "sbigudrv"
58
58
  SUFFIX "${PY_EXT_SUFFIX}"
59
59
  POSITION_INDEPENDENT_CODE ON
60
+ INSTALL_RPATH "$ORIGIN"
61
+ BUILD_WITH_INSTALL_RPATH ON
60
62
  )
61
63
  message(STATUS "ext: ${PY_EXT_SUFFIX}")
62
64
 
63
- # --- sbigudrv ---
64
- target_include_directories(sbigudrv PRIVATE
65
- ${CMAKE_CURRENT_SOURCE_DIR}/lib/usr/local/include/
66
- )
67
-
68
65
  # --- Link ---
69
66
  find_library(CFITSIO_LIB cfitsio REQUIRED)
70
- find_path(CFITSIO_INCLUDE_DIR fitsio.h REQUIRED)
67
+ find_path(CFITSIO_INCLUDE_DIR NAMES fitsio.h PATH_SUFFIXES cfitsio REQUIRED)
71
68
  target_include_directories(sbigudrv PRIVATE ${CFITSIO_INCLUDE_DIR})
72
69
  target_link_libraries(sbigudrv PRIVATE ${CFITSIO_LIB})
73
70
 
74
- find_library(SBIGUDRV_LIB sbigudrv REQUIRED PATHS /usr/local/lib)
71
+ # --- Bundled SBIG Universal Driver (pre-compiled, shipped in lib/) ---
72
+ set(SBIGUDRV_LIB "${CMAKE_CURRENT_SOURCE_DIR}/lib/libsbigudrv.so")
75
73
  target_link_libraries(sbigudrv PRIVATE ${SBIGUDRV_LIB})
76
74
 
77
75
  # --- Install into package ---
78
76
  install(TARGETS sbigudrv
79
77
  LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME}
80
78
  )
79
+ install(FILES ${SBIGUDRV_LIB}
80
+ DESTINATION ${SKBUILD_PROJECT_NAME}
81
+ )
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyobs-sbig
3
- Version: 2.0.0.dev6
3
+ Version: 2.0.0.dev8
4
4
  Summary: pyobs module for SBIG cameras
5
5
  Author-Email: Tim-Oliver Husser <thusser@uni-goettingen.de>
6
6
  License-Expression: MIT
7
- Requires-Python: <3.15,>=3.11
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.dev6
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.dev6; extra == "gui"
12
+ Requires-Dist: pyobs-core[gui]<3,>=2.0.0.dev48; extra == "gui"
13
13
  Requires-Dist: qasync>=0.28.0; extra == "gui"
14
14
 
Binary file
@@ -1,29 +1,31 @@
1
1
  [project]
2
2
  name = "pyobs-sbig"
3
- version = "2.0.0.dev6"
3
+ version = "2.0.0.dev8"
4
4
  description = "pyobs module for SBIG cameras"
5
5
  authors = [{ name = "Tim-Oliver Husser", email = "thusser@uni-goettingen.de" }]
6
- requires-python = ">=3.11,<3.15"
6
+ requires-python = ">=3.11"
7
7
  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.dev6,<3",
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.dev6,<3",
16
+ "pyobs-core[gui]>=2.0.0.dev48,<3",
17
17
  "qasync>=0.28.0",
18
18
  ]
19
19
 
20
20
  [dependency-groups]
21
21
  dev = [
22
- "black>=25.1.0,<26",
22
+ "black>=25.1.0,<27",
23
23
  "ruff>=0.9.0",
24
24
  "pyrefly>=1.1.1",
25
25
  "pre-commit>=4.2.0,<5",
26
26
  "cython>=3.0.0,<4",
27
+ "pytest>=8.0.0",
28
+ "pytest-asyncio>=0.24.0",
27
29
  ]
28
30
 
29
31
  [project.scripts]
@@ -35,6 +37,15 @@ py-modules = []
35
37
  [tool.scikit-build]
36
38
  wheel.packages = ["src/pyobs_sbig"]
37
39
 
40
+ [tool.cibuildwheel]
41
+ build = "cp311-* cp312-* cp313-* cp314-*"
42
+ skip = "*-musllinux_* *-manylinux_i686"
43
+ archs = ["x86_64"]
44
+
45
+ [tool.cibuildwheel.linux]
46
+ manylinux-x86_64-image = "manylinux_2_28"
47
+ before-all = "dnf install -y epel-release && dnf install -y cfitsio-devel libusbx-devel systemd-devel"
48
+
38
49
  [build-system]
39
50
  requires = ["scikit_build_core>=0.12", "cython>=3.0", "cython-cmake", "numpy>=2.0"]
40
51
  build-backend = "scikit_build_core.build"
@@ -53,3 +64,7 @@ select = ["E", "F", "W", "I", "UP", "G"]
53
64
  [tool.pyrefly]
54
65
  python-version = "3.11"
55
66
  ignore-missing-imports = ["PySide6.*", "qasync.*"]
67
+ project-excludes = ["src/pyobs_sbig/gui.py"]
68
+
69
+ [tool.pytest.ini_options]
70
+ asyncio_mode = "strict"
@@ -10,7 +10,7 @@ from typing import Any, TypeVar, cast
10
10
  import numpy as np
11
11
  from pyobs.images import Image
12
12
  from pyobs.interfaces import IAbortable, IBinning, ICamera, ICooling, ITemperatures, IWindow
13
- from pyobs.interfaces.IBinning import BinningCapabilities, BinningState
13
+ from pyobs.interfaces.IBinning import Binning, BinningCapabilities, BinningState
14
14
  from pyobs.interfaces.ICooling import CoolingState
15
15
  from pyobs.interfaces.ITemperatures import SensorReading, TemperaturesState
16
16
  from pyobs.interfaces.IWindow import WindowCapabilities, WindowState
@@ -159,7 +159,7 @@ class SbigCamera(BaseCamera, ICamera, IWindow, IBinning, ICooling, ITemperatures
159
159
  )
160
160
  await self.comm.set_capabilities(
161
161
  IBinning,
162
- BinningCapabilities(binnings=[BinningState(x=1, y=1), BinningState(x=2, y=2), BinningState(x=3, y=3)]),
162
+ BinningCapabilities(binnings=[Binning(x=1, y=1), Binning(x=2, y=2), Binning(x=3, y=3)]),
163
163
  )
164
164
  await self.comm.set_state(IBinning, BinningState(x=self._binning[0], y=self._binning[1]))
165
165
 
@@ -0,0 +1,35 @@
1
+ """Smoke tests: import the drivers and instantiate them without hardware, asserting
2
+ the interfaces they claim.
3
+
4
+ The Cython extension (sbigudrv) links the bundled SBIG Universal Driver during
5
+ install, but the device link is only established inside open(), so instantiation is
6
+ safe with no SBIG hardware attached.
7
+ """
8
+
9
+ from pyobs.interfaces import IAbortable, IBinning, ICamera, ICooling, IFilters, ITemperatures, IWindow
10
+ from pyobs.modules import Module
11
+
12
+ from pyobs_sbig import Sbig6303eCamera, SbigCamera, SbigFilterCamera
13
+
14
+
15
+ def test_instantiate_camera() -> None:
16
+ camera = SbigCamera()
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)
24
+
25
+
26
+ def test_instantiate_filter_camera() -> None:
27
+ camera = SbigFilterCamera(filter_wheel="CFW10")
28
+ assert isinstance(camera, Module)
29
+ assert isinstance(camera, IFilters)
30
+
31
+
32
+ def test_instantiate_6303e() -> None:
33
+ camera = Sbig6303eCamera(filter_wheel="CFW10")
34
+ assert isinstance(camera, Module)
35
+ assert isinstance(camera, IFilters)
@@ -0,0 +1,90 @@
1
+ """Unit tests for the non-hardware logic in SbigCamera: constructor defaults, the
2
+ window/binning setters, and the _run_blocking/_run_blocking_or_raise wrappers.
3
+
4
+ Hardware I/O (establishing the link, 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_sbig import SbigCamera
15
+
16
+
17
+ def test_constructor_defaults() -> None:
18
+ camera = SbigCamera()
19
+ assert camera._setpoint == -20
20
+ assert camera._window == (0, 0, 0, 0)
21
+ assert camera._binning == (1, 1)
22
+ assert camera._full_frame == (0, 0, 0, 0)
23
+
24
+
25
+ @pytest.mark.asyncio
26
+ async def test_set_window() -> None:
27
+ camera = SbigCamera()
28
+ camera.comm.set_state = AsyncMock() # type: ignore[method-assign]
29
+
30
+ await camera.set_window(10, 20, 100, 200)
31
+
32
+ assert camera._window == (10, 20, 100, 200)
33
+ assert camera.comm.set_state.await_args is not None
34
+ interface, state = camera.comm.set_state.await_args.args
35
+ assert interface is IWindow
36
+ assert (state.x, state.y, state.width, state.height) == (10, 20, 100, 200)
37
+
38
+
39
+ @pytest.mark.asyncio
40
+ async def test_set_binning() -> None:
41
+ camera = SbigCamera()
42
+ camera.comm.set_state = AsyncMock() # type: ignore[method-assign]
43
+
44
+ await camera.set_binning(2, 3)
45
+
46
+ assert camera._binning == (2, 3)
47
+ assert camera.comm.set_state.await_args is not None
48
+ interface, state = camera.comm.set_state.await_args.args
49
+ assert interface is IBinning
50
+ assert (state.x, state.y) == (2, 3)
51
+
52
+
53
+ @pytest.mark.asyncio
54
+ async def test_run_blocking_runs_func_and_returns_true() -> None:
55
+ ran: list[bool] = []
56
+
57
+ def fast() -> None:
58
+ ran.append(True)
59
+
60
+ assert await SbigCamera._run_blocking(fast) is True
61
+ assert ran == [True]
62
+
63
+
64
+ @pytest.mark.asyncio
65
+ async def test_run_blocking_times_out() -> None:
66
+ done = threading.Event()
67
+
68
+ def slow() -> None:
69
+ done.wait()
70
+
71
+ assert await SbigCamera._run_blocking(slow, timeout=0.01) is False
72
+ done.set()
73
+ await asyncio.sleep(0.05)
74
+
75
+
76
+ @pytest.mark.asyncio
77
+ async def test_run_blocking_or_raise_returns_value() -> None:
78
+ camera = SbigCamera()
79
+ assert await camera._run_blocking_or_raise(lambda: 42) == 42
80
+
81
+
82
+ @pytest.mark.asyncio
83
+ async def test_run_blocking_or_raise_reraises() -> None:
84
+ camera = SbigCamera()
85
+
86
+ def boom() -> int:
87
+ raise ValueError("boom")
88
+
89
+ with pytest.raises(ValueError):
90
+ await camera._run_blocking_or_raise(boom)
@@ -0,0 +1,30 @@
1
+ """Unit tests for the non-hardware logic in SbigFilterCamera: filter-name mapping
2
+ and set_filter validation.
3
+
4
+ The SBIG Universal Driver is mocked out / not touched; only the name<->position
5
+ mapping and validation are exercised.
6
+ """
7
+
8
+ import pytest
9
+ from pyobs.utils import exceptions as exc
10
+
11
+ from pyobs_sbig import SbigFilterCamera
12
+
13
+
14
+ def test_filter_names_default() -> None:
15
+ camera = SbigFilterCamera(filter_wheel="CFW10")
16
+ assert "UNKNOWN" in camera._filter_names.values()
17
+ assert len(camera._filter_names) == 11 # 10 positions + UNKNOWN
18
+
19
+
20
+ def test_filter_names_custom() -> None:
21
+ names = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
22
+ camera = SbigFilterCamera(filter_wheel="CFW10", filter_names=names)
23
+ assert set(names).issubset(set(camera._filter_names.values()))
24
+
25
+
26
+ @pytest.mark.asyncio
27
+ async def test_set_filter_unknown_name() -> None:
28
+ camera = SbigFilterCamera(filter_wheel="CFW10")
29
+ with pytest.raises(exc.InvalidArgumentError):
30
+ await camera.set_filter("does-not-exist")