jupyter-widgets / widget-ts-cookiecutter

A highly opinionated cookiecutter template for ipywidget extensions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JS Error when installing built package

paddymul opened this issue · comments

I have an inprogress widget based on ts-cookie cutter

I ran the following commands to create a clean environment

conda create -n dcf-widget-install-1 pandas jupyter
conda activate dcf-widget-install-1
python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps dcf-test-paddy 

I got a js import error when trying to use the widget (that works for symlink development)

Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'ExampleModel' from module 'dcf'
loadClass@http://localhost:8889/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:74856
loadModelClass@http://localhost:8889/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:10729
_make_model@http://localhost:8889/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:7517
new_model@http://localhost:8889/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:5137
handle_comm_open@http://localhost:8889/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:3894
134/v/this._handleCommOpen@http://localhost:8889/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:73393
_handleCommOpen@http://localhost:8889/static/lab/jlab_core.6144df8e3fe03e33f880.js?v=6144df8e3fe03e33f880:2:1001315

Here are the results of jupyter nbextension list... General jupyter note, I get very confused between nbextensions and jupyterlab extensions

jupyter nbextension list
Known nbextensions:
  config dir: /Users/paddy/.jupyter/nbconfig
    notebook section
      dcf  enabled 
      - Validating: problems found:
        - require?  X dcf
  config dir: /Users/paddy/opt/anaconda3/envs/dcf-widget-install-1/etc/jupyter/nbconfig
    notebook section
      dcf/extension  enabled 
      - Validating: OK
      jupyter-js-widgets/extension  enabled 
      - Validating: OK

repo is here
https://github.com/paddymul/dcf

What should I do?
How can I test my package before deploying to see if it will install properly?
Can we add better messaging to the cookie-cutter readme about how to test the installation of your package?

I started from scratch with a clean cookiecutter repo (with minimal package.json tweaks pulled over from my larger repo). And I still get a similar error.

The reproduction repo is here
https://github.com/paddymul/ipywidgets-ts-cookie-install-error

I built with the following commands
primarily following instructions from
https://packaging.python.org/en/latest/tutorials/packaging-projects/

python -m pip install --upgrade twine
python -m pip install --upgrade build
yarn build
python -m build .
rm dist/index.*
twine check dist/*
python -m twine upload --repository testpypi dist/*

then I installed via

install via

conda create -n dcf-widget-install-3 pandas jupyter
conda activate dcf-widget-install-3
pip install -i https://test.pypi.org/simple/ dcf==0.1.1.dev0

I think the cookiecutter doesn't work when the JS name != python name. I've been struggling with this myself. I'll open an issue soon.