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

add __all__ to prepare for static type checkers and IDEs #3411

Merged
merged 11 commits into from
Apr 20, 2022
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
40 changes: 38 additions & 2 deletions panel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Panel is a high level app and dashboarding framework
=======================================================
"""
Panel is a high level app and dashboarding framework
====================================================

Panel is an open-source Python library that lets you create custom
interactive web apps and dashboards by connecting user-defined widgets
Expand Down Expand Up @@ -65,3 +66,38 @@
from .param import Param # noqa
from .template import Template # noqa
from .widgets import indicators # noqa

__all__ = (
"__version__",
"Accordion",
"Card",
"Column",
"FlexBox",
"GridBox",
"GridSpec",
"Pane", # deprecated
"Param",
"Row",
"Spacer",
"Tabs",
"Template",
"WidgetBox",
"bind",
"config",
"depends",
"extension",
"indicators",
"interact",
"ipywidget",
"layout",
"links",
"pane",
"panel",
"param",
"pipeline",
"reactive",
"serve",
"state",
"viewable",
"widgets",
)
2 changes: 2 additions & 0 deletions panel/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,3 +650,5 @@ def _cleanup_server(server_id):
panel_extension.add_delete_action(_cleanup_panel)
if hasattr(panel_extension, 'add_server_delete_action'):
panel_extension.add_server_delete_action(_cleanup_server)

__all__ = ['config', 'panel_extension']
2 changes: 2 additions & 0 deletions panel/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,5 @@ def wrapped(*wargs, **wkwargs):
combined_args, combined_kwargs = combine_arguments(wargs, wkwargs)
return function(*combined_args, **combined_kwargs)
return wrapped

__all__ = ["bind", "depends"]
2 changes: 2 additions & 0 deletions panel/interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,3 +527,5 @@ def get_interact_value(self):
to process the raw value ``self.value``.
"""
return self.value

__all__ = ["fixed", "interact", "interact_manual", "interactive"]
14 changes: 14 additions & 0 deletions panel/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,17 @@
from .server import serve # noqa
if 'django' in sys.modules:
from . import django # noqa

__all__ = (
"PeriodicCallback",
"Resources",
"ipywidget",
"panel_logger"
"profile",
"push",
"push_notebook",
"serve",
"state",
"unlocked",
"with_lock"
)
2 changes: 0 additions & 2 deletions panel/io/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,6 @@ def parse_url_path(self, path):

rel_path = '/'.join(subpath)

print(rel_path, resources)

# Important: May only access resources explicitly listed on the component
# Otherwise this potentially exposes all files to the web
if rel_path not in resources:
Expand Down
20 changes: 20 additions & 0 deletions panel/layout/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,23 @@
from .gridstack import GridStack # noqa
from .spacer import Divider, HSpacer, Spacer, VSpacer # noqa
from .tabs import Tabs # noqa

__all__ = (
"Accordion",
"Card",
"Column",
"Divider",
"FlexBox",
"GridBox",
"GridSpec",
"GridStack",
"HSpacer",
"ListLike",
"ListPanel",
"Panel",
"Row",
"Spacer",
"Tabs",
"VSpacer",
"WidgetBox"
)
8 changes: 8 additions & 0 deletions panel/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,3 +655,11 @@ def _get_code(self, link, source, src_spec, target, tgt_spec):
Link.register_callback(callback=JSLinkCallbackGenerator)

Viewable._preprocessing_hooks.append(Callback._process_callbacks)

