Giter Club home page Giter Club logo

declarativewidgets's Introduction

Jupyter

Read this in other languages: English, Español, Português, Français

Jupyter metapackage for installation and documents

Documentation structure

This documentation uses the Sphinx documentation engine.

The documentation is located in the docs/source folder. When you build the documentation, it will be placed in the docs/build folder. It is written in a combination of reStructuredText and MyST Markdown.

Build the documentation locally

There are a few ways to build the documentation; see below for instructions:

Build the documentation automatically with nox

The easiest way to build the documentation locally is by using the nox command line tool. This tool makes it easy to automate commands in a repository, and we have included a docs command to quickly install the dependencies and build the documentation.

To build and preview the site locally, follow these steps:

  1. Clone this repository.

    $ git clone https://github.com/jupyter/jupyter
    $ cd jupyter
  2. Install nox

    $ pip install nox
  3. Run the docs command

    $ nox -s docs

This will install the needed dependencies in a virtual environment using pip. It will then place the documentation in the docs/build/html folder. You may explore these HTML files in order to preview the site.

Create a live server to automatically preview changes

There is another nox command that will do the above, and also create a live server that watches your source files for changes, and auto-builds the website any time a change is made.

To start this live server, use the following nox command:

$ nox -s docs-live

When the build is finished, go to the URL that is displayed. It should show a live preview of your documentation.

To stop serving the website, press Ctrl-C in your terminal

Build the documentation manually

To build the documentation manually, follow these steps:

First, install the miniconda Python distribution.

Next, navigate to the /docs directory and create a conda environment:

conda env create -f environment.yml

Activate the environment:

source activate jupyter_docs

Build the docs using Sphinx with the following commands:

make clean
make html

The docs will be built in build/html. They can be viewed by opening build/html/index.html or starting an HTTP server and navigating to 0.0.0.0:8000 in your web browser.

python3 -m http.server

Releasing the jupyter metapackage

Anyone with push access to this repo can make a release of the Jupyter metapackage (this happens very rarely). We use tbump to publish releases.

tbump updates version numbers and publishes the git tag of the version. Our GitHub Actions then build the releases and publish them to PyPI.

The steps involved:

  1. Install tbump: pip install tbump
  2. Tag and publish the release tbump $NEW_VERSION.

That's it!

declarativewidgets's People

Contributors

aluu317 avatar ankostis avatar dalogsdon avatar ellisonbg avatar flying-sheep avatar haobibo avatar j-towns avatar jhpedemonte avatar lbustelo avatar lull3rskat3r avatar parente avatar peller avatar poplav avatar rgbkrk avatar wellecks avatar wjsi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

declarativewidgets's Issues

Add resize support (for dashboard)

Any widget that has resizable content should use iron-resizable-behavior to be properly notified when the window or element container resizes.

An example of this can be found in the paper-badge element.

This will allow widgets to resize properly in the dashboard view. Additionally, this will handle window resize, so an explicit window.onResize handler is not necessary.

  • Update urth-viz-table
  • Update urth-viz-chart
  • Create best practices doc detailing how Polymer elements should use iron-resizable-behavior

urth-viz-chart should allow coloring of series

When using urth-viz-chart I would like to supply color values for series in the chart. An example would be:

<urth-viz-chart type='bar' 
   datarows='[["a",8,5],["b",2,6]]' 
   columns='["Index","Series 1","Series 2"]' 
   series-colors='["green","red"]'
></urth-viz-chart>

Allow import to notebook from sibling Polymer HTML file

I would like to create a standalone Polymer element file as a sibling to my current notebook, and import that element into the notebook. Couple of issues:

1. Relavitive Import

So far, I've found that doing the following will import the file:

<link rel="import" href="/files/my-folder/my-element.html">

I would prefer to be able to make this relative to the notebook, like so:

<link rel="import" href="./my-element.html">

The issue with that is that the notebook is loaded from /notebooks, but files are loaded from /files.

2. Imports within the element

How do I import dependencies from within my Polymer element? I tried the following:

<link rel="import" href="./static/urth_components/paper-toggle-button/paper-toggle-button.html"
    is="urth-core-import" package="PolymerElements/paper-toggle-button">
<link rel="import" href="./static/urth_components/iron-list/iron-list.html"
    is="urth-core-import" package="PolymerElements/iron-list">

but those don't load correctly. The issue is that the browser tries to load these relative to my Polymer element file (loaded from /files), whereas the location of the static/urth_components directory is in /notebooks/my-folder.

Scala support does not support serializing booleans

@vinomaster hit this problem on his demo notebook. If we do something like

channel().set("aVar", false)

or

channel().set("aVar", true)

They are getting sent to the browser as strings. We cannot then use them as expected in a <template is='dom-if'>.

