Skip to content

Commit

Permalink
Merge pull request #4 from lsst/tickets/DM-47972
Browse files Browse the repository at this point in the history
DM-47972: Add entry point for metadata translator
  • Loading branch information
timj authored Jan 13, 2025
2 parents 7c748bb + 039c6bb commit 49223bf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[project]
name = "lsst-obs-fiberspectrograph"

[project.entry-points.astro_metadata_translators]
obs_fiberspectrograph = "lsst.obs.fiberspectrograph.translator:_register_translators"
14 changes: 14 additions & 0 deletions python/lsst/obs/fiberspectrograph/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,17 @@ def to_visit_id(self):
"""Calculate the visit associated with this exposure.
"""
return self.to_exposure_id()


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 [FiberSpectrographTranslator.name]

0 comments on commit 49223bf

Please sign in to comment.