Code Monkey home page Code Monkey logo

voila-embed-vuetify's Introduction

voila-embed-vuetify

Version

A Vue component to embed ipyvuetify widgets served by Voila.

Installation

npm install voila-embed-vuetify

or

yarn add voila-embed-vuetify

Usage

<template>
  <div>
    ...
    <jupyter-widget-embed
      voila-url="http://localhost:8000"
      notebook="my-notebook.ipynb"
      mount-id="my-widget"
    ></jupyter-widget-embed>
    ...
  </div>
</template>

<script>
  import { JupyterWidgetEmbed } from 'voila-embed-vuetify'

  export default {
    name: 'MyComponent',
    components: {
      JupyterWidgetEmbed
    },
    // ...
  }

</script>

The displayed content while loading can be replaced by specifying your own content within the jupyter-widget-embed tag.

In your notebook set _metadata={'mount_id': 'my-widget'} on a ipyvuetify widget or .add_traits(_metadata=traitlets.Dict(default_value={'mount_id': 'my-widget'}).tag(sync=True)) on any other widget.

Example

Make an environment:

$ conda create -n vev -c conda-forge voila bqplot ipyvuetify nodejs=14
$ conda activate vev
(vev) $ pip install voila-embed
(vev) $ npm install -g yarn

In the example directory run:

(vev) $ voila --no-browser --template=embed --enable_nbextensions=True --Voila.tornado_settings="{'allow_origin': 'http://localhost:8080', 'allow_credentials': True}" --port=8000

In another terminal in the example directory run:

(vev) $ yarn
(vev) $ yarn serve

The example site is now available on http://localhost:8080

Integration in a standard vue-cli project

Install the library:

$ yarn add voila-embed-vuetify

Add voila-embed-vuetify to transpileDependencies in vue.config.js

module.exports = {
  "transpileDependencies": [
    "vuetify", "voila-embed-vuetify"
  ],
}

Adapt 'babel.config.js' to use usebuildIns: "entry":

module.exports = {
  presets: [
    ['@vue/cli-plugin-babel/preset', { useBuiltIns: "entry" }]
  ]
}

Dev install

Run the example normally, then from the main directory copy after a change:

$ cp -r src package.json example/node_modules/voila-embed-vuetify

voila-embed-vuetify's People

Contributors

mariobuikhuizen avatar havok2063 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

havok2063

voila-embed-vuetify's Issues

releaase a version compatible with Vue3

Hi @mariobuikhuizen is it possible to release a version of this onto npm that is compatible with Vue 3. I'd like to use this for a new project. I tried bumping the dependencies to

    "vue": "^3.3.4",
    "vuetify": "^3.4.6",

which is what I'm using in the new project and npm install on the local repo, but I ran into issues. I'm also not sure what this dependency is, "@mariobuikhuizen/vue-compiler-addon": "^2.6.10-alpha.1" and if we still need it?

Error with voila 0.3.4 and preheated kernels

Testing this out with voila 0.3.4 and the new preheated kernels code. I'm getting the following error in the console.

Starting WebSocket: ws://localhost:8000/api/kernels/d8478ca6-059a-4ca2-8744-8b0179a11d3f
JupyterWidgetEmbed.js?6402:119 Uncaught (in promise) TypeError: widgetManager._build_models is not a function
    at eval (JupyterWidgetEmbed.js?6402:119:1)

with the following voila command. I see this both in the standalone example https://github.com/havok2063/standalone_jdaviz/, as well as our MAST-specific setup.

voila --no-browser --template=embed --enable_nbextensions=True --Voila.tornado_settings="{'allow_origin': 'http://localhost:8081', 'allow_credentials': True}" --preheat_kernel=True --pool_size=3 --port=8000

This is without any changes to the notebook. When I add the wait_for_request method to the notebook, just after the cell with the imports, I get a different error in the voila server, same as the one mentioned here, voila-dashboards/voila#1123.

some material design icons don't render correctly

Some of the material design icons do not render correctly inside jdaviz when the application is compiled and embedded with voila-embed-vuetify versus when the application is loaded in a notebook. Likewise there are different icons that do not render correctly using the script method of voila-embed package. In all cases the buttons still work, just the icons do not display.

Voila-Embed-Vuetify

  • add, gear, unfold icons

jdaviz_icons_vuetifyembed

Jupyter Notebook
jdaviz_icons_notebook

Voila-Embed

  • hammer-screwdriver, toy-brick-plus icons

jdaviz_icons_voilaembed

Update to latest voila_embed

@mariobuikhuizen We are now switching our front-end to a compiled Vuetify application. I know there have been updates to voila-embed since this repo was made. Do we need to update this code to the latest versions? I imagine we'll be switching to this library.

issue rendering vuetify components in jdaviz

Hi @mariobuikhuizen. We are in the middle of integrating the JupyterWidgetEmbed into our Jdaviz web application. It is connecting to the voila server correctly, but Jdaviz and the ouput debug window are not rendering correctly. See attached images. I also attach an image of a traceback seen in Chome in the console. My guess is this is just an issue with dependency versions.

I installed the latest jdaviz in our voila environment, and it has the following package versions:

bqplot                   0.12.33
bqplot-image-gl          1.4.5
ipyvue                   1.7.0
ipyvuetify               1.8.1
ipywidgets               7.6.5
jdaviz                   2.2.1.dev181+gddd3c250 /Users/bcherinka/Work/git/stsci/jdaviz
jupyter-client           6.1.12
jupyter-core             4.9.1
jupyter-server           1.13.4
specutils                1.6.0
voila                    0.2.16

In our front-end application yarn.lock file, we have the following versions of vue-related libraries. I did try installing vuetify==2.2.23 but that didn't seem to fix the issue.

vue@^2.6.11:
  version "2.6.14"

vuetify-loader@^1.7.0:
  version "1.7.3"

vuetify@^2.6.3:
  version "2.6.3"

voila-embed-vuetify@^0.0.3:
  version "0.0.3"
  dependencies:
    "@mariobuikhuizen/vue-compiler-addon" "^2.6.10-alpha.1"

vue-template-compiler@^2.6.11:
  version "2.6.14"

vue-template-es2015-compiler@^1.9.0:
  version "1.9.1"

Any ideas on where the problem could be?

Screen Shot 2022-02-18 at 11 26 30 AM

Screen Shot 2022-02-18 at 11 26 38 AM

Screen Shot 2022-02-18 at 11 26 57 AM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.