# nbtools for JupyterLab
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/genepattern/nbtools/lab?urlpath=lab)
[![Build Status](https://travis-ci.org/genepattern/nbtools.svg?branch=lab)](https://travis-ci.org/genepattern/nbtools)
[![Documentation Status](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](https://gpnotebook-website-docs.readthedocs.io/en/latest/)
[![Docker Pulls](https://img.shields.io/docker/pulls/genepattern/genepattern-notebook.svg)](https://hub.docker.com/r/genepattern/genepattern-notebook/)
[![Join the chat at https://gitter.im/genepattern](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/genepattern/genepattern-notebook?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
**nbtools** is a framework for creating user-friendly Jupyter notebooks that are accessible to both programming and non-programming users. It is a core component of the [GenePattern Notebook environment](https://notebook.genepattern.org). The package provides:
* A decorator which can transform any Python function into an interactive user interface.
* A toolbox interface for encapsulating and adding new computational steps to a notebook.
* Flexible theming and APIs to extend the nbtools functionality.
* A WYSIWYG editor for markdown cells (provided as part of the accompanying `juptyter-wyswyg` package and coming soon to JupyterLab).
**Prerequisites**
* JupyterLab >= 2.0.0
* ipywidgets >= 7.0.0
## Docker
A Docker image with nbtools and the full JupyterLab stack is available through DockerHub.
```bash
docker pull genepattern/lab
docker run --rm -p 8888:8888 genepattern/lab
```
## Installation
This is a beta version that has not yet been released to PIP or conda. For now you will need to install from GitHub:
```bash
# Install ipywidgets, if you haven't already
jupyter nbextension enable --py widgetsnbextension
jupyter labextension install @jupyter-widgets/jupyterlab-manager
# Clone the nbtools repository
git clone https://github.com/genepattern/nbtools-lab-prototype.git
cd nbtools-lab-prototype
# Install the nbtools JupyterLab prototype
pip install .
jupyter labextension install .
jupyter nbextension install --py nbtools --sys-prefix
jupyter nbextension enable --py nbtools --sys-prefix
```
In the future you will be able to install using pip:
```bash
pip install nbtools
```
Or if you use jupyterlab:
```bash
pip install nbtools
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install @genepattern/nbtools
```
If you are using Jupyter Notebook 5.2 or earlier, you may also need to enable
the nbextension:
```bash
jupyter nbextension enable --py [--sys-prefix|--user|--system] nbtools
```
## Development
For a development install (requires npm version 4 or later), do the following in the repository directory:
```bash
npm install
jupyter labextension link .
```
To rebuild the package and the JupyterLab app:
```bash
npm run build:all
jupyter lab build
```
## Getting Started
Let's start by writing a simple Hello World function and turning it into an interactive widget. Go ahead and install nbtools, launch
Jupyter and open a new, blank notebook.
Once that's completed, let's write a basic function. The function below accepts a string and prints a brief message. By default, the message addresses the world. For good measure we will also add a docstring to document the function.
```python
def say_hello(to_whom='World'):
"""Say hello to the world or whomever."""
print('Hello ' + to_whom)
```
This is pretty basic Python and hopefully everything so far is familiar. Next, we will turn this function into an interactive widget with just an import statement and one line of code. Update your code to what is shown below and execute the cell.
```python
import nbtools
@nbtools.build_ui
def say_hello(to_whom='World'):
"""Say hello to the world or whomever."""
print('Hello ' + to_whom)
```
You should now see a widget containing a web form. This form will prompt for the value of the `to_whom` parameter. The docstring will also appear as a description near the top of the widget. Go ahead and change the `to_whom` value, then click the "Run" button. This will execute the function and print the results below. Meanwhile, the form will also collapse, making more room on your screen.
With the push of a button, you've run the `say_hello` function!
This is exciting, but it is far from the only feature of the nbtools package. You can edit markdown cells using a WYSIWYG editor, customize how your function displays, chain together multiple related functions, make widgets from existing third-party methods, create a library of interactive tools (just click the Tools button on the toolbar and you will see `say_hello` has already added itself) and more! Just see the documentation links below.
## Features
* [UI Builder](docs/uibuilder.md)
* [UI Output](docs/uioutput.md)
* [Tool Manager API](docs/toolmanager.md)
* [WYSWYG Editor](docs/wysiwyg.md)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共310个文件
svg:204个
py:27个
ipynb:26个
资源分类:Python库 所属语言:Python 资源全名:nbtools-20.10a0.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
Python库 | nbtools-20.10a0.tar.gz (310个子文件)
make.bat 779B
setup.cfg 95B
all_aml_test.cls 87B
pytest.ini 124B
Untitled1-checkpoint.ipynb 2.59MB
Introduction to Text and Document Formatting-checkpoint.ipynb 430KB
Introduction to Text and Document Formatting.ipynb 430KB
AuthWidget-checkpoint.ipynb 278KB
Widget Examples.ipynb 197KB
Galaxy Example.ipynb 194KB
Galaxy Example-checkpoint.ipynb 170KB
AuthWidget.ipynb 145KB
Untitled.ipynb 88KB
GenePattern Notebook.ipynb 85KB
Widget Examples-checkpoint.ipynb 60KB
Load Settings-checkpoint.ipynb 52KB
Load Settings.ipynb 52KB
Untitled2.ipynb 46KB
Untitled1.ipynb 45KB
GenePattern Notebook-checkpoint.ipynb 35KB
UI Builder Tutorial-checkpoint.ipynb 34KB
UI Builder Tutorial.ipynb 34KB
Scikit-learn Multi-class Tumor Classification using SVM.ipynb 9KB
Scikit-learn Multi-class Tumor Classification using SVM-checkpoint.ipynb 8KB
UI Builder.ipynb 3KB
UI Builder-checkpoint.ipynb 3KB
SVM Analysis.ipynb 2KB
Untitled-checkpoint.ipynb 72B
SVM Analysis-checkpoint.ipynb 72B
Untitled2-checkpoint.ipynb 72B
index.js 2.34MB
embed-bundle.js 2.34MB
1.embed-bundle.js 425KB
1.index.js 425KB
2.embed-bundle.js 3KB
2.index.js 3KB
webpack.config.js 2KB
karma.conf.js 962B
helper.js 120B
package.json 3KB
tsconfig.json 472B
tsconfig.json 411B
overrides.json 79B
nbtools.json 61B
Makefile 609B
embed-bundle.js.map 5.74MB
index.js.map 5.72MB
1.embed-bundle.js.map 1.32MB
1.index.js.map 1.32MB
2.index.js.map 6KB
2.embed-bundle.js.map 5KB
uibuilder.md 12KB
README.md 5KB
toolmanager.md 3KB
wysiwyg.md 1KB
uioutput.md 865B
introduction.nblink 53B
PKG-INFO 918B
setupbase.py 22KB
form.py 18KB
uibuilder.py 9KB
jobwidget.py 9KB
taskwidget.py 7KB
authwidget.py 6KB
conf.py 6KB
tool_manager.py 6KB
shim.py 4KB
setup.py 3KB
parsing_manager.py 3KB
sessions.py 3KB
basewidget.py 2KB
conftest.py 1KB
uioutput.py 1KB
event_manager.py 1KB
utils.py 818B
settings.py 803B
display.py 726B
test_nbextension_path.py 508B
__init__.py 489B
__init__.py 366B
__init__.py 355B
test_example.py 327B
_frontend.py 305B
_version.py 257B
__init__.py 0B
installing.rst 1012B
develop-install.rst 844B
index.rst 729B
index.rst 385B
introduction.rst 109B
06de3f6f47040a96e1b75f57ff2be41f.svg 4KB
06de3f6f47040a96e1b75f57ff2be41f.svg 4KB
9b27c8ccf88e38264c5911168c3f7a67.svg 3KB
9b27c8ccf88e38264c5911168c3f7a67.svg 3KB
ff62e89fb77dd8b83487167dc7c1e492.svg 3KB
ff62e89fb77dd8b83487167dc7c1e492.svg 3KB
4599b3e5fdd4b9105f79eb4a00f47c31.svg 3KB
4599b3e5fdd4b9105f79eb4a00f47c31.svg 3KB
ddeee9fc9c9c9f7de8aa792d323df147.svg 2KB
7e458ac5b31b3a94a909999c9d70747b.svg 2KB
共 310 条
- 1
- 2
- 3
- 4
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功