diff --git a/CHANGES.rst b/CHANGES.rst index 171bb70..377b05a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,11 @@ - Updated ``AstropyRegions`` translator to export ``roi.theta`` angle (supported as of ``glue`` 1.5.0). [#73] -- Added support to import and export specreduce Trace objects. [#72] +- Added support to import and export ``specreduce`` ``Trace`` objects. [#72] + +- Translators for ``CCDData``, ``regions``, ``Spectrum1D``, ``SpectralCube`` + and ``specreduce.tracing.Trace`` objects are now loaded upon availability, + making the corresponding packages optional requirements. [#76] 0.4.0 (2022-04-07) ------------------ diff --git a/glue_astronomy/__init__.py b/glue_astronomy/__init__.py index e64201e..e0fcb47 100644 --- a/glue_astronomy/__init__.py +++ b/glue_astronomy/__init__.py @@ -1,5 +1 @@ from .version import version as __version__ # noqa - - -def setup(): - from glue_astronomy import translators # noqa diff --git a/glue_astronomy/conftest.py b/glue_astronomy/conftest.py index 6e45695..c5cf617 100644 --- a/glue_astronomy/conftest.py +++ b/glue_astronomy/conftest.py @@ -1,3 +1,6 @@ def pytest_configure(config): - from glue_astronomy import setup - setup() + from glue_astronomy.translators import setup_ccddata, setup_regions, setup_spectrum1d + + setup_ccddata() + setup_regions() + setup_spectrum1d() diff --git a/glue_astronomy/translators/__init__.py b/glue_astronomy/translators/__init__.py index 497254e..47f8ece 100644 --- a/glue_astronomy/translators/__init__.py +++ b/glue_astronomy/translators/__init__.py @@ -1,5 +1,18 @@ -from . import ccddata # noqa -from . import regions # noqa -from . import spectral_cube # noqa -from . import spectrum1d # noqa -from . import trace # noqa +def setup_ccddata(): + from . import ccddata # noqa + + +def setup_regions(): + from . import regions # noqa + + +def setup_spectral_cube(): + from . import spectral_cube # noqa + + +def setup_spectrum1d(): + from . import spectrum1d # noqa + + +def setup_trace(): + from . import trace # noqa diff --git a/setup.cfg b/setup.cfg index c54ffee..0108aed 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,12 +19,13 @@ setup_requires = install_requires = astropy>=4.0 glue-core>=1.0 + +[options.extras_require] +all = regions>=0.4 specutils>=0.7 specreduce>=1.0.0 spectral-cube>=0.6.0 - -[options.extras_require] docs = sphinx sphinx-automodapi @@ -36,13 +37,21 @@ test = pytest-astropy pytest-cov mock + regions>=0.4 + specutils>=0.7 + specreduce>=1.0.0 + spectral-cube>=0.6.0 qt = PyQt5 [options.entry_points] glue.plugins = - glue_astronomy = glue_astronomy:setup - spectral_cube = glue_astronomy.io.spectral_cube:setup + ccddata = glue_astronomy.translators:setup_ccddata + regions = glue_astronomy.translators:setup_regions + spectrum1d = glue_astronomy.translators:setup_spectrum1d + spectral_cube = glue_astronomy.translators:setup_spectral_cube + spectral_cube_io = glue_astronomy.io.spectral_cube:setup + trace = glue_astronomy.translators:setup_trace [options.package_data] glue_astronomy.io.spectral_cube.tests = data/*, data/*/*, data/*/*/*