Marisol  Kuhic

Marisol Kuhic

1650240000

Ipywidgets: Interactive Widgets for The Jupyter Notebook

ipywidgets: Interactive HTML Widgets

PurposeBadges
Latest (master: future 8.0)Test Status Documentation Status: latest Binder:master
StableVersion Conda Version Documentation Status Binder:7.x
CommunicationJoin the chat at https://gitter.im/ipython/ipywidgets Discourse
  

ipywidgets, also known as jupyter-widgets or simply widgets, are interactive HTML widgets for Jupyter notebooks and the IPython kernel.

Notebooks come alive when interactive widgets are used. Users gain control of their data and can visualize changes in the data.

Learning becomes an immersive, fun experience. Researchers can easily see how changing inputs to a model impact the results. We hope you will add ipywidgets to your notebooks, and we're here to help you get started.

Core Interactive Widgets

The fundamental widgets provided by this library are called core interactive widgets. A demonstration notebook provides an overview of the core interactive widgets, including:

  • sliders
  • progress bars
  • text boxes
  • toggle buttons and checkboxes
  • display areas
  • and more

Jupyter Interactive Widgets as a Framework

Besides the widgets already provided with the library, the framework can be extended with the development of custom widget libraries. For detailed information, please refer to the ipywidgets documentation.

Cookiecutter template for custom widget development

A template project for building custom widgets is available as a cookiecutter. This cookiecutter project helps custom widget authors get started with the packaging and the distribution of their custom Jupyter interactive widgets. The cookiecutter produces a project for a Jupyter interactive widget library following the current best practices for using interactive widgets. An implementation for a placeholder "Hello World" widget is provided as an example.

Popular widget libraries such as bqplot, pythreejs and ipyleaflet follow exactly the same template and directory structure. They serve as more advanced examples of usage of the Jupyter widget infrastructure.

Popular custom widget examples

Examples of custom widget libraries built upon ipywidgets are

  • bqplot a 2d data visualization library enabling custom user interactions.
  • pythreejs a Jupyter - Three.js wrapper, bringing Three.js to the notebook.
  • ipyleaflet a leaflet widget for Jupyter.

Install

The stable version of ipywidgets can be installed with pip or conda.

With pip:

pip install ipywidgets

With conda:

conda install -c conda-forge ipywidgets

Developer install from source

Installing from source is more complicated and requires a developer install, see the detailed developer install instructions.

If you want to install ipywidgets from source, you will need the yarn package manager version 1.2.1 or later. To install the latest master version from the root directory of the source code, run dev-install.sh. To only build the Python package enter pip install -e ..

Usage

See the examples section of the documentation. The widgets are being used in a variety of ways; some uses can be seen in these notebooks: Demo notebook of interactive widgets

Change log

Change log

Version Compatibility with Front-End Clients

Refer to change log for more detail.

ipywidgetsJupyterLabClassic Notebooknbclassic
master -TBD
7.6.3  0.2.6
Legacy   
6.x  -
5.x 4.2-
4.1.x 4.1-
4.0.x 4.0-

Contributing to ipywidgets

Developer information

Project Jupyter resources


Author: jupyter-widgets
Source Code: https://github.com/jupyter-widgets/ipywidgets
License: BSD-3-Clause License

#python #jupyter 

What is GEEK

Buddha Community

Ipywidgets: Interactive Widgets for The Jupyter Notebook

Ipywidgets: Interactive Widgets for The Jupyter Notebook

ipywidgets: Interactive HTML Widgets

ipywidgets, also known as jupyter-widgets or simply widgets, are interactive HTML widgets for Jupyter notebooks and the IPython kernel.

Notebooks come alive when interactive widgets are used. Users gain control of their data and can visualize changes in the data.

Learning becomes an immersive, fun experience. Researchers can easily see how changing inputs to a model impact the results. We hope you will add ipywidgets to your notebooks, and we're here to help you get started.

Core Interactive Widgets

The fundamental widgets provided by this library are called core interactive widgets. A demonstration notebook provides an overview of the core interactive widgets, including:

  • sliders
  • progress bars
  • text boxes
  • toggle buttons and checkboxes
  • display areas
  • and more

