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

JS Error when installing built package #131

Open
paddymul opened this issue Apr 4, 2023 · 2 comments · May be fixed by #138
Open

JS Error when installing built package #131

paddymul opened this issue Apr 4, 2023 · 2 comments · May be fixed by #138

Comments

@paddymul
Copy link

paddymul commented Apr 4, 2023

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?

@paddymul
Copy link
Author

paddymul commented Apr 5, 2023

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

@paddymul paddymul changed the title Error installing package JS Error when installing built package Apr 7, 2023
@maartenbreddels
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants