-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define separate entrypoints for translator plugins and make requirements optional #76
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
from .version import version as __version__ # noqa | ||
|
||
|
||
def setup(): | ||
from glue_astronomy import translators # noqa |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
def pytest_configure(config): | ||
from glue_astronomy import setup | ||
setup() | ||
from glue_astronomy.translators import (setup_ccddata, | ||
setup_regions, | ||
setup_spectral_cube, | ||
setup_spectrum1d, | ||
setup_trace) | ||
|
||
setup_ccddata() | ||
setup_regions() | ||
setup_spectral_cube() | ||
setup_spectrum1d() | ||
setup_trace() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should give slightly more explicit names to the plugins so that things are clear when we are able to load them individually in future. Translators should probably be called e.g. |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
trace = glue_astronomy.translators:setup_trace | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
[options.package_data] | ||
glue_astronomy.io.spectral_cube.tests = data/*, data/*/*, data/*/*/* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this. If they are only used in tests now, why pollute
__init__.py
and not just make them test fixtures?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not just used by tests, these functions are executed by the glue plugin loader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay... I see that these invoke some entry point dark magic. Nvm.