Skip to content

Daemon and Python module become linkable libraries - #47

Merged
astronomerdave merged 2 commits into
mainfrom
DH/core-libraries
Oct 6, 2026
Merged

astronomerdave merged 2 commits into
mainfrom
DH/core-libraries

Conversation

@astronomerdave

Copy link
Copy Markdown
Contributor

required to meet camera 2.0 design

The daemon and Python module are now libraries, camerad_daemon and camerad_python, with camerad:: names. The core builds its own camerad and module only when top-level, and an instrument's build declares its own and links these.

External libs moved onto libs that use them.

The module always imports as camera_interface, one instrument per Python process. @mikelangmayr this means package/tracking now builds camera_interface too, so use one environemnt per instrument.

This replaces PR #46 .

Verified locally with generic, hispec, and python.

CI jobs that check out submodules will continnue to fail for now.

core declares its own camerad and module only when top-level
@mikelangmayr

mikelangmayr commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

The library restructure is great!

The second change removes the ability to have per instrument python packages, it would mean one python environment per instrument, for Hispec and possibly for future instruments retaining the flexibility of multiple instrument builds per env would be nice to have.

  with camerad and emulator named for it

* CAMERAD_PYTHON_PACKAGE, empty by default, leaves generic build unchanged
@astronomerdave

Copy link
Copy Markdown
Contributor Author

@mikelangmayr I updated this so that multiple instruments can share one environment without a per-build module name. I made a new install-inly setting, CAMERAD_PYTHON_PACKAGE. When an instrument sets it, the module installs instide a Python package of that name (e.g. camera_interface_tracking/camera_interface...so) along with an __init__.py that re-exports it, so import camera_interface_tracking still works and TrackingCamera.MODULE_NAME doesn't need to change. The instrument package also gets its own camerad-<package> and camerad-emulator-<package>, so nothing collides with the generic install (import camera_interface).

Use a pyproject.toml like this in hispec to build the tracking camera

[build-system]
requires = ["scikit-build-core>=0.10", "pybind11>=2.12"]
build-backend = "scikit_build_core.build"
[project]
name = "camera-interface-tracking"
version = "2.0.0"
[tool.scikit-build]
cmake.version = ">=3.24"
cmake.source-dir = "external/camera-interface"
wheel.packages = []
cmake.define.BUILD_PYTHON_MODULE = "ON"
cmake.define.CONTROLLER = "archon"
cmake.define.INSTRUMENT = "hispec_tracking_camera"
cmake.define.CAMERAD_PYTHON_PACKAGE = "camera_interface_tracking"

So packaging/tracking no longer gives you camera_interface_tracking. This PR removes its module-name line, so pip install ./external/camera-interface/packaging/tracking would now install a plain top-level camera_interface. The pyproject.toml above replaces it, and packaging/tracking will be deleted when the instruments move out of the core.

@mikelangmayr mikelangmayr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Thanks Dave

@astronomerdave
astronomerdave merged commit d4815d1 into main Oct 6, 2026
2 of 6 checks passed
@mikelangmayr
mikelangmayr deleted the DH/core-libraries branch October 6, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants