Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 03:40
    dependabot[bot] labeled #72
  • 03:40
    dependabot[bot] opened #72
  • 03:40

    dependabot[bot] on npm_and_yarn

    Bump normalize-url from 4.5.0 t… (compare)

  • 01:38
    jasongrout synchronize #3217
  • 01:36
    jasongrout edited #3217
  • 01:35
    jasongrout opened #3217
  • Jun 11 23:44
    jasongrout converted_to_draft #3216
  • Jun 11 23:25
    jasongrout commented #3216
  • Jun 11 22:14
    jasongrout milestoned #3216
  • Jun 11 22:14
    jasongrout opened #3216
  • Jun 11 21:34
    jasongrout milestoned #3215
  • Jun 11 21:11
    jasongrout reopened #3211
  • Jun 11 21:11
    jasongrout closed #3211
  • Jun 11 21:08
    matyasrada synchronize #824
  • Jun 11 21:04
    jasongrout edited #3215
  • Jun 11 20:59
    jasongrout edited #3215
  • Jun 11 20:58
    jasongrout ready_for_review #3215
  • Jun 11 20:58
    jasongrout edited #3215
  • Jun 11 20:44
    jasongrout synchronize #3215
  • Jun 11 20:25
martinRenou
@martinRenou
the method that is responsible for creating the DOM element is "render"
Andy Somogyi
@AndySomogyi
OK, what's the recommended way for including .css in a widget?
martinRenou
@martinRenou
mmmh indeed there is no CSS added in the example
that's too bad
we should add it
but you can look at other libraries for examples, maybe ipyleaflet
but you will need to get your hands dirty and touch the webpack config file: https://github.com/jupyter-widgets/ipyleaflet/blob/master/js/webpack.config.js
to add some webpack rules for loading the CSS with css-loader
don't hesitate to report back any issue you get into. We could help you get it right.
Andy Somogyi
@AndySomogyi

I'll take a look, thanks.

What the webpack.config.js do? is it used at install time to tell the jupyter server where to put the widget code?

martinRenou
@martinRenou
The webpack.config.js is the config for webpack https://webpack.js.org, this tool is used by npm to build your JS project with npm run build (see https://github.com/jupyter-widgets/widget-cookiecutter/blob/master/%7B%7Bcookiecutter.github_project_name%7D%7D/js/package.json#L25)
"building the JS project" basically means taking all your JavaScript files and CSS and whatever other file extension you use (if you use react and alikes), and compiles everything into one "bundle" (one big JS file and one CSS file basically)
and this bundle will be installed on your system by your setup.py (the one generated from the cookiecutter)
but the good thing about the cookiecutter is you don't have to actually understand all this in details
Andy Somogyi
@AndySomogyi

Thanks.

Wow, it's pretty complicated trying to get my head around all of these different technologies all used together, python, javascript, node.js, npm, css, html, traitlets, ...

What I'm still not really clear about is how the server side processes work. So, node.js is one process, this handles all the client browser / server interaction. Does this then spin up a python process for jupyter kernel, and does this spin up another python process for the user notebook code?

Angus Hollands
@agoose77:matrix.org
[m]
@AndySomogyi: the core compute part is the kernel, which is the "backend" on the server side. Jupyter Notebook/Lab talk to the backend to request a kernel etc
the kernel has a comms system that allows clients to talk to it to receive updates about evaluation status, send stdin, send an execution request etc: https://jupyter-client.readthedocs.io/en/stable/messaging.html#wire-protocol
Andy Somogyi
@AndySomogyi

So, for a single running notebook, how many python processes are there? Is it like this, where (...) are processes and [...] are communication? :

(client web browser)
<-> [web sockets]
<-> (node.js javascript process)
<-> [zmq]
<-> (kernel python process)
<-> [zmq]
<-> (user python notebook code)