__all__ = (
"Callback",
"CallbackGenerator",
"JSCallbackGenerator",
"JSLinkCallbackGenerator",
"Link"
)
2 changes: 0 additions & 2 deletions panel/models/deckgl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ export class DeckGLPlotView extends PanelHTMLBoxView {
const tooltip = this.model.tooltip
const data = this.getData()

console.log(data)

if ((window as any).deck.createDeck) {
this.deckGL = (window as any).deck.createDeck({
mapboxApiKey: MAPBOX_API_KEY,
Expand Down
37 changes: 37 additions & 0 deletions panel/pane/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,40 @@
from .streamz import Streamz # noqa
from .vega import Vega # noqa
from .vtk import VTKVolume, VTK # noqa

__all__ = (
"Alert",
"Audio",
"Bokeh",
"DataFrame",
"DeckGL",
"ECharts",
"GIF",
"HoloViews",
"HTML",
"ICO",
"IDOM",
"Interactive",
"IPyWidget",
"JPG",
"JSON",
"LaTeX",
"Markdown",
"Matplotlib",
"Pane",
"PaneBase",
"panel",
"PDF",
"Perspective",
"Plotly",
"PNG",
"RGGPlot",
"Str",
"Streamz",
"SVG",
"Vega",
"Video",
"VTK",
"VTKVolume",
"YT"
)
7 changes: 7 additions & 0 deletions panel/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,3 +989,10 @@ def link_param_method(root_view, root_model):


Viewable._preprocessing_hooks.insert(0, link_param_method)

__all__= (
"Param",
"ParamFunction",
"ParamMethod",
"set_values"
)
5 changes: 5 additions & 0 deletions panel/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,3 +626,8 @@ def define_graph(self, graph, force=False):
self.stage[:] = [self._init_stage()]
self._update_progress()
self._update_button()


__all__ = (
"Pipeline",
)
6 changes: 6 additions & 0 deletions panel/reactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1680,3 +1680,9 @@ def on_event(self, node, event, callback):
events = self._get_events()
for ref, (model, _) in self._models.items():
self._apply_update([], {'events': events}, model, ref)

__all__ = (
"Reactive",
"ReactiveHTML",
"ReactiveData"
)
14 changes: 14 additions & 0 deletions panel/template/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,17 @@

_config.param.template.names = templates
_config.param.template.objects = list(templates)

__all__ = [
"BaseTemplate",
"BootstrapTemplate",
"DarkTheme",
"DefaultTheme",
"FastGridTemplate",
"FastListTemplate",
"GoldenTemplate",
"MaterialTemplate",
"ReactTemplate",
"Template",
"VanillaTemplate",
]
7 changes: 7 additions & 0 deletions panel/viewable.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,3 +851,10 @@ def show(self, title=None, port=0, address=None, websocket_origin=None,

def _repr_mimebundle_(self, include=None, exclude=None):
return self._create_view()._repr_mimebundle_(include, exclude)


__all__ = (
"Layoutable",
"Viewable",
"Viewer"
)
75 changes: 74 additions & 1 deletion panel/widgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,77 @@
from .terminal import Terminal # noqa
from .debugger import Debugger # noqa
from .text_to_speech import TextToSpeech, Utterance, Voice # noqa
from .texteditor import TextEditor # noqa
from .texteditor import TextEditor# noqa

__all__ = (
"Ace",
"ArrayInput",
"AutocompleteInput",
"BooleanStatus",
"Button",
"Checkbox",
"CheckBoxGroup",
"CheckButtonGroup",
"ColorPicker",
"CompositeWidget",
"CrossSelector",
"DataFrame",
"DatePicker",
"DateRangeSlider",
"DateSlider",
"DatetimeInput",
"DatetimePicker",
"DatetimeRangeInput",
"DatetimeRangePicker",
"Debugger",
"Dial",
"DiscretePlayer",
"DiscreteSlider",
"EditableFloatSlider",
"EditableIntSlider",
"EditableRangeSlider",
"FileDownload",
"FileInput",
"FileSelector",
"FloatInput",
"FloatSlider",
"Gauge",
"Grammar",
"GrammarList",
"IntInput",
"IntRangeSlider",
"IntSlider",
"JSONEditor",
"LinearGauge",
"LiteralInput",
"LoadingSpinner",
"MenuButton",
"MultiChoice",
"MultiSelect",
"Number",
"NumberInput",
"PasswordInput",
"Player",
"Progress",
"RadioBoxGroup",
"RadioButtonGroup",
"RangeSlider",
"Select",
"SpeechToText",
"Spinner",
"StaticText",
"Tabulator",
"Terminal",
"TextAreaInput",
"TextEditor",
"TextInput",
"TextToSpeech",
"Toggle",
"ToggleGroup",
"Tqdm",
"Trend",
"Utterance",
"VideoStream",
"Voice",
"Widget",
)
15 changes: 15 additions & 0 deletions panel/widgets/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,3 +1215,18 @@ def reset(self):
"""Resets the parameters"""
self.value = self.param.value.default
self.text = self.param.text.default

__all__ = [
"BooleanIndicator",
"BooleanStatus",
"Dial",
"Gauge",
"LinearGauge",
"LoadingSpinner",
"Number",
"Progress",
"String",
"Tqdm",
"Trend",
"ValueIndicator",
]