Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Vidar Tonaas Fauske
@vidartf
thanks :)
I'll have a look at it tomorrow (out of time for today)
Maarten Breddels
@maartenbreddels
@vidartf apart from the problem that jason is working on, i'd like to get everything as federated bundle, and it would be great if we all (bqplot, threejs, ipyvolume) share threejs (share when semver matches)
Jason Grout
@jasongrout
I think you'll automatically share threejs (if versions match). Federated extensions automatically share direct dependencies
Basically, the highest version of threejs would be cached by the system, and if an extension could use that, it will. Otherwise it will use its own copy of three.js
Alex Cabrera
@cabreraalex
quick followup on the svelte template, I wrote a short blog on how to use the widget-svelte-cookiecutter to make widgets: https://cabreraalex.medium.com/creating-reactive-jupyter-widgets-with-svelte-ef2fb580c05
mocquin
@mocquin
is there a way to remove an observe that has been set ? for example I created a "base" class attribute with an observer on its value, and I want a subclass to override this observer: but redefining the handler and setting an .observe(handler, name="value" seems like both observers are called
sachin kharude
@sackh

Hi All,

I am getting below error now for running one of my custom widget in jupyter lab.
previously it was working fine in jupyter lab.

Error:

    semver range ^0.1.0 is not registered as a widget module
    at manager_WidgetManager.loadClass (manager.js:319)
    at manager_WidgetManager.<anonymous> (manager-base.js:264)
    at step (manager-base.js:45)
    at Object.next (manager-base.js:26)
    at manager-base.js:20
    at new Promise (<anonymous>)
    at push.Rtm6.__awaiter (manager-base.js:16)
    at manager_WidgetManager.push.Rtm6.ManagerBase._make_model (manager-base.js:258)
    at manager_WidgetManager.<anonymous> (manager-base.js:247)
    at step (manager-base.js:45)

even though I have set below in my code

_view_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)
_model_module_version = Unicode(EXTENSION_VERSION).tag(sync=True)

EXTENSION_VERSION = "^0.1.0"

can someone please help with this ?

Alex Cabrera
@cabreraalex
Is there a way to access static files from a Jupyter Widget? e.g. I pass my widget a path (./img.jpg) and it has access to it? Or do I have to encode and send the file as a Traitlet
Vidar Tonaas Fauske
@vidartf
Are you kernel and server in the same env/dir ?
normally you would be able to access it via the server API
i.e. craft a URL that points to the file and lets you download it
Alex Cabrera
@cabreraalex
yup they are! Do you have pointers on how to create the right URL? My dumb idea was to just use the relative path, obviously doesn't work on the frontend
Vidar Tonaas Fauske
@vidartf
try <base_url>/files/<path>
3 replies
Yamazaki-Youichi
@Yamazaki-Youichi

Hello! I'm sorry to ask such a basic question but I need your help.
Now I'm trying to change my custom extension to a package.
Following the friendly guidance, I was able to make an editable installation of the Helloworld widget.

To refer to other Javascript program which located same directory, I had to insert the following script tag.

