Skip to content

Commit

Permalink
Merge pull request #594 from lsst/tickets/DM-47972
Browse files Browse the repository at this point in the history
DM-47972: Add entry point for loading translator code automatically
  • Loading branch information
timj authored Jan 13, 2025
2 parents e51df1d + 991283f commit c0c47ff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ name = "lsst-obs-lsst"
[project.entry-points.'butler.cli']
obs_lsst = "lsst.obs.lsst.cli:get_cli_subcommands"

[project.entry-points.astro_metadata_translators]
obs_lsst = "lsst.obs.lsst.translators:_register_translators"

[tool.ruff]
line-length = 110
target-version = "py311"
Expand Down
23 changes: 23 additions & 0 deletions python/lsst/obs/lsst/translators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,26 @@
from .comCam import *
from .comCamSim import *
from .lsstCamSim import *


def _register_translators() -> list[str]:
"""Ensure that the translators are loaded.
When this function is imported we are guaranteed to also import the
translators which will automatically register themselves.
Returns
-------
translators : `list` [ `str` ]
The names of the translators provided by this package.
"""
return [
LsstCamTranslator.name,
LatissTranslator.name,
LsstComCamTranslator.name,
LsstComCamSimTranslator.name,
LsstCamSimTranslator.name,
LsstCamImSimTranslator.name,
LsstUCDCamTranslator.name,
LsstCamPhoSimTranslator.name,
]

0 comments on commit c0c47ff

Please sign in to comment.