Jupyter Interactive Widgets as a Framework

Besides the widgets already provided with the library, the framework can be extended with the development of custom widget libraries. For detailed information, please refer to the ipywidgets documentation.

Cookiecutter template for custom widget development

A template project for building custom widgets is available as a cookiecutter. This cookiecutter project helps custom widget authors get started with the packaging and the distribution of their custom Jupyter interactive widgets. The cookiecutter produces a project for a Jupyter interactive widget library following the current best practices for using interactive widgets. An implementation for a placeholder "Hello World" widget is provided as an example.

Popular widget libraries such as bqplot, pythreejs and ipyleaflet follow exactly the same template and directory structure. They serve as more advanced examples of usage of the Jupyter widget infrastructure.

Popular custom widget examples

Examples of custom widget libraries built upon ipywidgets are

  • bqplot a 2d data visualization library enabling custom user interactions.
  • pythreejs a Jupyter - Three.js wrapper, bringing Three.js to the notebook.
  • ipyleaflet a leaflet widget for Jupyter.

Install

The stable version of ipywidgets can be installed with pip or conda.

With pip:

pip install ipywidgets

With conda:

conda install -c conda-forge ipywidgets

Developer install from source

Installing from source is more complicated and requires a developer install, see the detailed developer install instructions.

If you want to install ipywidgets from source, you will need the yarn package manager version 1.2.1 or later. To install the latest master version from the root directory of the source code, run dev-install.sh. To only build the Python package enter pip install -e ..

Usage

See the examples section of the documentation. The widgets are being used in a variety of ways; some uses can be seen in these notebooks: Demo notebook of interactive widgets

Change log

Change log

Version Compatibility with Front-End Clients

Refer to change log for more detail.

ipywidgetsJupyterLabClassic Notebooknbclassic
master -TBD
7.6.3  0.2.6
Legacy   
6.x  -
5.x 4.2-
4.1.x 4.1-
4.0.x 4.0-

PurposeBadges
Latest (master: future 8.0)Test Status Documentation Status: latest Binder:master
StableVersion Conda Version Documentation Status Binder:7.x
CommunicationJoin the chat at https://gitter.im/ipython/ipywidgets Discourse
  

Contributing to ipywidgets

Developer information

Project Jupyter resources

Weekly Team Meetings

Developer Meetings take place on zoom, on Tuesdays at 9:30AM Pacific Time (your time).

Minutes are taken at Hackmd.io.

Download Details:

Author: jupyter-widgets
Source Code: https://github.com/jupyter-widgets/ipywidgets 
License: BSD-3-Clause license

#jupyter #widgets 

Rodrigo Senra - Jupyter Notebooks

Nosso convidado de hoje é diretor técnico na Work & Co, PhD em Ciências da Computação, já contribuiu com inúmeros projetos open source em Python, ajudou a fundar a Associação Python Brasil e já foi premiado com o Prêmio Dorneles Tremea por contribuições para a comunidade Python Brasil.

#alexandre oliva #anaconda #apache zeppelin #associação python brasil #azure notebooks #beakerx #binder #c++ #closure #colaboratory #donald knuth #fernando pérez #fortran #graphql #guido van rossum #ipython #java #javascript #json #jupyter kenels #jupyter notebooks #jupyterhub #jupyterlab #latex #lisp #literate programming #lua #matlab #perl #cinerdia #prêmio dorneles tremea #python #r #rodrigo senra #scala #spark notebook #tcl #typescript #zope

Notebook: Jupyter interactive Notebook

Jupyter Notebook

The Jupyter notebook is a web-based notebook environment for interactive computing.

Jupyter notebook example

Maintained versions

We maintain the two most recently released major versions of Jupyter Notebook, Notebook v5 and Classic Notebook v6. After Notebook v7.0 is released, we will no longer maintain Notebook v5. All Notebook v5 users are strongly advised to upgrade to Classic Notebook v6 as soon as possible.

The Jupyter Notebook project is currently undertaking a transition to a more modern code base built from the ground-up using JupyterLab components and extensions.

