holoviz/lumen

resolved_source referenced before assignment

Closed this issue · 3 comments

For specs that don't include pipeline (e.g. step 3 on https://lumen.holoviz.org/getting_started/build_dashboard.html):

sources:
  penguin_source:
    type: file
    tables:
      penguin_table: https://datasets.holoviz.org/penguins/v1/penguins.csv

layouts:
  - title: Penguins
    source: penguin_source
    views:
      - type: table
        table: penguin_table
import lumen as lm
import yaml
with open("test.yaml", "r") as f:
    lm.Pipeline.from_spec(yaml.safe_load(f.read()))

I get this on main

File [~/repos/lumen/lumen/pipeline.py:431](https://file+.vscode-resource.vscode-cdn.net/Users/ahuang/repos/learn-lumen/~/repos/lumen/lumen/pipeline.py:431), in Pipeline.from_spec(cls, spec, source, source_filters)
    429 # Validate table
    430 table = params.get('table')
--> 431 tables = resolved_source.get_tables()
    432 if table is None:
    433     if len(tables) > 1:

UnboundLocalError: local variable 'resolved_source' referenced before assignment

Oh maybe I'm using from_spec incorrectly. The YAML spec does not translate directly.

The proper way:

from lumen.dashboard import Dashboard

Dashboard("penguins.yaml").show()

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.