diff --git a/pyproject.toml b/pyproject.toml index 767536ab..3bc44f9e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ name = "lsst-obs-lsst" obs_lsst = "lsst.obs.lsst.cli:get_cli_subcommands" [project.entry-points.astro_metadata_translators] -obs_lsst = "lsst.obs.lsst.translators:_force_load" +obs_lsst = "lsst.obs.lsst.translators:_register_translators" [tool.ruff] line-length = 110 diff --git a/python/lsst/obs/lsst/translators/__init__.py b/python/lsst/obs/lsst/translators/__init__.py index 92e6278a..9677ad0a 100644 --- a/python/lsst/obs/lsst/translators/__init__.py +++ b/python/lsst/obs/lsst/translators/__init__.py @@ -20,8 +20,24 @@ from .lsstCamSim import * -def _force_load(): - # This function exists solely to be loaded by the - # astro_metadata_translators entry point. The function - # will not be called. - pass +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, + ]