GithubHelp home page GithubHelp logo

mozilla / jupyter-notebook-gist Goto Github PK

View Code? Open in Web Editor NEW
81.0 28.0 20.0 153 KB

Create, list, and load GitHub Gists from Jupyter notebooks

License: Mozilla Public License 2.0

Python 63.83% JavaScript 36.17%

jupyter-notebook-gist's Introduction

jupyter-notebook-gist

No Maintenance Intended Build Status codecov

NOTE: This project is currently unmaintained, if anyone would like to take over maintenance please let us know.

Create a gist from the Jupyter Notebook UI.

Installation

To install, simply run:

pip install jupyter-notebook-gist
jupyter serverextension enable --py jupyter_notebook_gist
jupyter nbextension install --py jupyter_notebook_gist
jupyter nbextension enable --py jupyter_notebook_gist
jupyter nbextension enable --py widgetsnbextension

The last step is needed to enable the widgetsnbextension extension that Jupyter-Notebook-Gist depends on. It may have been enabled before by a different extension.

You may want to append --user to the commands above if you're getting configuration errors upon invoking them.

To double-check if the extension was correctly installed run:

jupyter nbextension list
jupyter serverextension list

To uninstall the extension run:

jupyter serverextension disable --py jupyter_notebook_gist
jupyter nbextension disable --py jupyter_notebook_gist
jupyter nbextension uninstall --py jupyter_notebook_gist
pip uninstall jupyter-notebook-gist

Configuration

After installing, edit your jupyter_notebook_config.py file to specify the GitHub client id and secret.

If your jupyter_notebook_config.py file does not exist, you can create one by running jupyter notebook --generate-config. You can check the location of this file by running jupyter --config-dir.

c.NotebookGist.oauth_client_id = "my_client_id"         # FIXME
c.NotebookGist.oauth_client_secret = "my_client_secret" # FIXME

Replace the vars above with a working GitHub client id and secret. You can create one here.

Here's an example of an OAuth application created by @mreid-moz for testing.

Then run jupyter notebook from the repo root.

Alternatively you can also pass the GitHub client id and secret as command line parameters when you run the notebook (please fill the placeholders accordingly):

jupyter notebook --NotebookGist.oauth_client_id="<my_client_id>" --NotebookGist.oauth_client_secret="<my_client_secret>"

Changelog

Master

  • Buttons for loading gists are now available on the "tree" (file manager) page in Jupyter.

  • IMPORTANT Requires manual step to enable after running pip install (see installation docs)!

    To update:

    1. Fully uninstall the extension first:
    jupyter serverextension disable --py jupyter_notebook_gist
    jupyter nbextension disable --py jupyter_notebook_gist
    jupyter nbextension uninstall --py jupyter_notebook_gist
    pip uninstall jupyter-notebook-gist
    
    1. Follow the instructions above to reinstall

0.4.0 (2016-07-06)

  • Refactored config system to be able to configure it via CLI options or config values in ~/.jupyter/jupyter_notebook_config.py

  • Fixed a bunch of Python packaging and code quality issues

  • Fixed a few issues in Python test suite

  • Set up continuous integration: https://travis-ci.org/mozilla/jupyter-notebook-gist

  • Set up code coverage reports: https://codecov.io/gh/mozilla/jupyter-notebook-gist

  • IMPORTANT Requires manual step to enable after running pip install (see installation docs)!

    To update:

    1. Run pip uninstall jupyter-notebook-gist
    2. Delete gist.js from your nbextensions folder.
    3. Delete any references to jupyter-notebook-gist.create_gist in jupyter_notebook_config.json (in your .jupyter directory)
    4. Delete any references to gist in notebook.json (in .jupyter/nbconfig)
    5. Follow installation instructions to reinstall

jupyter-notebook-gist's People

Contributors

agjwong avatar jezdez avatar lewisnicolle avatar mdboom avatar mozilla-github-standards avatar mreid-moz avatar musicaljelly avatar shaybeau731 avatar uberi avatar yeah568 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

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  avatar  avatar  avatar

jupyter-notebook-gist's Issues

Javascript should be linted

We should run eslint or similar over all of the Javascript files as part of Travis.

Any preferences or best practices we want to follow? I have no preference other than just picking something.

"You haven't configured your GitHub Client ID"

I followed all of the instructions to install and configure jupyter-notebook-gist.

I can see the gist button in my notebook. But when I click it, I get the message "You haven't configured your GitHub Client ID in your jupyter_notebook_config.py file. Please set the Client ID and Secret before using this plugin. See the README for more info."