There is new stream of work which was submitted and then accepted as a Jupyter Enhancement Proposal (JEP) as part of the next version (v7): https://jupyter.org/enhancement-proposals/79-notebook-v7/notebook-v7.html

There is also a plan to continue maintaining Notebook v6 with bug and security fixes only, to ease the transition to Notebook v7: https://github.com/jupyter/notebook-team-compass/issues/5#issuecomment-1085254000

Notebook v7

The next major version of Notebook will be based on:

  • JupyterLab components for the frontend
  • Jupyter Server for the Python server

This represents a significant change to the jupyter/notebook code base.

To learn more about Notebook v7: https://jupyter.org/enhancement-proposals/79-notebook-v7/notebook-v7.html

Classic Notebook v6

Maintainance and security-related issues are now being addressed in the 6.4.x branch.

A 6.5.x branch will be soon created and will depend on nbclassic for the HTML/JavaScript/CSS assets.

New features and continuous improvement is now focused on Notebook v7 (see section above).

If you have an open pull request with a new feature or if you were planning to open one, we encourage switching over to the Jupyter Server and JupyterLab architecture, and distribute it as a server extension and / or JupyterLab prebuilt extension. That way your new feature will also be compatible with the new Notebook v7.

Jupyter notebook, the language-agnostic evolution of IPython notebook

Jupyter notebook is a language-agnostic HTML notebook application for Project Jupyter. In 2015, Jupyter notebook was released as a part of The Big Split™ of the IPython codebase. IPython 3 was the last major monolithic release containing both language-agnostic code, such as the IPython notebook, and language specific code, such as the IPython kernel for Python. As computing spans across many languages, Project Jupyter will continue to develop the language-agnostic Jupyter notebook in this repo and with the help of the community develop language specific kernels which are found in their own discrete repos.

Installation

You can find the installation documentation for the Jupyter platform, on ReadTheDocs. The documentation for advanced usage of Jupyter notebook can be found here.

For a local installation, make sure you have pip installed and run:

pip install notebook

Usage - Running Jupyter notebook

Running in a local installation

Launch with:

jupyter notebook

Running in a remote installation

You need some configuration before starting Jupyter notebook remotely. See Running a notebook server.

Development Installation

See CONTRIBUTING.md for how to set up a local development installation.

Contributing

If you are interested in contributing to the project, see CONTRIBUTING.md.

Community Guidelines and Code of Conduct

This repository is a Jupyter project and follows the Jupyter Community Guides and Code of Conduct.

Resources

Download Details:

Author: Jupyter
Source Code: https://github.com/jupyter/notebook 
License: View license

#jupyter #notebook 

Marisol  Kuhic

Marisol Kuhic

1650240000

Ipywidgets: Interactive Widgets for The Jupyter Notebook

ipywidgets: Interactive HTML Widgets

PurposeBadges
Latest (master: future 8.0)Test Status Documentation Status: latest Binder:master
StableVersion Conda Version Documentation Status Binder:7.x
CommunicationJoin the chat at https://gitter.im/ipython/ipywidgets Discourse
  

ipywidgets, also known as jupyter-widgets or simply widgets, are interactive HTML widgets for Jupyter notebooks and the IPython kernel.

Notebooks come alive when interactive widgets are used. Users gain control of their data and can visualize changes in the data.

Learning becomes an immersive, fun experience. Researchers can easily see how changing inputs to a model impact the results. We hope you will add ipywidgets to your notebooks, and we're here to help you get started.

Core Interactive Widgets

The fundamental widgets provided by this library are called core interactive widgets. A demonstration notebook provides an overview of the core interactive widgets, including:

  • sliders
  • progress bars
  • text boxes
  • toggle buttons and checkboxes
  • display areas
  • and more

Jupyter Interactive Widgets as a Framework

Besides the widgets already provided with the library, the framework can be extended with the development of custom widget libraries. For detailed information, please refer to the ipywidgets documentation.

Cookiecutter template for custom widget development