var MyView = widgets.DOMWidgetView.extend({
    render: function() {
    this.script  =  document.createElement("script");
    this.script.setAttribute("type", "text/javascript");
    this.script.setAttribute("language", "text/javascript");
    this.script.setAttribute("src", "my_js/myjs.js");
    this.el.appendChild(this.script);
    },
}:

I'd like to change to reference a script from package folder how should I do?
I feel there are better way to use than using script tag, But I'd like to ask script tag method also.

And I also ask how can I reference a function in other file.

// %%javascript (in Notebook)
function myfunction(){
    var value = 1
    return value
}

var MyView = widgets.DOMWidgetView.extend({
    render: function() {
    var x = myfunction() //<-it is not work
    },
}:

Provably, This is a question about requiredJS.
I always use only Python so sorry to ask something basic. Please teach me!

Ian Hunt-Isaak
@ianhi
I think you might need to make your other script availiable on npm or at least something that can be referrred to in the package.json file
andymcarter
@andymcarter
Any suggestions as to how I can programmatically select a file using the FileUpload widget? Trying to script out some clicks but failing here.
Maarten Breddels
@maartenbreddels
i think that would be a security risk, so that cannot be done i think
the only one that can select a file is a user with mouse/keyboard
(otherwise a webpage can download your local files)
andymcarter
@andymcarter
Hi @maartenbreddels , that sounds like a good explanation
Maarten Breddels
@maartenbreddels
maybe you want sth else, a file picker, from the server
note that the server and the browser may not be the same machine
andymcarter
@andymcarter
Yeah I'm just thikning about that now. The FileUpload widget should only show the files on the browser machine right?
Maarten Breddels
@maartenbreddels
yeah
@mariobuikhuizen did someone ever make sth like that with ipyvuetify?
andymcarter
@andymcarter
Thanks. Luckily I can kind of get around the button by loading a BytesIO object directly with the underlying functions.
Mario Buikhuizen
@mariobuikhuizen
Like what? A kernel-end file browser?
Maarten Breddels
@maartenbreddels
yeah
Mario Buikhuizen
@mariobuikhuizen
I saw an issue for someone building something like that: mariobuikhuizen/ipyvuetify#94
Myson Jebavaram Tharmaraj
@tmysonjebavaram_gitlab
Hi there

Is it possible to use ipyvuetify widgets in ipywidgets interactive ?

Here is an example of what I am trying to accomplish
@interact(value=v.Select(label='Fruits',items=['Apple', 'Pear', 'Cherry']))
def print_details(value):
print(value)

Angus Hollands
@agoose77
@tmysonjebavaram_gitlab have you tried it? If it doesn't work, there's a special method that a value-holding widget has that enabled it to be passed as an argument to interact. You can find it by looking at the source code for the ipywidgets Python package (or maybe docs, I can't remember). It is something like get_value
Myson Jebavaram Tharmaraj
@tmysonjebavaram_gitlab
@agoose77 I tried it and it is not working. More help in finding the solution would be helpful because I am a newbie in python.
Angus Hollands
@agoose77
@tmysonjebavaram_gitlab the short answer is no - I looked at the source code and it seems that ipyvuetify doesn't really try to support the ipywidgets interface, so it is not very easy to make the two work together. You can patch in the ipywidgets.ValueWidget base class, but then you need to add links between the vuetify events and the ipywidgets events API
Maarten Breddels
@maartenbreddels
i think ipyvuetify uses v_model and not value (cc @mariobuikhuizen )
you could subclass it, add the trait and link it
Angus Hollands
@agoose77
import ipywidgets
import ipyvuetify
import inspect
import traitlets

class Proxy:

    def __getattr__(self, name):
        obj = getattr(ipyvuetify, name)
        if not inspect.isclass(obj) and issubclass(obj, ipywidgets.DOMWidget):
            return obj

        if not hasattr(obj, "v_model"):
            return obj

        def __init__(self, *args, **kwargs):
            ipywidgets.link((self, "v_model"), (self, "value"))
            super(cls, self).__init__(*args, **kwargs)

        attrs = {
            '__init__': __init__,
            "description": traitlets.Unicode()
        }
        cls = type(obj.__name__, (obj, ipywidgets.ValueWidget), attrs)
        return cls
p = Proxy()            

@ipywidgets.interact(value=p.Select(label='Fruits',items=['Apple', 'Pear', 'Cherry'], v_model="Apple"))
def print_details(value):
    print(value)
kolibril13
@kolibril13
Hello jupyter-widgets people!
I am currently working on a splitview widget for jupyter that will look like this:
concept_image.png
Unfortunately, I get this error when I try to run it:
image.png
Itay Dafna
@ibdafna
try jupyter_splitview
kolibril13
@kolibril13
image.png
Itay Dafna
@ibdafna
Did you run pip install -e .?
kolibril13
@kolibril13
yes, the installation that was sucessful.
The problem is I think that I named the python module with an dash.
Ok, now I solved it by renaming jupyter-splitview to only splitview :)
Nevertheless, thanks for your help!
Itay Dafna
@ibdafna
Glad you got it to work
kolibril13
@kolibril13
If anyone else is interested in this idea, feel free to share your thoughts or contributions.
I am just at the complete start of this project.
https://github.com/kolibril13/jupyter-splitview
Itay Dafna
@ibdafna
You should checkout ipyleaflet as it has something like that implemented for maps. Might be helpful