Giter Club home page Giter Club logo

jupyter_boilerplate's People

Contributors

haraldschilly avatar jcb91 avatar moble avatar rseiji 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

jupyter_boilerplate's Issues

Move custom submenu up to postion next to snippets menu item

By editing the bottom of the custom.js file, I have succeeded in adding a three customized submenu items under the python snippet menu. I now want to promote one customized submenu (my_favorites2) up up to the level of a menu item next to the snippets menu item. I succeeded in doing so with the numpy sub-menu but not with my_favorites2. I am a javascript beginner.

   snippets_menu.options['menus'] = snippets_menu.default_menus;
    snippets_menu.options['menus'][0]['sub-menu'].push(horizontal_line);
    snippets_menu.options['menus'][0]['sub-menu'].push(my_favorites);
    snippets_menu.options['menus'][0]['sub-menu'].push(my_favorites2);
    snippets_menu.options['menus'][0]['sub-menu'].push(my_favorites3);
    snippets_menu.python.numpy['sub-menu-direction'] = 'left'; // Point new Numpy menus to left
    //snippets_menu.python.my_favorites2['sub-menu-direction'] = 'left'; // Point new Numpy menus to left
    //snippets_menu.options['menus'].push(snippets_menu.default_menus[0]); // Start with the remaining "Snippets" menu
    snippets_menu.options['menus'].push(snippets_menu.python.numpy); // Follow that with a new Numpy menu
    //snippets_menu.options['menus'].push(snippets_menu.python.my_favorites2); // Follow that with a new Numpy menu
    console.log('Loaded `snippets_menu` customizations from `custom.js`');

No reaction when updating `custom.js`

Hello there,

I am trying to include a customised menu in jupyter notebooks using menu_snippets. Anyhow, when I put example code in the custom.js, I do not get any additional menu after refreshing my jupyter notebooks.

  • I was trying to create a customised menu using the custom.js file such that I could see an additional menu in my toolbar.
  • I expected to see a menu labeled "My favorites" in the toolbar.
  • Anyhow, I do not see that menu, even though I can see the snippet menu and use it, indicating that the extension installs and is enabled.
  • Error messages I receive:
    • When launching jupyter-notebooks: [W 12:54:30.919 NotebookApp] 404 GET /nbextensions/nbextensions_configurator/tree_tab/main.js?v=20230317125426 (127.0.0.1) 9.610000ms referer=http://localhost:8888/tree

I have tried different ways and also inspected the main.js in jupyter_boilerplate, but could not find a way out of this. Do you have any ideas what I can do to make the custom.js do its magic?

How did I get that error?

  1. installed jupyter-notebooks via pip install jupyter
  2. It is likely that I installed nbextensions, since the folder jupyter/nbextensions existed when I executed 3.a, but I cannot verify how that happened anymore.
  3. installed menu_snippets using:
  • a cd $(jupyter --data-dir)/nbextensions
  • b git clone https://github.com/moble/jupyter_boilerplate
  • c jupyter nbextension install jupyter_boilerplate --user
  • d jupyter nbextension enable jupyter_boilerplate/main --user
  1. used custom.js in ~/.jupyter/custom/custom.js and added the following code:
require(["nbextensions/snippets_menu/main"], function (snippets_menu) {
    console.log('Loading `snippets_menu` customizations from `custom.js`');
    var horizontal_line = '---';
    var my_favorites = {
        'name' : 'My favorites',
        'sub-menu' : [
            {
                'name' : 'Menu item text',
                'snippet' : ['new_command(3.14)',],
            },
            {
                'name' : 'Another menu item',
                'snippet' : ['another_new_command(2.78)',],
            },
        ],
    };
    snippets_menu.options['menus'] = snippets_menu.default_menus;
    snippets_menu.options['menus'][0]['sub-menu'].push(horizontal_line);
    snippets_menu.options['menus'][0]['sub-menu'].push(my_favorites);
    console.log('Loaded `snippets_menu` customizations from `custom.js`');
});

  1. When refreshing jupyter-notebooks, I now see the Snippets-Menu, but no additional menu as I should and also no subsequent sub menu.

Environment

  • Operating system: 5.19.0-35-generic #36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
  • Browser software version: Firefox Snap for Ubuntu, 110.0.1 (64-bit)