A template project for building custom widgets is available as a cookiecutter. This cookiecutter project helps custom widget authors get started with the packaging and the distribution of their custom Jupyter interactive widgets. The cookiecutter produces a project for a Jupyter interactive widget library following the current best practices for using interactive widgets. An implementation for a placeholder "Hello World" widget is provided as an example.

Popular widget libraries such as bqplot, pythreejs and ipyleaflet follow exactly the same template and directory structure. They serve as more advanced examples of usage of the Jupyter widget infrastructure.

Popular custom widget examples

Examples of custom widget libraries built upon ipywidgets are

  • bqplot a 2d data visualization library enabling custom user interactions.
  • pythreejs a Jupyter - Three.js wrapper, bringing Three.js to the notebook.
  • ipyleaflet a leaflet widget for Jupyter.

Install

The stable version of ipywidgets can be installed with pip or conda.

With pip:

pip install ipywidgets

With conda:

conda install -c conda-forge ipywidgets

Developer install from source

Installing from source is more complicated and requires a developer install, see the detailed developer install instructions.

If you want to install ipywidgets from source, you will need the yarn package manager version 1.2.1 or later. To install the latest master version from the root directory of the source code, run dev-install.sh. To only build the Python package enter pip install -e ..

Usage

See the examples section of the documentation. The widgets are being used in a variety of ways; some uses can be seen in these notebooks: Demo notebook of interactive widgets

Change log

Change log

Version Compatibility with Front-End Clients

Refer to change log for more detail.

ipywidgetsJupyterLabClassic Notebooknbclassic
master -TBD
7.6.3  0.2.6
Legacy   
6.x  -
5.x 4.2-
4.1.x 4.1-
4.0.x 4.0-

Contributing to ipywidgets

Developer information

Project Jupyter resources


Author: jupyter-widgets
Source Code: https://github.com/jupyter-widgets/ipywidgets
License: BSD-3-Clause License

#python #jupyter 

Jupyter Widget to interactively View Molecular Structures, Trajectory

An IPython/Jupyter widget to interactively view molecular structures and trajectories. Utilizes the embeddable NGL Viewer for rendering. Support for showing data from the file-system, RCSB PDB, simpletraj and from objects of analysis libraries mdtraj, pytraj, mdanalysis, ParmEd, rdkit, ase, HTMD, biopython, cctbx, pyrosetta, schrodinger's Structure

Should work with Python 3. If you experience problems, please file an issue.

Ask question about usage? Please post here

membrane

Installation

Released version

Available on conda-forge channel

conda install nglview -c conda-forge
# might need: jupyter-nbextension enable nglview --py --sys-prefix

# if you already installed nglview, you can `upgrade`
conda upgrade nglview --force
# might need: jupyter-nbextension enable nglview --py --sys-prefix

Available on PyPI

   pip install nglview
   # might need: jupyter-nbextension enable nglview --py --sys-prefix

Jupyterlab: nglview works best with jupyterlab >= 3.0 and no further steps needed.

Notes

If you are using notebook v5.0, you need to increase the iopub_data_rate_limit to visualize big structure (e.g: solvated system)

jupyter notebook --NotebookApp.iopub_data_rate_limit=10000000

Development version

Requirement: ipywidgets >= 7.0,<8, notebook >= 4.2

The development version can be installed directly from github:

notebook user

    git clone https://github.com/arose/nglview
    cd nglview
    python setup.py install

    # if you edit files in ./js folder, make sure to rebuild the code
    cd js
    npm install

    # probably need to activate widgetsnbextension
    # python -m ipykernel install --sys-prefix
    # jupyter nbextension enable --py --sys-prefix widgetsnbextension
    # jupyter nbextension enable --py --sys-prefix nglview

    # tested with ipywidgets 5.2.2, notebook 4.2.1

Example

Showcase from users

Usage

Open a notebook

jupyter notebook

and issue

import nglview
view = nglview.show_pdbid("3pqr")  # load "3pqr" from RCSB PDB and display viewer widget
view

A number of convenience functions are available to quickly display data from the file-system, RCSB PDB, simpletraj and from objects of analysis libraries mdtraj, pytraj, mdanalysis, ParmEd, rdkit, HTMD, biopython.

