fix(deps): make pygobject an optional extra, not a hard dependency
CI for csaxs_bec / test (pull_request) Successful in 1m47s
Read the Docs Deploy Trigger / trigger-rtd-webhook (push) Successful in 2s
CI for csaxs_bec / test (push) Successful in 1m51s

pygobject ships no PyPI wheels, so pip install always compiles it from
source, which requires the OS gobject-introspection dev package at
install time. As a mandatory dependency this broke plain `pip install
csaxs_bec` on CI and on Read the Docs, neither of which has that
package installed. Move it to the `allied_vision` extra so only hosts
that actually run the camera (which already need Aravis + the OS
package present) opt in via `pip install csaxs_bec[allied_vision]`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit was merged in pull request #285.
This commit is contained in:
x01dc
2026-07-28 13:25:25 +02:00
co-authored by Claude Sonnet 5
parent 27a40518af
commit 89b185eae2
2 changed files with 39 additions and 14 deletions
@@ -29,11 +29,24 @@ needed).
environment, same as the IDS camera tests run without `pyueye`.
- **Talking to real hardware** — two things, both local to the machine running the device
server (or wherever you instantiate `AlliedVisionAravisCamera`/`Camera` directly):
1. **PyGObject** (`pygobject`, the `gi` module) — already listed in `pyproject.toml`,
pinned to `<3.52`. It's the GObject Introspection bridge, not Aravis itself. The pin
matters: PyGObject 3.52+ requires `girepository-2.0` (GLib >=2.80 /
gobject-introspection >=1.80), which RHEL9's system packages don't provide (only the
older `girepository-1.0` via `gobject-introspection` 1.68) — `pip install pygobject`
1. **PyGObject** (`pygobject`, the `gi` module) — the GObject Introspection bridge, not
Aravis itself. It is **not** installed by a plain `pip install csaxs_bec` — it lives
in the `allied_vision` extra (`pyproject.toml`'s `[project.optional-dependencies]`),
pinned to `<3.52`:
```bash
pip install csaxs_bec[allied_vision]
# or, into an existing environment:
pip install "pygobject<3.52"
```
It's opt-in rather than a hard dependency because `pygobject` ships no PyPI wheels —
`pip install` always compiles it from source, which needs the OS
`gobject-introspection` dev package present *at install time* (see below). As a
mandatory dependency this broke plain `pip install csaxs_bec` on CI and on Read the
Docs, neither of which has that OS package (and RTD's build image isn't something we
can add packages to) — so install it explicitly only on hosts that actually run this
camera. The version pin matters too: PyGObject 3.52+ requires `girepository-2.0` (GLib
>=2.80 / gobject-introspection >=1.80), which RHEL9's system packages don't provide
(only the older `girepository-1.0` via `gobject-introspection` 1.68) — installing it
unpinned fails at build time with `Dependency 'girepository-2.0' is required but not
found`. Unpin once deployment hosts move to a newer GLib/gobject-introspection.
2. **Aravis** — a native C library with a GObject Introspection typelib. It is *not* a
@@ -43,9 +56,11 @@ needed).
### Installing PyGObject + Aravis (Linux)
`pygobject` alone (`pip install pygobject`, already in `pyproject.toml`) only gets you the
`gi` bridge — `import gi; gi.require_version("Aravis", "0.8")` will raise until the Aravis
library and its typelib are installed on the system.
Install the OS Aravis/gobject-introspection packages **first** — `pip install
csaxs_bec[allied_vision]` (or `pip install "pygobject<3.52"`) needs the
`gobject-introspection-1.0` pkg-config file present to build, and even once installed,
`import gi; gi.require_version("Aravis", "0.8")` will raise until the Aravis library and
its typelib are also installed on the system.
1. **Debian/Ubuntu** — Aravis and its GObject Introspection bindings are packaged directly:
```bash
+16 -6
View File
@@ -22,12 +22,6 @@ dependencies = [
"rich",
"pyepics",
"pyueye", # for the IDS uEye camera
"pygobject<3.52", # for the AlliedVision Alvium camera (native Aravis/GenICam, no EPICS IOC)
# pinned below 3.52: that version switched to requiring
# girepository-2.0 (GLib >=2.80/gobject-introspection >=1.80),
# which RHEL9's system packages don't provide (only the older
# girepository-1.0 via gobject-introspection 1.68) -- unpin once
# deployment hosts are upgraded past that.
"bec_widgets",
"zmq",
"opencv-python",
@@ -36,6 +30,22 @@ dependencies = [
]
[project.optional-dependencies]
allied_vision = [
"pygobject<3.52", # for the AlliedVision Alvium camera (native Aravis/GenICam, no EPICS IOC)
# pinned below 3.52: that version switched to requiring
# girepository-2.0 (GLib >=2.80/gobject-introspection >=1.80),
# which RHEL9's system packages don't provide (only the older
# girepository-1.0 via gobject-introspection 1.68) -- unpin once
# deployment hosts are upgraded past that.
#
# Kept out of the default dependency set: pygobject ships no
# PyPI wheels, so `pip install` always builds it from source,
# which needs the OS gobject-introspection dev package present
# at *install* time. As a hard dependency this broke plain
# `pip install csaxs_bec` on CI and on Read the Docs (neither
# has that OS package, and RTD's build image isn't ours to
# change) -- see csaxs_bec/devices/allied_vision_cameras/README.md.
]
dev = [
"black",
"copier",