GithubHelp home page GithubHelp logo

thomasballinger / observable-jupyter Goto Github PK

View Code? Open in Web Editor NEW
53.0 7.0 10.0 8.43 MB

Embed visualizations and code from Observable notebooks in Jupyter

Home Page: https://observable-jupyter.readthedocs.io/

License: ISC License

Jupyter Notebook 98.59% Python 0.96% JavaScript 0.45%
jupyter jupyter-notebook notebook observablehq plotting plotting-in-python

observable-jupyter's People

Contributors

dfhannum avatar pbogden avatar rstorni avatar thomasballinger avatar tophtucker 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

observable-jupyter's Issues

Option to run only dependent cells

observable-jupyter currently runs all cells of a notebook. It may come up that people want to run only a selection of cells. (I messed this up in #5)

Robservable uses include=[a, b, c] and hide=[c] to run a, b, and c but only display a and b. This API wouldn't be backwards-compatible, but it seems nice.

There are a variety of possible APIs!

runtime update causes implicit dependencies not to run their side effects

A good API change (any falsy value observer value causes a cell not to be observed) causes a behavior change in observable_jupyter: when specific cells are embedded, other cells they implicitly depend on for side effects will not run!

This change was published in 0.1.8 for about five minutes, from 5:43pm to 5:49 today, at which point I deleted the release.

This may be a behavior uses want — the hide= option that robservable uses is nice — but this would be a confusing breaking change to surprise users with. observable_jupyter users expect all cells to be run by default.

  • 2021-09-24 17:43:41+0000 0.1.8 published on PyPI containing this bug
  • 2021-09-25T00:49:34+0000 0.1.8 deleted from PyPI

error importing observable_jupyter (version 0.1.11) on Colab

Hi, I'm seeing an error when I import the newer version 0.1.11 of observable_jupyter

The example can be seen in this colab notebok

!pip install observable_jupyter
from observable_jupyter import embed
embed('@mbostock/epicyclic-gearing', cells=['graphic'], inputs={'speed': 0.2})

gives

Collecting observable_jupyter
  Downloading observable_jupyter-0.1.11.tar.gz (218 kB)
     |████████████████████████████████| 218 kB 24.9 MB/s 
Building wheels for collected packages: observable-jupyter
  Building wheel for observable-jupyter (setup.py) ... error
  ERROR: Failed building wheel for observable-jupyter
  Running setup.py clean for observable-jupyter
Failed to build observable-jupyter
Installing collected packages: observable-jupyter
    Running setup.py install for observable-jupyter ... error
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ou6cpj4y/observable-jupyter_aeeb949b00664482a1f6b29190831e9c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ou6cpj4y/observable-jupyter_aeeb949b00664482a1f6b29190831e9c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-6r6c2eme/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/observable-jupyter Check the logs for full command output.
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-ed6c3cb33f01> in <module>()
      1 get_ipython().system('pip install observable_jupyter')
----> 2 from observable_jupyter import embed
      3 embed('@mbostock/epicyclic-gearing', cells=['graphic'], inputs={'speed': 0.2})

ModuleNotFoundError: No module named 'observable_jupyter'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

But, if I pip install 1.1.10 it works - see this colab notebook

error with embedded notebooks

I'm seeing an error in the embeds of Observable visualizations in previously run Jupyter notebooks that says @variable is not defined. This appears to have just started to happen today and can be reproduced in some of the examples from the demo Google Colab notebook from this repo:

Here's an example

import this
text = ''.join(this.d.get(l, l) for l in this.s)
embed('@ballingt/word-cloud-example', cells=['chart'], inputs={'source': text})
chart = RuntimeError: @variable is not defined

Also, here's a screenshot

Screen Shot 2022-09-20 at 6 31 06 PM

It is interesting since the first gear embedding is working and the visuals from the embedded Observable notebooks are working properly

What an ugly name! (I can say that, I named it)

The least important of the many things I'm jealous of robservable for.

inconsistent too:

  • observable-jupyter is the github repo (fine, by convention)
  • observable_jupyter on pypi (pypi prefers dashes, at the time I thought it would be good for it match the module name)
  • from observable_jupyter import embed is the module name, that's fine

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.