FunctionDescription
show_file(path)Shows any NGL supported file formats (pdb, gro, mol2, sdf, dx, ..) in path
show_pdbid(pdbid)Shows pdbid fetched from RCSB PDB
show_simpletraj(struc_path, traj_path)Shows structure & trajectory loaded with simpletraj
show_mdtraj(traj)Shows MDTraj trajectory traj
show_pytraj(traj)Shows PyTraj trajectory traj
show_parmed(structure)Shows ParmEd structure
show_mdanalysis(univ)Shows MDAnalysis Universe or AtomGroup univ
show_rdkit(mol)Shows rdkit rdkit.Chem.rdchem.Mol
show_ase(atoms)Shows ase Atoms
show_asetraj(traj)Shows ase trajectory traj
show_pymatgen(struct)Shows pymatgen Structure
show_htmd(mol)Shows HTMD Molecules
show_biopython(mol)Shows Biopython structural entities
show_iotbx(mol)Shows cctbx's iotbx structure
show_rosetta(pose)Shows pyrosetta's Pose
show_iodata(obj)Shows iodata's IOData
show_psi4(obj)Shows psi4's Molecule
show_qcelementalShows QCelementary's Molecule
show_openbabelShows openbabel's OMol
show_prodyShows prody's Ensemble or AtomGroup

API

Representations

view.add_representation('cartoon', selection='protein')

# or shorter
view.add_cartoon(selection="protein")
view.add_surface(selection="protein", opacity=0.3)

# specify color
view.add_cartoon(selection="protein", color='blue')

# specify residue
view.add_licorice('ALA, GLU')

# clear representations
view.clear_representations()

# update parameters for ALL cartoons of component 0 (default)
view.update_cartoon(opacity=0.4, component=0)

# remove ALL cartoons of component 0 (default)
view.remove_cartoon(opacity=0.4, component=0)

# Not using default representation
view = nv.show_file('your.pdb', default=False)
view.center()
view.add_rope()

Representations can also be changed by overwriting the representations property of the widget instance view. The available type and params are described in the NGL Viewer documentation.

view.representations = [
    {"type": "cartoon", "params": {
        "sele": "protein", "color": "residueindex"
    }},
    {"type": "ball+stick", "params": {
        "sele": "hetero"
    }}
]

The widget constructor also accepts a representation argument:

initial_repr = [
    {"type": "cartoon", "params": {
        "sele": "protein", "color": "sstruc"
    }}
]

view = nglview.NGLWidget(struc, representation=initial_repr)
view

Properties

# set the frame number
view.frame = 100
# parameters for the NGL stage object
view.stage.set_parameters(**{
    # "percentages, "dist" is distance too camera in Angstrom
    "clipNear": 0, "clipFar": 100, "clipDist": 10,
    # percentages, start of fog and where on full effect
    "fogNear": 0, "fogFar": 100,
    # background color
    "backgroundColor": "black",
})

# note: NGLView accepts both origin camel NGL keywords (e.g. "clipNear")
# and snake keywords (e.g "clip_near")
# parameters to control the `delay` between snapshots
# change `step` to play forward (positive value) or backward (negative value)
# note: experimental code
view.player.parameters = dict(delay=0.04, step=-1)
# update camera type
view.camera = 'orthographic'
# change background color
view.background = 'black'

Trajectory

# adding new trajectory
view.add_trajectory(traj)
# traj could be a `pytraj.Trajectory`, `mdtraj.Trajectory`, `MDAnalysis.Universe`,
# `parmed.Structure`, `htmd.Molecule` or derived class of `nglview.Trajectory`

# change representation
view[0].add_cartoon(...) # equal to view.add_cartoon(component=0)
view[1].add_licorice(...) # equal to view.add_licorice(component=1)

Add extra component

# Density volumes (MRC/MAP/CCP4, DX/DXBIN, CUBE)
# Or adding derived class of `nglview.Structure`
view.add_component('my.ccp4')

# add component from url
view.add_component('rcsb://1tsu.pdb')
# NOTE: Trajectory is a special case of component.

