quantstack / jupyterlab-snippets Goto Github PK
View Code? Open in Web Editor NEWSnippets Extension for JupyterLab
License: BSD 3-Clause "New" or "Revised" License
Snippets Extension for JupyterLab
License: BSD 3-Clause "New" or "Revised" License
It would be nice to be able to control if the snippet is inserted above or below the current cell. For instance, when you open a new notebook and want to paste in an import cell it would be nice to have it be the very first cell.
# <snippet-metadata>
# placement = 'above'
# </snippet-metadata>
p.s.
A++ on this extension - it's much nicer than my hacky bash + xdotool + gnome keyboard shortcuts approach
Hi
That would be great if you make extension compatible with jupyterlab 3.x
Thanks
Since the extension can load arbitrary text file content, should this extension still be named "code snippets"? Or just "snippets"?
The command <jupyter labextension install @quentinandre/jupyterlab_snippets>
results in the following error message:
Conflicting Dependencies:
JupyterLab Extension Package
=2.1.2 <2.2.0 >=0.19.1 <0.20.0@jupyterlab/application
=2.1.1 <2.2.0 >=0.19.1 <0.20.0@jupyterlab/apputils
=4.1.0 <4.2.0 >=2.1.3 <3.0.0 @jupyterlab/coreutils
=2.1.2 <2.2.0 >=0.19.1 <0.20.0@jupyterlab/notebook
If a user clicks on the snippets menu and there are no snippets perhaps a dialog could be raised that tells the user:
.py
files thereI think point 3 is particularly important as this may not be obvious
For snippets that are regularly used it would be great to access them via a keyboard shortcut rather than having to use the mouse. Perhaps shortcuts could be stored in a metadata comment at the top of the notebook?
Essentially each snipped could then have a short-name, where tab after that name expands the snippet. Repeated tab-presses then jumps you to the pre-defined places where input is needed, and a final tab puts you just outside the snippet end. One example
here and a more advanced example with auto-generated docstrings here.
It would be nice if the extension could (optionally) trim trailing whitespace of the snippet files.
Hello!
@tgeorgeux and I have been considering having our @jupytercalpoly Intern team do some user research this summer around a snippet extension for JupyterLab. They'd focus on the design aspects, user experience, and user stories for this type of extension.
Depending on your plans for this extension, we'd love to collaborate with you. We can have a team of three students doing some design+prototyping full-time over the summer and (hopefully) contribute some useful work around this extension's user experience. Let me know what you think!
It would be great to have this package released on conda as well!
Having a Binder link would be really useful to give an idea of what it looks like.
Also we could use the default snippets to populate the menu.
When allowing modifications in the snippets folder within JupyterLab data path, __pycache__ folder may get created along side the snippets. This folder is getting listed in the snippets menu. Also, existing/auto-generated hidden files like .DS_STORE can be removed from getting listed in the snippets menu.
This was briefly discussed offline at some point.
Maybe we should consider moving this extension to the jupyterlab-contrib
organization on GitHub? https://github.com/jupyterlab-contrib
This could help make the extension more visible, and highlight the fact it is developed by the community.
For now snippets only work for notebooks, and a new cell is created when a snippet is chosen.
But it could actually be used for files and consoles too, by injecting the code snippet into the code editor at the current cursor location.
Maybe from the notebook context menu? Or as the first item on the snippets menu item.
I recently did a clean install of Jupyter Lab so I have a stable setup, without all those startup warnings etc.
I am keen to again have a "snippets" capability.
However I am a bit reluctant to install this Quantstack/jupyterlab-snippets (at v0.4.1) due to the downgrades of jupyterlab and jupyter_client that this will entail. See conda install dialog below.
Are there plans to update this module to work with the newer versions of Jupyter Lab?
thanks
pwsh> conda install -c conda-forge jupyterlab-snippets
added / updated specs:
- jupyterlab-snippets
The following packages will be downloaded:
package | build
---------------------------|-----------------
ipython_genutils-0.2.0 | py_1 21 KB conda-forge
jupyter_client-7.4.9 | pyhd8ed1ab_0 97 KB conda-forge
jupyterlab-3.5.0 | pyhd8ed1ab_0 6.0 MB conda-forge
jupyterlab-snippets-0.4.1 | pyhd8ed1ab_0 19 KB conda-forge
jupyterlab_pygments-0.3.0 | pyhd8ed1ab_0 18 KB conda-forge
nbclassic-1.0.0 | pyhb4ecaf3_1 5.7 MB conda-forge
nbconvert-7.16.3 | hd8ed1ab_0 8 KB conda-forge
nbconvert-pandoc-7.16.3 | hd8ed1ab_0 7 KB conda-forge
notebook-6.5.6 | pyha770c72_0 299 KB conda-forge
pandoc-3.1.12.3 | h57928b3_0 23.7 MB conda-forge
pyzmq-24.0.1 | py311h7b3f143_1 533 KB conda-forge
zeromq-4.3.4 | h0e60522_1 8.9 MB conda-forge
------------------------------------------------------------
Total: 45.3 MB
The following NEW packages will be INSTALLED:
ipython_genutils conda-forge/noarch::ipython_genutils-0.2.0-py_1
jupyterlab-snippe~ conda-forge/noarch::jupyterlab-snippets-0.4.1-pyhd8ed1ab_0
nbclassic conda-forge/noarch::nbclassic-1.0.0-pyhb4ecaf3_1
nbconvert conda-forge/noarch::nbconvert-7.16.3-hd8ed1ab_0
nbconvert-pandoc conda-forge/noarch::nbconvert-pandoc-7.16.3-hd8ed1ab_0
notebook conda-forge/noarch::notebook-6.5.6-pyha770c72_0
pandoc conda-forge/win-64::pandoc-3.1.12.3-h57928b3_0
The following packages will be DOWNGRADED:
jupyter_client 8.6.1-pyhd8ed1ab_0 --> 7.4.9-pyhd8ed1ab_0
jupyterlab 4.1.5-pyhd8ed1ab_0 --> 3.5.0-pyhd8ed1ab_0
jupyterlab_pygmen~ 0.3.0-pyhd8ed1ab_1 --> 0.3.0-pyhd8ed1ab_0
pyzmq 25.1.2-py311h9250fbb_0 --> 24.0.1-py311h7b3f143_1
zeromq 4.3.5-h63175ca_1 --> 4.3.4-h0e60522_1
In this github main documentation the following link to Usage
documentation is broken. (see link below).
Please remove it or fix it. I cannot find the page to which it points.
Add snippets in [jupyter_data_dir]/snippets (see: https://jupyter.readthedocs.io/en/latest/projects/jupyter-directories.html#id2)
To test:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.