I created and populated my jupyter_notebook_config.py file precisely as described in the README (after creating a new OAUTH app on github). I also tried launching the notebook with oauth_client_id and secret specified as command line arguments. No luck.

In the absence of any more verbose errors or debugging info, I am totally stuck and have no idea how to proceed.

I am using jupyter version 4.3.0, notebook version 5.0.0, and python 3.7.

Oauth client secret not recognized

I followed the install instructions, but get the following error in the console. I get four new buttons in the toolbar and can download public gists but not upload etc.

I'm running Anaconda 64 bit, python 3.5
Python 3.5.1 |Anaconda 2.4.0 (64-bit)| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)]

[W 17:31:19.327 NotebookApp] Config option `oauth_client_secret` not recognized
by `NotebookApp`.  Did you mean `cookie_secret`?
[W 17:31:19.329 NotebookApp] Config option `oauth_client_id` not recognized by `
NotebookApp`.
[W 17:31:19.330 NotebookApp] Unrecognized JSON config file version, assuming ver
sion 1
[I 17:31:21.060 NotebookApp] Serving notebooks from local directory: C:\Users\e.
howick
[I 17:31:21.061 NotebookApp] 0 active kernels
[I 17:31:21.061 NotebookApp] The Jupyter Notebook is running at: http://localhos
t:8888/
[I 17:31:21.062 NotebookApp] Use Control-C to stop this server and shut down all
 kernels (twice to skip confirmation).

Wiki changes

FYI: The following changes were made to this repository's wiki:

These were made as the result of a recent automated defacement of publically writeable wikis.

Travis CI free usage ends Dec 3; mozilla repos should switch to other CI platforms

We're opening this issue because your project has used Travis CI within the last 6 months. If you have already migrated off it, you can close and ignore this issue.

Travis CI is ending free builds on public repositories. travis-ci.com stopped providingthem in early November, and travis-ci.org will stop after December 31, 2020. To avoid disruptions to your workflows, you must migrate to another CI service.

For production use cases, we recommend switching to CircleCI. This service is already widely used within Mozilla. There is a guide to migrating from Travis CI to CircleCI available here.

For non production use cases, we recommend either CircleCI or Github Actions. There is a guide to migrating from Travis CI to Github Actions available here. Github Actions usage within Mozilla is new, and you will have to work with our github administrators to enable specific actions following this process.

If you have any questions, reach out in #github-admin:mozilla.org on matrix.

Downloading gist to server fails

It returns a 403 when POSTing to the /download_notebook endpoint with the message:

403 POST /download_notebook (::1): '_xsrf' argument missing from POST  

Installation when done within a virtual environment by pew

If using pew,
the installation instructions need to be modified from

jupyter nbextension install --py jupyter_notebook_gist

to

pew new EXAMPLE
NBDIR=`which jupyter`
jupyter nbextension install --py jupyter_notebook_gist --nbextensions=$NBDIR/share/jupyter/nbextensions

Looking for new maintainers

This project is currently unmaintained, so if anyone would like to take over maintenance please feel free to reach out to me or comment below.

ModuleNotFoundError: No module named 'nbconvert.exporters.export'

jupyter notebook --version == 6.1.5
Python 3.8

Please let me know what further info is required.

[W 10:53:04.806 NotebookApp] Error loading server extension jupyter_notebook_gist
    Traceback (most recent call last):
      File "/home/dpetrovic/anaconda3/lib/python3.8/site-packages/notebook/notebookapp.py", line 1945, in init_server_extensions
        func(self)
      File "/home/dpetrovic/anaconda3/lib/python3.8/site-packages/jupyter_notebook_gist/__init__.py", line 46, in load_jupyter_server_extension
        from .handlers import GistHandler, DownloadNotebookHandler, LoadGistHandler
      File "/home/dpetrovic/anaconda3/lib/python3.8/site-packages/jupyter_notebook_gist/handlers.py", line 8, in <module>
        from nbconvert.exporters.export import export_by_name
    ModuleNotFoundError: No module named 'nbconvert.exporters.export'

JSON error when enabling extension

I am trying to follow the instructions to install and enable this extension. But I am getting the following error at the enable step:

