Login Sign up

Tuesday Oct. 13, 2020, 4 p.m.–Oct. 13, 2020, 4:30 p.m. in Jupyter in Scientific Research

Why develop a snippet library for Jupyter in your subject domain?

Blaine Mooers

Audience level:

Brief Summary

Snippets are code templates that are one-to-many lines long. Snippets save time because they are faster to insert than to enter from scratch. Their availability in a library in Jupyter eases their use by beginners and experts. A snippet library can improve your productivity, but why should you share it? I explore these issues with the pymolsnips library that I developed for structural biology.


Objective: Support to the use of Jupyter Notebooks for reproducible research in structural biology by providing a library of snippets for the molecular graphics program PyMOL.

Outline: I will introduce the nature of snippet libraries and the available extensions in Jupyter Notebook and Jupyter Lab that support the use of snippets. I will illustrate the nature of snippets by using the pymolsnips library that I developed to support the writing of scripts in the PyMOL macro language (pml) for the molecular graphics program PyMOL. PyMOL is the most popular molecular graphics program for making images of protein structures. Stunning images made with PyMOL are frequently found on the covers of Nature, Science, Cell, and other leading journals in biochemistry and molecular biology.

I will compare and contrast snippets with other coding aids like code completions (e..g, Intellisense) and personal function libraries I will discuss how an individual can benefit from a snippet library. I have adapted pymolsnips to other coding environments (e.g., VSC, Sublime Text, Textmate, vim, emacs and 20 others), so I am well-positioned to comment on the current strengths and weaknesses of the support for snippets in Jupyter.

Then I will discuss why snippet libraries should be shared. The reasons for doing so fall under the categories of improving the impact of your field, enhancing the education of the next generation of scientists, and supporting literate programming for reproducible research. An additional reason for sharing a snippet library is given by one of the founders of the open source movement, Richard Stallman, who called the sharing of software the "fundamental act of friendship among programmers". The word programmers could be replaced with colleagues as Fernando PĂ©rez's actualizes his vision of most domain scientists in the near future using Jupyter to analyze data.

Central thesis: Snippet libraries can help motivate students and peers to adopt the use of Jupyter in their studies and research

Key take aways: Snippet libraries should be shared to (1) lower the learning curves for writing code for the popular programs in your domain, (2) enhance the computing literacy of your domain, (3) lower the resistance to the use of literate programming documents like Jupyter Notebooks for reproducible research, (4) build support in one's domain for the funding of software development, and (5) improve the job prospects of students by enhancing their data science skills.