nbtools


Namenbtools JSON
Version 24.8.0 PyPI version JSON
download
home_pageNone
SummaryFramework for creating user-friendly Jupyter notebooks, accessible to both programming and non-programming users alike.
upload_time2024-08-06 15:53:49
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseBSD 3-Clause License Copyright (c) 2021, Regents of the University of California & Broad Institute All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords jupyter jupyterlab jupyterlab3
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # nbtools for JupyterLab

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/g2nb/nbtools/lab?urlpath=lab)
[![Build Status](https://travis-ci.org/g2nb/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/lab/)
[![Join the chat at https://gitter.im/g2nb](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)
<!--- ![Github Actions Status](https://github.com/g2nb/nbtools/workflows/Build/badge.svg) -->

**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 [g2nb project](https://g2nb.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.

### **Looking for classic Jupyter Notebook support?**
**Jupyter Notebook support is available, albeit not in active development. You can find it in its own branch. [Just click here!](https://github.com/g2nb/nbtools/tree/notebook)**


## Requirements

* JupyterLab >= 3.0
* ipywidgets >= 7.5.0

## Docker

A Docker image with nbtools and the full JupyterLab stack is available through DockerHub.

```bash
docker pull g2nb/lab
docker run --rm -p 8888:8888 g2nb/lab
```

## Installation

At the moment you may install a prerelease version from pip or create a development install from GitHub:

```bash
pip install --pre nbtools
```

***OR***

```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/g2nb/nbtools.git
cd nbtools

# Install the nbtools JupyterLab prototype
pip install -e .
jupyter labextension develop . --overwrite
jupyter nbextension install --py nbtools --symlink --sys-prefix
jupyter nbextension enable --py nbtools --sys-prefix
```

If installing from GitHub, before nbtools will load in your JupyterLab environment, you'll also need to build its 
labextension (see Development below). 

## Development

To develop with nbtools, you will need to first install npm or yarn, as well as install nbtools' dependencies. One way 
to do this is through conda. An example is given below. Run these commands within the top-level directory of the repository.

```bash
conda install npm.  # Install npm
npm install         # Install package requirements
npm run build       # Build the package
jupyter lab build   # Build JupyterLab with the extension installed
```

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in 
the extension's source and automatically rebuild the extension. To develop, run each of the following commands in a 
separate terminal. 

```bash
jlpm run watch
jupyter lab
```

The `jlpm` command is JupyterLab's pinned version of [yarn](https://yarnpkg.com/) that is installed with JupyterLab. You 
may use `yarn` or `npm` in lieu of `jlpm`.

With the watch command running, every saved change will immediately be built locally and available in your running 
JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the 
extension to be rebuilt).

By default, the `jlpm run build` command generates the source maps for this extension to make it easier to debug using 
the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:

```bash
jupyter lab build --minimize=False
```

### Uninstall

```bash
pip uninstall nbtools
```

## 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)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nbtools",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "Jupyter, JupyterLab, JupyterLab3",
    "author": null,
    "author_email": "Thorin Tabor <tmtabor@cloud.ucsd.edu>",
    "download_url": "https://files.pythonhosted.org/packages/d1/ab/285c6c12ddb754e3a888686bdbfad30f15bfb90dd95cba738b305f9cf441/nbtools-24.8.0.tar.gz",
    "platform": null,
    "description": "# nbtools for JupyterLab\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/g2nb/nbtools/lab?urlpath=lab)\n[![Build Status](https://travis-ci.org/g2nb/nbtools.svg?branch=lab)](https://travis-ci.org/genepattern/nbtools)\n[![Documentation Status](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](https://gpnotebook-website-docs.readthedocs.io/en/latest/)\n[![Docker Pulls](https://img.shields.io/docker/pulls/genepattern/genepattern-notebook.svg)](https://hub.docker.com/r/genepattern/lab/)\n[![Join the chat at https://gitter.im/g2nb](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)\n<!--- ![Github Actions Status](https://github.com/g2nb/nbtools/workflows/Build/badge.svg) -->\n\n**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 [g2nb project](https://g2nb.org). The package provides:\n\n* A decorator which can transform any Python function into an interactive user interface.\n* A toolbox interface for encapsulating and adding new computational steps to a notebook.\n* Flexible theming and APIs to extend the nbtools functionality.\n\n### **Looking for classic Jupyter Notebook support?**\n**Jupyter Notebook support is available, albeit not in active development. You can find it in its own branch. [Just click here!](https://github.com/g2nb/nbtools/tree/notebook)**\n\n\n## Requirements\n\n* JupyterLab >= 3.0\n* ipywidgets >= 7.5.0\n\n## Docker\n\nA Docker image with nbtools and the full JupyterLab stack is available through DockerHub.\n\n```bash\ndocker pull g2nb/lab\ndocker run --rm -p 8888:8888 g2nb/lab\n```\n\n## Installation\n\nAt the moment you may install a prerelease version from pip or create a development install from GitHub:\n\n```bash\npip install --pre nbtools\n```\n\n***OR***\n\n```bash\n# Install ipywidgets, if you haven't already\njupyter nbextension enable --py widgetsnbextension\njupyter labextension install @jupyter-widgets/jupyterlab-manager\n\n# Clone the nbtools repository\ngit clone https://github.com/g2nb/nbtools.git\ncd nbtools\n\n# Install the nbtools JupyterLab prototype\npip install -e .\njupyter labextension develop . --overwrite\njupyter nbextension install --py nbtools --symlink --sys-prefix\njupyter nbextension enable --py nbtools --sys-prefix\n```\n\nIf installing from GitHub, before nbtools will load in your JupyterLab environment, you'll also need to build its \nlabextension (see Development below). \n\n## Development\n\nTo develop with nbtools, you will need to first install npm or yarn, as well as install nbtools' dependencies. One way \nto do this is through conda. An example is given below. Run these commands within the top-level directory of the repository.\n\n```bash\nconda install npm.  # Install npm\nnpm install         # Install package requirements\nnpm run build       # Build the package\njupyter lab build   # Build JupyterLab with the extension installed\n```\n\nYou can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in \nthe extension's source and automatically rebuild the extension. To develop, run each of the following commands in a \nseparate terminal. \n\n```bash\njlpm run watch\njupyter lab\n```\n\nThe `jlpm` command is JupyterLab's pinned version of [yarn](https://yarnpkg.com/) that is installed with JupyterLab. You \nmay use `yarn` or `npm` in lieu of `jlpm`.\n\nWith the watch command running, every saved change will immediately be built locally and available in your running \nJupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the \nextension to be rebuilt).\n\nBy default, the `jlpm run build` command generates the source maps for this extension to make it easier to debug using \nthe browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:\n\n```bash\njupyter lab build --minimize=False\n```\n\n### Uninstall\n\n```bash\npip uninstall nbtools\n```\n\n## Getting Started\n\nLet's start by writing a simple Hello World function and turning it into an interactive widget. Go ahead and install nbtools, launch\nJupyter and open a new, blank notebook.\n\nOnce 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.\n\n```python\ndef say_hello(to_whom='World'):\n    \"\"\"Say hello to the world or whomever.\"\"\"\n    print('Hello ' + to_whom)\n```\n\nThis 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.\n\n```python\nimport nbtools\n\n@nbtools.build_ui\ndef say_hello(to_whom='World'):\n    \"\"\"Say hello to the world or whomever.\"\"\"\n    print('Hello ' + to_whom)\n```\n\nYou 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.\n\nWith the push of a button, you've run the `say_hello` function!\n\nThis 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.\n\n## Features\n\n* [UI Builder](docs/uibuilder.md)\n* [UI Output](docs/uioutput.md)\n* [Tool Manager API](docs/toolmanager.md)\n* [WYSWYG Editor](docs/wysiwyg.md)\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2021, Regents of the University of California & Broad Institute All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
    "summary": "Framework for creating user-friendly Jupyter notebooks, accessible to both programming and non-programming users alike.",
    "version": "24.8.0",
    "project_urls": {
        "Homepage": "https://github.com/g2nb/nbtools"
    },
    "split_keywords": [
        "jupyter",
        " jupyterlab",
        " jupyterlab3"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d287b5f6dffff862623e66517972df40592607317cb8243762d95644d0a0bf04",
                "md5": "07e1f57f598deaa73cd668ab7024f543",
                "sha256": "e34a7244e3625df945ca0c847344742a980921b963af0f5ed6cfd7f1ebd66f43"
            },
            "downloads": -1,
            "filename": "nbtools-24.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "07e1f57f598deaa73cd668ab7024f543",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6873715,
            "upload_time": "2024-08-06T15:53:55",
            "upload_time_iso_8601": "2024-08-06T15:53:55.023095Z",
            "url": "https://files.pythonhosted.org/packages/d2/87/b5f6dffff862623e66517972df40592607317cb8243762d95644d0a0bf04/nbtools-24.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d1ab285c6c12ddb754e3a888686bdbfad30f15bfb90dd95cba738b305f9cf441",
                "md5": "23f815fecffaa3ce4db59a086f079f9e",
                "sha256": "5c1bf45efba057a2f67b767160d271e7a83694e962052d5fe607c9e53dde2a16"
            },
            "downloads": -1,
            "filename": "nbtools-24.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "23f815fecffaa3ce4db59a086f079f9e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 67595054,
            "upload_time": "2024-08-06T15:53:49",
            "upload_time_iso_8601": "2024-08-06T15:53:49.351745Z",
            "url": "https://files.pythonhosted.org/packages/d1/ab/285c6c12ddb754e3a888686bdbfad30f15bfb90dd95cba738b305f9cf441/nbtools-24.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-06 15:53:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "g2nb",
    "github_project": "nbtools",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "appveyor": true,
    "lcname": "nbtools"
}
        
Elapsed time: 0.71537s