Angus Hollands
@agoose77:matrix.org
[m]
The kernel process count depends upon how the kernel is implemented. Some kernels might run everything in one process
Angus Hollands
@agoose77:matrix.org
[m]
@AndySomogyi: IIRC roughly the maths is K + F*N where K is some constant, F is the multiplicity of the kernel (e.g does it launch a child process or run in-process) and N is the number of notebooks
It's not something I've really looked at, so I might be a bit off
Maxime Liquet
@maximlt
Hi, I've been trying to install ipyleaflet in a dev environment (Python 3.8.10, JupyterLab 3.0.16), with no luck. After pip install -e . (from the current master branch), jupyter labextension develop ipyleaflet fails with ValueError: /home/maxime/miniconda3/envs/jlab-ipyleaflet/share/jupyter/labextensions/jupyter-leaflet exists and is not a symlink. So I've tried to run jupyter labextension develop --overwrite . since it's recommended elsewhere (by ipympl for instance), this indicated that jupyter_packaging had to be installed, which I did, but trying again raised another error: pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'entered'": Expected stringEnd. Am I doing something wrong?
martinRenou
@martinRenou
Hey :)
pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'entered'": Expected stringEnd
this error
is it jupyter labextension develop --overwrite . that shows it?
Maxime Liquet
@maximlt
Yes! Here's the content of the log file with the full traceback: https://jpst.it/2x1jX
And from the console:
jupyter labextension develop --overwrite .

setup.py:43: DeprecatedWarning: create_cmdclass is deprecated as of 0.8 and will be removed in 1.0. "
Use `wrap_installers` to handle prebuild steps in cmdclass.
Use `get_data_files` to handle data files.
Use `include_package_data=True` and `MANIFEST.in` for package data.

  cmdclass = create_cmdclass('jsdeps', data_files_spec=data_files_spec)
setup.py:45: DeprecatedWarning: install_npm is deprecated as of 0.8 and will be removed in 1.0. Use `npm_builder` and `wrap_installers`
  install_npm(js_dir, npm=["yarn"], build_cmd='build:extensions'), ensure_targets(jstargets),
An error occured.
pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'entered'": Expected stringEnd
martinRenou
@martinRenou
I'll try locally
I have to admit I never tried setting up the dev install for JupyterLab
I can also reproduce...
but I have no clue what this error means
Maxime Liquet
@maximlt
Ok thanks a lot! That should work better with the classic notebook :) (I also have no clue about that error!)
martinRenou
@martinRenou
jupyter labextension develop --overwrite ipyleaflet
seems to work
oh I know what's wrong...
that's a stupid issue really ahah. I'll push a fix. It's basically that the jupyter labextension develop script will run setup.py and extract the name of the package from it, but because the ipyleaflet setup.py logs some stuffs (https://github.com/jupyter-widgets/ipyleaflet/blob/master/setup.py#L23), jupyter labextension develop will try to setup a dev install of the "setup.py entered" package (that's not a package ahah)
martinRenou
@martinRenou
thanks for reporting!
1 reply
Maxime Liquet
@maximlt
As of now the README doesn't tell how to build the extension in a dev install. I've found elsewhere references to npm run build or yarn run build. It happens that the "build" script just run webpack (not sure about the correct terminology here), which only builds the nbextension (not lab). yarn run "build:extensions" builds both extensions. I'd like to watch changes automatically, is jupyter labextension watch . the recommended way?
martinRenou
@martinRenou
yeah the docs are out-of-date... The bqplot README is way more up-to-date.
yarn run build would be prefered now

It happens that the "build" script just run webpack (not sure about the correct terminology here), which only builds the nbextension (not lab). yarn run "build:extensions"

Indeed. The build script should run jupyter labextension build . too IMO

I'd like to watch changes automatically, is jupyter labextension watch . the recommended way?

Yes! Same, I think we should add this command to the watch script

Maxime Liquet
@maximlt
Yes no problem, this kind of doc is difficult to update and things seem to have changed quite a lot between the classic notebook, lab and its different versions. Thanks for pointing to bqplot's doc!
epifanio
@epifanio

Hi, can you help me understanding what I am doing wronmg here:

import ipywidgets as widgets
from IPython.display import display

class print_button(object):
    def __init__(self, m=None, index=None):
        self.button = widgets.Button(description="Click Me!")
        self.index = index

    def on_button_clicked(self):
        return self.index

    def get_button(self):
        self.button.on_click(self.on_button_clicked())
        return HBox([self.button])

When I call it, the print_button(index=1).get_button() the callback returns:

TypeError                                 Traceback (most recent call last)
TypeError: 'NoneType' object is not callable
I tried to reduce the code I was using to a bare minimum, to isdolate the issue