Closed kylebarron closed 3 months ago
Does the example work for you with the pypi release of lonboard? It does for me, but then when I try with the latest Ionboard (https://github.com/developmentseed/lonboard/commit/015672d37ba3e0b66cf169a0e989772823f758a3) I'm seeing the error below, which is getting thrown by anywidget.
File "/Users/cpsievert/github/py-shinywidgets/sandbox/reprex/app.py", line 2, in <module>
from lonboard import Map, ScatterplotLayer
File "/Users/cpsievert/anaconda3/lib/python3.10/site-packages/lonboard/__init__.py", line 16, in <module>
from ._map import Map
File "/Users/cpsievert/anaconda3/lib/python3.10/site-packages/lonboard/_map.py", line 48, in <module>
class Map(BaseAnyWidget):
File "/Users/cpsievert/anaconda3/lib/python3.10/site-packages/traitlets/traitlets.py", line 967, in __new__
return super().__new__(mcls, name, bases, classdict)
File "/Users/cpsievert/anaconda3/lib/python3.10/site-packages/anywidget/widget.py", line 66, in __init_subclass__
file_contents = try_file_contents(getattr(cls, key))
File "/Users/cpsievert/anaconda3/lib/python3.10/site-packages/anywidget/_util.py", line 258, in try_file_contents
raise FileNotFoundError(f"File not found: {path}")
FileNotFoundError: File not found: /Users/cpsievert/anaconda3/lib/python3.10/site-packages/lonboard/static/index.js
I have a hunch that this error means that Ionboard doesn't work with the latest anywidget because Ionboard is doing something non-standard with its static assets, and also that, shinywidgets is failing to render for similar reasons. Hopefully, if Ionboard addresses that issue with anywidget, it'll also fix the shinywidgets issue.
It does for me, but then when I try with the latest Ionboard (developmentseed/lonboard@015672d) I'm seeing the error below, which is getting thrown by anywidget
That's because you need to build the JS parts from source as well, see https://github.com/developmentseed/lonboard/blob/main/DEVELOP.md#javascript
It turns out that it works from the command line with poetry run shiny run app.py
when viewed in Chrome; it just fails with the Shiny vscode extension with Shiny: Run Shiny App
. I don't know where a relevant issue for that would be.
In case it's useful, here's what I see in vscode:
https://github.com/posit-dev/py-shinywidgets/assets/15164633/26b9bdfa-0aac-4b5c-bbfe-b3ea57287000
Description
I'm trying to run the example I proposed in https://github.com/posit-dev/py-shinywidgets/issues/133 but it still isn't working for me. In particular, I can see a map render when I
Working:
Not working:
If I look at the browser console, I see a few errors:
What I Did
In this PR https://github.com/developmentseed/lonboard/pull/409/files I have a lockfile (you need to be on Poetry >=1.8) and minimal reproducible example. If you comment out the
def layer
block, the map will render; otherwise it'll fail with a blank screen.