Ideas

  • The error in the console when starting jupyter-notebooks makes me suspicious, even though having the Snippets-menu in jupyter notebooks indicates that it has been loaded
  • I am having some confusion with the snippets_menu extension as well as the jupyter_boilerplate extension and what goes where. So could it be a confusion with names that led me to my error? Since the custom.js is neither in /snippets_menu nor /jupyter_boilerplate, I would think it would work regardless of my confusion.

I would be grateful if you have a solution for that or have an idea on how to fix that issue.

Best

Look at EPath for sympy menus

This is a new feature since the last time I was doing serious tree traversal. Might be useful...

Looks like EPath stands for manipulating expressions by path. Perhaps meant to be a formation similar to XPath. Ah, yes. It even says so in the docstring for epath.

Allow specifying code location

It would be great if a snippet could be targeted at specific locations in the code. For example, if the code to add imports could be directly sent to the first cell even if I am somewhere else in the code. Furthermore, if parts of the snippet can go in different places that would be even better. This will allow adding profiling to a notebook in which case you may wish to run something at the beginning of the notebook (say, start a data collection process) and run the analysis at the end of the notebook.

More boilerplate for python

There are still some "not yet implemented" functions, that are mostly just
placeholders to remind me to do something about them.

  • SymPy examples can probably be copied from the cheatsheet
  • Matplotlib examples can probably be easily copied from the gallery
  • NumPy needs some real functions
  • SciPy needs some real functions
  • pandas needs some good slicing examples

Generally, more boilerplate can always be added.

Allow onclick to accept arbitrary JavaScript

The main thing stopping this from being a pretty general menuing extension is the inability to accept general JavaScript for onclick instead of snippets.

While I'm at it, I might as well add an option to accept simple text items for typesetting -- for example, to explain that CODATA returns are val,unit,uncert.

Add boilerplate for Julia and R

Change the default menu to specifically note that it is python. Then add (as
best I can) some boilerplate for Julia and R. Note that markdown is common to
all three, so I can just separate that out, and add it in to each.

Scrollable menus?

E.g., "SymPy => Functions => Elementary Functions" shows a menu that goes from "Abs" to "Atan2", arrives to the screen's lower border and stops there: no cosine, no exponential, no...

Links for the documentation doesn`t work

When clicking on any documentation link it just open another tab with my notebook.

May be it is a template issue because the link has an empty href.

<li>
  <a href="#" target="_blank" title="Opens in a new window">
    <i class="fa fa-external-link menu-icon pull-right"></i><span>Documentation</span>
  </a>
</li>

Snippets Menu did't appear

After checking "Snippets Menu" in Configurable nbextensions, Snippets did't appear as expected, then I checked out "JavaScript console", found a red line :".html(menu_item_spec.name)---Uncaught (in promise) TypeError: Cannot read property 'name' of undefined" at main.js(line 181) , while I don’t know much about JS, could you please help with it?
Thanks!

Binding snippets to words with hotkey completion

It would be so awesome if, in addition to being able to go to the snippets menu in order to insert snippet, one could simply type, for example,
function
then hit a hot key, say <tab> and have the snippet inserted, like
def function_name(): variables = something return variables

I don't know how feasible this is, but it would be awesome. There is already something like this called ultisnips (https://github.com/SirVer/ultisnips) as a package for Vim.

Improve implementation of javascript

Since I'm so new to JavaScript, I hadn't seen jQuery before, so some of my code is quite ugly. It still
works, but I could bring it more into line with other ipython programming. Something like the following:

var help_menu=$("body").find("ul#help_menu");
var boilerplate_menu=$("<ul/>").addClass("dropdown-submenu").append($(<a/>").text(sub_menu_item));
help_menu.after(boilerplate_menu);

More flexible menus

It would be nice to add a couple improvements to the menu-item formatting. For
example, it should be possible (and easy!) to take an arbitrary javascript
function as the command to be executed onClick.

Or maybe we want the top level of a sub-menu to be clickable -- for example,
where there's one basic option that might be needed frequently, but then a
sub-menu with some more advanced options. In this case, the item's value would
probably be an array, with first element a string, and second element the
sub-menu.

This one could probably be changed when I deal with the first issue above.

Menu ordering

I'm new to javascript, so I based my menu structure on objects, not realizing
that they have no order. So it's impossible to re-order the menus. I
apparently should have used arrays. It should be easy enough to redo this.

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.