Brought to you by NumFOCUS Foundation and O’Reilly Media
The official Jupyter Conference
Aug 21-22, 2018: Training
Aug 22-24, 2018: Tutorials & Conference
New York, NY

Ariadne: Static Analysis for ML in JupyterLab

The Ariadne team has provided support for Jupyter in two ways, both through Python machine learning support (Ariadne) and through the added ability for JupyterLab to access the Language Server Protocol (LSP).

Ariadne provides domain-specific analysis to assist practitioners of machine learning in Python as they edit their code. By using WALA open source static analysis to analyze control and data flow in code, Ariadne is able to provide an existing IDE with highly supportive machine learning development functionality, making use of LSP.

Features can be categorized into navigational aides, insights into basic python code, domain-specific insights like the dimensions of a tensor, and actionable diagnostic information.

A few examples of Machine Learning Features:

  • CodeLens and Hover: Tracking for tensor dims – removes need for ad-hoc comments which can become stale quickly, and provides updated information automatically
    Build Warning Reshape – Identification of reshapes with possibly incompatible dimensions, even when Python code may still work at runtime, quick-fix available if warning is correct
    QuickFix: Tensor Reshaping – in some cases when a reshape is discernibly incorrect, Ariadne can provide a 1-click-fix to remedy the tensor’s shape.

Extras that are nice for Python:

  • CodeLens: References – enables jump-to-definition, list or jump to references of that method
  • Goto Symbol – allows the editor to display a list of methods, provides the ability for the user to jump to the method definition
  • Hover Tip: Target Method of Call – popup hover tips with information about symbols

LSP is a open, platform-neutral protocol that enables support for a wide range of IDEs, including Visual Studio Code, and PyCharm. This enables IDEs to ask for needed information about code, enabling the platform to provide features which surface that information to the user.

Jupyter has an ongoing project to integrate Microsoft’s Monaco into JupyterLab. TypeFox has implemented LSP support for Monaco. The Ariadne team has combined these to provide LSP support in JupyterLab. This support, therefore, makes Ariadne tools available in JupyterLab and will hopefully enable other teams to provide support to JuypterLab as well.

Watson Libraries for Analysis (WALA) is a framework for program analysis. Ariadne utilizes WALA support for call graph construction, pointer analysis and dataflow analysis. Through LSP, Ariadne enables any number of IDEs. Due to _LSP_’s use of program locations, the ability to associate information by understanding where in the code the user is looking (i.e. hovering over).

This poster will focus on Illustrating features of Ariadne which focus on machine learning code as it pertains to development within JupyterLab specifically, complete with specific screen shots and live working-code demos will be available when people are interested.