trappy.plotter.IPythonConf module

IPythonConf provides abstraction for the varying configurations in different versions of ipython/jupyter packages.

trappy.plotter.IPythonConf.IPLOT_RESOURCES = {'ILinePlot': ['http://cdnjs.cloudflare.com/ajax/libs/dygraph/1.1.1/dygraph-combined.js', 'js/ILinePlot.js', 'http://dygraphs.com/extras/synchronizer.js', 'https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js'], 'EventPlot': ['https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js', 'http://labratrevenge.com/d3-tip/javascripts/d3.tip.v0.6.3.js', 'js/EventPlot.js', 'css/EventPlot_help.jpg']}

The location of the IPython webserver in IPython version 4.0+

trappy.plotter.IPythonConf.IPYTHON_V3_BASE = '/static'

The webserver base directory for IPython version < 4.0

trappy.plotter.IPythonConf.IPYTHON_V4_BASE = '/nbextensions'

The webserver base directory for IPython version 4.0+

trappy.plotter.IPythonConf.PLOTTER_SCRIPTS = 'plotter_scripts'

The installation directory of plotter JS files in the IPython webserver

trappy.plotter.IPythonConf.add_web_base(path)[source]

Add the base of the IPython dependency URLs

Parameters:path (str) – The path to be augmented with the webserver base
trappy.plotter.IPythonConf.check_ipython()[source]

A boolean function to check if IPython is available

trappy.plotter.IPythonConf.get_ipython()[source]

Return an IPython instance. Returns None if IPython is not installed

trappy.plotter.IPythonConf.get_ipython_dir(profile=None)[source]

Returns the base directory of the IPython server

Parameters:profile (str) – The name of the IPython profile
trappy.plotter.IPythonConf.get_profile_name()[source]

Get the name of the profile of the current IPython notebook. This is only relevant to V <= 4.0.0

trappy.plotter.IPythonConf.get_scripts_path(profile=None)[source]

Directory where plotter scripts are installed

Parameters:profile (str) – The name of the IPython profile
trappy.plotter.IPythonConf.install_http_resource(url, to_path)[source]

Install a HTTP Resource (eg. javascript) to a destination on the disk

Parameters:
  • url (str) – HTTP URL
  • to_path (str) – Destination path on the disk
trappy.plotter.IPythonConf.install_local_resource(from_path, to_path)[source]

Move a local resource to the desired a destination.

Parameters:
  • from_path (str) – Path relative to this file
  • to_path (str) – Destination path on the disk
trappy.plotter.IPythonConf.install_resource(from_path, to_path)[source]

Install a resource to a location on the disk

Parameters:
  • from_path (str) – URL or relative path
  • to_path (str) – Destination path on the disk
trappy.plotter.IPythonConf.iplot_install(module_name)[source]

Install the resources for the module to the Ipython profile directory

Parameters:module_name (str) – Name of the module
Returns:A list than can be consumed by requirejs or any relative resource dependency resolver