$ jupyter nbextension enable jupyter_notebook_gist --user --py
Enabling notebook extension jupyter-notebook-gist/extension...
Traceback (most recent call last):
  File "/Users/rpa/anaconda/bin/jupyter-nbextension", line 6, in <module>
    sys.exit(notebook.nbextensions.main())
  File "/Users/rpa/anaconda/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/Users/rpa/anaconda/lib/python2.7/site-packages/traitlets/config/application.py", line 596, in launch_instance
    app.start()
  File "/Users/rpa/anaconda/lib/python2.7/site-packages/notebook/nbextensions.py", line 969, in start
    super(NBExtensionApp, self).start()
  File "/Users/rpa/anaconda/lib/python2.7/site-packages/jupyter_core/application.py", line 256, in start
    self.subapp.start()
  File "/Users/rpa/anaconda/lib/python2.7/site-packages/notebook/nbextensions.py", line 877, in start
    self.toggle_nbextension_python(self.extra_args[0])
  File "/Users/rpa/anaconda/lib/python2.7/site-packages/notebook/nbextensions.py", line 853, in toggle_nbextension_python
    logger=self.log)
  File "/Users/rpa/anaconda/lib/python2.7/site-packages/notebook/nbextensions.py", line 459, in enable_nbextension_python
    logger=logger)
  File "/Users/rpa/anaconda/lib/python2.7/site-packages/notebook/nbextensions.py", line 380, in _set_nbextension_state_python
    for nbext in nbexts]
  File "/Users/rpa/anaconda/lib/python2.7/site-packages/notebook/nbextensions.py", line 345, in _set_nbextension_state
    cm.update(section, {"load_extensions": {require: state}})
  File "/Users/rpa/anaconda/lib/python2.7/site-packages/traitlets/config/manager.py", line 85, in update
    data = self.get(section_name)
  File "/Users/rpa/anaconda/lib/python2.7/site-packages/traitlets/config/manager.py", line 63, in get
    return json.load(f)
  File "/Users/rpa/anaconda/lib/python2.7/json/__init__.py", line 291, in load
    **kw)
  File "/Users/rpa/anaconda/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/Users/rpa/anaconda/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Users/rpa/anaconda/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Edit: versions:

$ jupyter --version
4.1.0
$ jupyter notebook --version
4.3.0

Improve README

There is no metion of where to find jupyter_notebook_config.py.

CODE_OF_CONDUCT.md file missing

As of January 1 2019, Mozilla requires that all GitHub projects include this CODE_OF_CONDUCT.md file in the project root. The file has two parts:

  1. Required Text - All text under the headings Community Participation Guidelines and How to Report, are required, and should not be altered.
  2. Optional Text - The Project Specific Etiquette heading provides a space to speak more specifically about ways people can work effectively and inclusively together. Some examples of those can be found on the Firefox Debugger project, and Common Voice. (The optional part is commented out in the raw template file, and will not be visible until you modify and uncomment that part.)

If you have any questions about this file, or Code of Conduct policies and procedures, please see Mozilla-GitHub-Standards or email [email protected].

(Message COC001)

Travis-CI tests are broken

I think the tests have broken due to a change in external dependencies in the two years since they last ran :)

Traceback (most recent call last):
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/bin/py.test", line 11, in <module>
    sys.exit(main())
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/_pytest/config.py", line 50, in main
    config = _prepareconfig(args, plugins)
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/_pytest/config.py", line 161, in _prepareconfig
    pluginmanager=pluginmanager, args=args)
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/pluggy/__init__.py", line 617, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/pluggy/__init__.py", line 222, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/pluggy/__init__.py", line 216, in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/pluggy/callers.py", line 196, in _multicall
    gen.send(outcome)
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/_pytest/helpconfig.py", line 68, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/pluggy/callers.py", line 77, in get_result
    _reraise(*ex)  # noqa
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/pluggy/callers.py", line 180, in _multicall
    res = hook_impl.function(*args)
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/_pytest/config.py", line 944, in pytest_cmdline_parse
    self.parse(args)
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/_pytest/config.py", line 1109, in parse
    self._preparse(args, addopts=addopts)
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/_pytest/config.py", line 1072, in _preparse
    self.pluginmanager.load_setuptools_entrypoints('pytest11')
  File "/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/local/lib/python2.7/site-packages/pluggy/__init__.py", line 402, in load_setuptools_entrypoints
    "Plugin %r could not be loaded: %s!" % (ep.name, e))
pluggy.PluginValidationError: Plugin 'flake8' could not be loaded: (flake8 2.6.2 (/home/travis/build/mozilla/jupyter-notebook-gist/.tox/py27/lib/python2.7/site-packages), Requirement.parse('flake8>=3.5'))!

Just creating the issue as a reminder to myself to look into it.

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.