Skip to content
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

Use lcviz version in all docs links #128

Merged
merged 4 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

* Prevent duplicate sub-intervals (quarter/sector/campaign) in data labels. [#120]

0.4.2 (unreleased)
------------------

* Fix all docs links to point to correct version of read the docs. [#128]

0.4.1 (07.15.2024)
------------------

Expand Down
10 changes: 9 additions & 1 deletion lcviz/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from glue.core.link_helpers import LinkSame
from glue.core.units import unit_converter
from jdaviz.core.helpers import ConfigHelper

from lcviz import __version__
from lcviz.viewers import TimeScatterView

__all__ = ['LCviz']
Expand Down Expand Up @@ -134,7 +136,13 @@ def __init__(self, *args, **kwargs):
self.app._add_style((__file__, 'lcviz_style.vue'))

# set the link to read the docs
self.app.docs_link = "https://lcviz.readthedocs.io"
self.app.vdocs = 'latest' if 'dev' in __version__ else 'v'+__version__
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to test, override this with 'v0.4.1' and see that all links in plugins and the app toolbar point correctly to that tagged release on RTD.

self.app.docs_link = f"https://lcviz.readthedocs.io/en/{self.app.vdocs}"
for plugin in self.plugins.values():
# NOTE that plugins that need to override upstream docs_link should do so in
# an @observe('vdocs') rather than the init, since plugin instances have
# already been initialized
plugin._obj.vdocs = self.app.vdocs

def load_data(self, data, data_label=None):
"""
Expand Down
5 changes: 5 additions & 0 deletions lcviz/plugins/export/export.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from traitlets import observe

from jdaviz.configs.default.plugins import Export
from jdaviz.core.registries import tray_registry

Expand All @@ -22,4 +24,7 @@ class Export(Export):
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

@observe('vdocs')
def _update_docs_link(self, *args):
self.docs_link = f"https://lcviz.readthedocs.io/en/{self.vdocs}/plugins.html#export"
4 changes: 4 additions & 0 deletions lcviz/plugins/markers/markers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
from traitlets import observe

from jdaviz.configs.default.plugins import Markers
from jdaviz.core.registries import tray_registry
Expand Down Expand Up @@ -32,6 +33,9 @@ def __init__(self, *args, **kwargs):
kwargs['headers'] = ['time', 'time:unit', 'phase', 'ephemeris',
'pixel', 'value', 'value:unit', 'viewer']
super().__init__(*args, **kwargs)

@observe('vdocs')
def _update_docs_link(self, *args):
self.docs_link = f"https://lcviz.readthedocs.io/en/{self.vdocs}/plugins.html#markers"

@property
Expand Down
6 changes: 5 additions & 1 deletion lcviz/plugins/metadata_viewer/metadata_viewer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from astropy.io.fits.card import Undefined
from traitlets import observe

from jdaviz.configs.default.plugins import MetadataViewer
from jdaviz.core.registries import tray_registry
Expand Down Expand Up @@ -34,4 +35,7 @@ class MetadataViewer(MetadataViewer):
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.docs_link = f"https://lcviz.readthedocs.io/en/{self.vdocs}/plugins.html#metadata-viewer" # noqa

@observe('vdocs')
def _update_docs_link(self, *args):
self.docs_link = f"https://lcviz.readthedocs.io/en/{self.vdocs}/plugins.html#metadata-viewer" # noqa
4 changes: 4 additions & 0 deletions lcviz/plugins/plot_options/plot_options.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np

from traitlets import observe
from jdaviz.configs.default.plugins import PlotOptions
from jdaviz.core.registries import tray_registry

Expand Down Expand Up @@ -31,6 +32,9 @@ class PlotOptions(PlotOptions):
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

@observe('vdocs')
def _update_docs_link(self, *args):
self.docs_link = f"https://lcviz.readthedocs.io/en/{self.vdocs}/plugins.html#plot-options"

def _default_tpf_stretch(
Expand Down
7 changes: 6 additions & 1 deletion lcviz/plugins/subset_plugin/subset_plugin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from traitlets import observe

from jdaviz.configs.default.plugins import SubsetPlugin
from jdaviz.core.registries import tray_registry

Expand All @@ -18,5 +20,8 @@ class SubsetPlugin(SubsetPlugin):
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.docs_link = f"https://lcviz.readthedocs.io/en/{self.vdocs}/plugins.html#subset-tools"
self.can_freeze = True

@observe('vdocs')
def _update_docs_link(self, *args):
self.docs_link = f"https://lcviz.readthedocs.io/en/{self.vdocs}/plugins.html#subset-tools" # noqa
7 changes: 6 additions & 1 deletion lcviz/plugins/time_selector/time_selector.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from traitlets import observe

from jdaviz.configs.cubeviz.plugins import Slice
from jdaviz.core.registries import tray_registry

Expand Down Expand Up @@ -37,7 +39,6 @@ def __init__(self, *args, **kwargs):

"""
super().__init__(*args, **kwargs)
self.docs_link = f"https://lcviz.readthedocs.io/en/{self.vdocs}/plugins.html#time-selector"
self.docs_description = "Select time to sync across all viewers (as an indicator in all time/phase viewers or to select the active slice in any image/cube viewers). The slice can also be changed interactively in any time viewer by activating the slice tool." # noqa
self.value_label = 'Time'
self.value_unit = 'd'
Expand All @@ -46,6 +47,10 @@ def __init__(self, *args, **kwargs):
self.session.hub.subscribe(self, EphemerisChangedMessage,
handler=self._on_ephemeris_changed)

@observe('vdocs')
def _update_docs_link(self, *args):
self.docs_link = f"https://lcviz.readthedocs.io/en/{self.vdocs}/plugins.html#time-selector"

@property
def slice_display_unit_name(self):
# global display unit "axis" corresponding to the slice axis
Expand Down