The problem is https://github.com/jupyter-incubator/declarativewidgets/blob/master/kernel-scala/src/main/scala/urth/widgets/util/SerializationSupport.scala#L27 is missing a case of Boolean and converting to JsBoolean.

/cc @wellecks

Documentation rendering issues on IE and Safari

Noticed some rendering issues on IE and Safari:

IE (10, 11, Edge):

  • index.html - Navigation links (Docs, Repository) at top are not visible.
  • index.html - Hero element does not reflow correctly on small screens.
  • index.html - Column features are not honoring the max width.
  • docs.html - Does not render at all

Safari:

  • docs.html - Have to double click navigation elements in the left hand nav to get them to work. Single click just highlights the nav link.

User can watch channel data using a javascript event handler

We need a simple way to allow some javascript code be set as handler to changes to data on a channel. Right now the only way is to use a template element and use {{var}} syntax.

Say we have a python cell with:
channel("foo").set("x", 'new val')

We might should be able to support watching "x" change. something like
channle("foo").watch("x", function(){ //handler})

another option is to create a urth-core-channel element (Note singular channel) and have that be a point to binging event handlers.

urth-core-bind templates are not getting initialized with the data already on the channel

If we have a cell that does

from urth.widgets.widget_channels import channel
channel('c').set('user', 'Python')

Run that cell and then run a subsequent cell with code

%%html
<template is='urth-core-bind' channel='c'>
    <div>Hello from <span>{{user}}</span></div>
    Name: <input value='{{user::input}}'></input>
</template>

The value of variable c is not set in the <template>.

The expectation is that the <template> renders with any values that are already on the channel.

Thanks to @jhpedemonte and @dalogsdon

User can instantiate UI elements using kernel language

The idea would be to create a generic API that would allow building arbitrary elements. Sort of model against the DOM API and not at all specific to a set of widgets.

Something like:

elmt = createElement("urth-core-function")
elmt.set("ref", "something")
elmt.set("val", "{{var}}")

parent.appendChild(elmt)

parent.show()

And so on...

Extra comm message sent on Python Widget creation

The ipywidgets Widget class sends an update state message upon creation. Our widget system does not use the contents of this message, and it leads to unnecessary console logs and warnings, e.g. all of the below logs when the urth-core-channels is created:

screen shot 2015-10-01 at 2 26 29 pm

Cannot install different version of already installed Polymer element

If I add a Polymer element to my notebook using:

<link rel="import" href="./static/urth_components/paper-toggle-button/paper-toggle-button.html"
    is="urth-core-import" package="PolymerElements/paper-toggle-button">

but then want to change to a specific version, like this:

<link rel="import" href="./static/urth_components/paper-toggle-button/paper-toggle-button.html"
    is="urth-core-import" package="PolymerElements/paper-toggle-button#v1.0.10">

it does not install the alternate version.

I presume it does a check for name only and does not install if that name is found?

Upgrade to Polymer v1.2

Polymer v1.2 introduced a change to Polymer.Collection which introduces a # prefix to the keys in the collection. This is breaking our ability to set and retrieve data channel values correctly and results in ~37 failed unit tests. The Polymer change was introduced in commit Polymer/polymer@85d8a3a

Since Polymer.Collection is not a documented interface and it appears we are not using it as intended, we should probably consider other alternatives to prevent this from breaking us again in the future.

User gets error feedback if the urth widgets are not configured correctly

Need a strategy to surface errors to the end user when widgets are not properly working.

One example is using an urth-core-function element and referring to a function that does not exist, or calling with incorrect parameters. We should display something near the cell to alert the user of the error.

Create a Channel inspector element to help user debug

@vinomaster just showed me a dashboard he created in which he added a template on the page to help him debug issues with channels. I think that this is a nice reusable pattern that should be encapsulated as an element.

I propose we create urth-tools-channel-inspector. The first go at this element will basically render the data in the channel in a simple table.

Enable running system test locally and on travis for pull request

We currently have a system-test target that is configured to run with SauceLabs. It looks to see if the SauceLabs env variables are set. It currently runs only on Travis as part of a merge into master.

We need to have the following 2 things:

  1. A way to run system test locally, without the use of SauceLabs and without having to start anything else to get it to work (i.e selenium). Should be model after make test-js.
  2. A way to run system tests on travis for PRs. This should be modeled aftet 'make test-js-remote`. In that target, the tests are fully ran on Travis using selenium and firefox.

I suggest that we use 2 targets as we do with make test-js and 'make test-js-remote'.

Docker images necessary for development are out of date

The cloudet/pyspark-notebook-bower-sparkkernel and cloudet/sbt-sparkkernel-image images used in the Makefile contain an old version of the Spark Kernel.

Crucially, this old version doesn't have the fix for defect 137 which is necessary for properly displaying the Scala widgets, e.g. in the urth-core-scala.ipynb examples notebook. As a result, it's difficult to introduce and test new features on the Scala widgets.

Should user explicitly init the declarative widget system

Currently this project adds an extension to Jupyter that initializes the Widget system on the Notebook page on load. This assumes that the kernel is ready to start accepting COM messages.

In the case of the Scala Kernel, the user must add the jar for the declarativewidget support and explicitly initialize the widget system (e.g. create a com open handler). To support this, we already have code in place on the JS side that runs after each code cell execution to check if the widget system is ready. There is a default of 10 tries (10 cells executed).

I propose that we reconsider how we are initializing and rather have the user explicitly initialize everything by running kernel code.

In python

from urth import widgets
widgets.init()

In scala

import urth._
widgets.init()

The init function would do the following:

  1. Make sure that the handler for COM opens on the kernel side is there (in python this is taken care by ipywidgets)
  2. Send JS code to the browser that would cause the browser side initialization to take place, basically import some elements and setup the data channel.

bower install of elements freezes server

Noticed yesterday when downloading threejs (which takes a while) that the bower install of elements completely freezes the server, such that I can't load or work on a different notebook. If possible, bower install should be handled asynchronously so as not to bog down everything else.

System Integration test suite

Our current testing strategy relies solely on unit test. We need to put together a suite of system test to verify main user level features of the widgets across multiple browsers.

Main concern:

  • urth-core-import installation of new elements
  • Proper results after Run-All cells
  • Selection capabilites

Python 2.7 Support

Hello,

I am trying to deploy the declarative widgets into our test environment. I am wondering: what is missing the get the declarative widgets to work on Python 2.7?

As of now, is Python 3 required only for user code, meaning that a Python 3 kernel in IPython running on 2.7 works? Or is Python 3 only needed for the notebook? Or both?

Thanks,
Thibaud

Timing issue between importing dependency and making use of it

Test notebook: https://gist.github.com/jhpedemonte/5193b20258742172778c

  1. Load test notebook.
  2. Run All.
  3. Try to interact with toggle button. Notice that it doesn't work. Also, it should have defaulted to 'on' (liveUpdate is true).
  4. Select cell with Polymer element and run that one again. Toggle button should now work as expected.

  5. Clear output and reload notebook.
  6. Run each cell one-by-one. Notice that toggle button works as expected.

  7. Clear output and reload notebook.
  8. Uncomment the 2 lines of Python code which sleep for 1 second.
  9. Run All. Notice that toggle button works as expected and defaults to 'on'.

Fix javascript unit test execution for pull requests

Our current build uses sauce labs to run the javascript unit tests. However, the test-js make target had to essentially be disabled on pull request builds since the sauce environment variables are not passed from Travis CI on pull request builds for security reasons. Travis CI does support running javascript tests locally through xfvb in the firefox browser. Problem is the javascript unit tests have a number of failures when run in firefox (but don't fail in chrome). The tests should be fixed to execute across browsers and the pull request build environment should be setup to execute them in xfvb on firefox through Travis CI.

User can change the signature of a function and the urth-core-function-element will react to the change

The urth-core-function element only receives an update message for signature at create time. If the user changes the function's signature and re-executes the cell... the urth-core-function element might get out of sync. This can lead to incorrect invocations.

A similar approach to what urth-core-dataframe does to update its value when it detects any cell execution would be a good first approach to trigger the sync request.

Once the element gets the new signature, all related properties (default values, valid state, etc.) should be updated.

Sync messages fire after widgets are detached

Widgets that use auto fire sync messages after each code execution completes. However, the callback used to fire these messages isn't removed when the widget is detached, resulting in extra sync messages.

E.g. re-run a cell that creates an urth-core-function with auto. After any further cell executions, two sync messages will be sent even though only one urth-core-function is attached.

'Run all' with urth-core-function auto does not execute

Load test notebook from https://gist.github.com/jhpedemonte/c650d0c608344d41723f

  1. Select 'Run all'. Notice that called1 and called2 are both zero, signifying that neither of the loadData functions was called.
  2. Clear and refresh page.
  3. Execute each cell individually. Notice that called1 remains zero, but called2 is now 1.

It appears that declaring an urth-core-function with the auto parameter separately (in another notebook cell) from a template that defines an argument to the function will execute automatically as intended.

If the urth-core-function is declared in the same template as an element that defines an argument to the function, the function does not execute.

Timing issue?

Loading error when installing with `make sdist`

Hello,

I am trying to use the declarative widgets on my local ipython install. After running make sdist I can see that the widgets are installed in my user profile: ~/.ipython/nbextensions/urth_widgets/. However, I get the following error in my browser console:

[Log] Loaded extension: urth_dash_js/notebook/main (utils.js, line 29)
[Log] Loaded extension: urth_widgets/js/main (utils.js, line 29)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (webcomponents-lite.min.js, line 0)

Am I missing a step? Where is webcomponents-lite.min.js supposed to be?

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.