Mouse

# coot mouse style (https://en.wikipedia.org/wiki/Coot_(software))
view.stage.set_parameters(mouse_preset='coot')

Interaction controls

Movie making

Require: moviepy (pip install moviepy)

from nglview.contrib.movie import MovieMaker
movie = MovieMaker(view, output='my.gif', in_memory=True)
movie.make()

Embed widget

embed

API doc

Command line


# open a notebook and import nglview
nglview

# Require installing pytraj (PR for other backends is welcome)
# open notebook, load `my.pdb` to pytraj's trajectory then display `view`
nglview my.pdb

# load density data
nglview my.ccp4

# open notebook, create trajectory with given topology `my.parm7` and trajecotry file `traj.nc`,
# then display `view`
nglview my.parm7 -c traj.nc

# load all trajectories with filename ending with 'nc'
# make sure to use quote " "
nglview my.parm7 -c "*.nc"

# open notebook, copy content from `myscript.py`
nglview myscript.py

# create a remote notebook
# just follow its instruction
nglview my.pdb --remote
nglview my.parm7 -c traj.nc --remote
nglview mynotebook.ipynb --remote

# demo (don't need pytraj)
nglview demo

# specify web browser
nglview my.pdb --browser=google-chrome

FAQ

Q&A

Website

Talks

Talks about NGL and nglview

Contributing

Join us here

Projects integrating NGLView

(Feel free to make a PR to add/remove your project here. Thanks.)

  • AMBER - A package of programs for molecular dynamics simulations of proteins and nucleic acids
  • mbuild - A hierarchical, component based molecule builder
  • deepchem - Deep-learning models for Drug Discovery and Quantum Chemistry
  • htmd - High throughput molecular dynamics simulations
  • Moleidoscope - Molecular kaleidoscope
  • ssbio - Tools for enabling structural systems biology
  • hublib - hublib is a Python library for the HUBzero science gateway platform.
  • molPX: ipython API to visualize MD-trajectories along projected trajectories
  • nanoribbon
  • ase: Atomic Simulation Environment
  • pida: Software for analyzing multiple protein-protein interaction docking solutions,
  • pytim
  • MobleyLab/drug-computing Educational materials for, and related to, UC Irvine's Drug Discovery Computing Techniques course.
  • pyiron: an integrated development environment for implementing, testing, and running simulations in computational materials science.
  • BioSimSpace: An interoperable framework for biomolecular simulation
  • pyrod: PyRod - Tracing water molecules in molecular dynamics simulations
  • kugupu: kugupu - a molecular network generator to study charge transport pathways in amorphous materials
  • pnab: proto-Nucleic Acid Builder
  • opencadd: A Python library for structural cheminformatics
  • teachopencadd: TeachOpenCADD: a teaching platform for computer-aided drug design (CADD) using open source packages and data
  • query.libretexts.org: query.libretexts.org
  • datamol: A python library to work with molecules.
  • dynophores: Dynamic pharmacophore modeling of molecular interactions
  • pychemcurv: Discrete and local curvature applied to chemistry and chemical reactivity
  • AutoSolvate: Automated workflow for generating quantum chemistry calculation of explicitly solvated molecules
  • plipify: PLIPify: Protein-Ligand Interaction Frequencies across Multiple Structures
  • Melodia: Differential Geometry of Proteins Backbones
  • pyrosetta_viewer3d: Display PackedPose objects, Pose objects, or PDB files within a Jupyter notebook and Google Colab
  • py4vasp: Python interface for VASP
  • eminus: A plane wave density functional theory code.
  • MolSysMT: Molecular Systems Multi-Tool

Acknowledgment

Cite

If you would like to acknowledge our work, feel free to cite:

Hai Nguyen, David A Case, Alexander S Rose; NGLview - Interactive molecular graphics for Jupyter notebooks, Bioinformatics, , btx789, https://doi.org/10.1093/bioinformatics/btx789

Try nglview online: Binder

Download Details:

Author: nglviewer
Source Code: https://github.com/nglviewer/nglview 
License: View license

#python #jupyter #widget