<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Jupyter Blog - documentation</title><link href="https://jasongrout.github.io/medium-archive/pelican/" rel="alternate"/><link href="https://jasongrout.github.io/medium-archive/pelican/feeds/tag-documentation.atom.xml" rel="self"/><id>https://jasongrout.github.io/medium-archive/pelican/</id><updated>2024-01-31T20:29:00+00:00</updated><subtitle>The Project Jupyter blog: news, releases, and community stories, archived from blog.jupyter.org.</subtitle><entry><title>The Jupytext Menu is back!</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2024/the-jupytext-menu-is-back/" rel="alternate"/><published>2024-01-31T20:29:00+00:00</published><updated>2024-01-31T20:29:00+00:00</updated><author><name>Marc Wouts</name></author><id>tag:jasongrout.github.io,2024-01-31:/medium-archive/pelican/posts/2024/the-jupytext-menu-is-back/</id><summary type="html">&lt;p&gt;A few weeks back, jupytext==1.16.0 went out. That release included multiple amazing contributions by Mahendra Paipuri, this post will go…&lt;/p&gt;
</summary><content type="html">&lt;p&gt;A few weeks back, &lt;code&gt;jupytext==1.16.0&lt;/code&gt; went out. That release included multiple amazing contributions by &lt;a href="https://github.com/mahendrapaipuri"&gt;Mahendra Paipuri&lt;/a&gt;, this post will go over the new features, and thank Mahendra for his great work.&lt;/p&gt;
&lt;p&gt;As we will see below, Mahendra restored the Jupytext Menu, made the extension fully compatible with JupyterLab 4 and Jupyter Notebook 7, and added the option to create Text Notebooks directly from the launcher.&lt;/p&gt;
&lt;h2 id="what-is-jupytext"&gt;What is Jupytext&lt;/h2&gt;
&lt;p&gt;Jupytext is a Python package that lets you save Jupyter Notebooks as text notebooks. Multiple formats are supported, and the notebooks can be saved either as &lt;a href="https://jupytext.readthedocs.io/en/latest/formats-markdown.html"&gt;Markdown documents&lt;/a&gt; with a &lt;code&gt;.md&lt;/code&gt; extension, or as &lt;a href="https://jupytext.readthedocs.io/en/latest/formats-scripts.html"&gt;scripts&lt;/a&gt; with e.g. a &lt;code&gt;.py&lt;/code&gt; extension (assuming you use Python - otherwise multiple &lt;a href="https://jupytext.readthedocs.io/en/latest/languages.html"&gt;languages&lt;/a&gt; are supported).&lt;/p&gt;
&lt;p&gt;A &lt;code&gt;.py&lt;/code&gt; notebook in the percent format looks like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;# %% [markdown]&lt;/span&gt;
&lt;span class="c1"&gt;# This is a markdown cell&lt;/span&gt;

&lt;span class="c1"&gt;# %%&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;f&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="c1"&gt;# %%&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To open a text notebook as a notebook in Jupyter, right-click on the document and select “Notebook” (you can also change the default viewer to “Jupytext Notebook” if you wish: see below the section about the settings)&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="Right click to open a text notebook with the Notebook editor" src="https://jasongrout.github.io/medium-archive/pelican/posts/2024/the-jupytext-menu-is-back/images/001-1_OekPCzL8Obv0NYracG_-uA.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Right click to open a text notebook with the Notebook editor&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Text notebooks are conveniently edited and executed in Jupyter as notebooks:&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="A Text Notebook in JupyterLab" src="https://jasongrout.github.io/medium-archive/pelican/posts/2024/the-jupytext-menu-is-back/images/002-1_J6-ToiGplGQFE0eQTWo0iw.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;A Text Notebook in JupyterLab&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;You can also edit them with your favorite text editor. You will get the changes back in Jupyter by re-opening or by &lt;em&gt;reloading&lt;/em&gt; the document: click e.g. on &lt;em&gt;reload Python file from disk&lt;/em&gt; in the &lt;em&gt;File&lt;/em&gt; menu.&lt;/p&gt;
&lt;p&gt;Text notebooks only contain the notebook inputs. For that reason they use much less disk space than &lt;code&gt;.ipynb&lt;/code&gt; notebooks. They are also better suited for version control as they only contain the content that was actually typed by the user. But even more useful are &lt;em&gt;paired&lt;/em&gt; notebooks: text notebooks paired with an &lt;code&gt;.ipynb&lt;/code&gt; notebook where the notebook outputs are preserved. When a paired notebook is saved, Jupytext writes the notebook to both files. When the notebook is read or reloaded in Jupyter, the notebook inputs are loaded from the most recent file, meaning that any edits on the text notebook will be reflected in Jupyter (and propagated to the &lt;code&gt;.ipynb&lt;/code&gt; file the next time it is saved).&lt;/p&gt;
&lt;h2 id="the-jupytext-menu-is-back"&gt;The Jupytext Menu is back!&lt;/h2&gt;
&lt;p&gt;One of the most frequent operation when using Jupytext is to &lt;em&gt;pair&lt;/em&gt; an &lt;code&gt;.ipynb&lt;/code&gt; notebook with a text notebook in the format of your choice.&lt;/p&gt;
&lt;p&gt;In earlier versions of Jupytext, pairing a notebook had to be done through the command palette.&lt;/p&gt;
&lt;p&gt;In Jupytext v1.16, thanks to Mahendra’s work on the front-end extension, you can directly use the Jupytext Menu for this. And the menu is available for both JupyterLab 4 and Jupyter Notebook 7!&lt;/p&gt;
&lt;p&gt;If you are new to Jupytext, we recommend that you pair your &lt;code&gt;.ipynb&lt;/code&gt; notebooks with either a &lt;em&gt;percent script&lt;/em&gt; or with a MyST Markdown file. The former format works well if you want to save and edit your notebook as a script, while the latter is well suited for writing documentation.&lt;/p&gt;
&lt;p&gt;Once you have paired the notebook with a Jupytext format, save your notebook, and the paired files will be created or updated.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="The Jupytext Menu" src="https://jasongrout.github.io/medium-archive/pelican/posts/2024/the-jupytext-menu-is-back/images/003-1_luqGwTI9TbORaPjfsquNIQ.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The Jupytext Menu&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id="creating-new-text-notebooks"&gt;Creating new text notebooks&lt;/h2&gt;
&lt;p&gt;For some notebooks you might decide that you don’t need to save the outputs at all. In that case you can work with an (unpaired) text notebook.&lt;/p&gt;
&lt;p&gt;To create a text notebook you can use the &lt;em&gt;New Text Notebook&lt;/em&gt; sub-menu under &lt;em&gt;File&lt;/em&gt;:&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="Create Text Notebooks directly from the menu" src="https://jasongrout.github.io/medium-archive/pelican/posts/2024/the-jupytext-menu-is-back/images/004-1_YLrRNo1MKSPrUSo1wwjsBQ.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Create Text Notebooks directly from the menu&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;If, later on, you decide that you want to preserve the notebook outputs in a &lt;em&gt;paired&lt;/em&gt; &lt;code&gt;.ipynb&lt;/code&gt; notebooks, you will just have to &lt;em&gt;pair&lt;/em&gt; the document to an &lt;code&gt;.ipynb&lt;/code&gt; notebook using the Jupytext Menu documented at the previous paragraph.&lt;/p&gt;
&lt;h2 id="text-notebooks-in-the-launcher"&gt;Text Notebooks in the launcher&lt;/h2&gt;
&lt;p&gt;In Jupytext v1.16, thanks to Mahendra’s work on the front end, text notebooks are also available in a Jupytext section in the Jupyter launcher:&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="Text Notebooks are also available in the launcher" src="https://jasongrout.github.io/medium-archive/pelican/posts/2024/the-jupytext-menu-is-back/images/005-1_P_0hx6p-nfwkDpqHGJmewg.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Text Notebooks are also available in the launcher&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id="jupytext-settings-in-jupyterlab"&gt;Jupytext Settings in JupyterLab&lt;/h2&gt;
&lt;p&gt;Since there are many possible formats for text notebooks, we have decided to expose only the most common ones, by default, in the launcher and in the &lt;em&gt;New Text Notebook&lt;/em&gt; menu.&lt;/p&gt;
&lt;p&gt;You can include more formats in the menu and in the launcher by changing the Jupytext settings in the &lt;em&gt;Settings Editor&lt;/em&gt; (in the &lt;em&gt;Settings&lt;/em&gt; menu):&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="The Jupytext Menu/Launcher settings" src="https://jasongrout.github.io/medium-archive/pelican/posts/2024/the-jupytext-menu-is-back/images/006-1_n31jAKcy96wrrTYR3qCuXA.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The Jupytext Menu/Launcher settings&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;You might also want to open certain text documents as notebooks with a single click. You can achieve this by setting the default viewer for those documents to “Jupytext Notebook”. For instance, if you want to open &lt;code&gt;.py&lt;/code&gt; and &lt;code&gt;.md&lt;/code&gt; files as notebooks with a single click, you can configure the default viewers like this:&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="Changing the default viewers to open Text Notebooks with a single click" src="https://jasongrout.github.io/medium-archive/pelican/posts/2024/the-jupytext-menu-is-back/images/007-1_1oj4Jrdz8hOhG90rYZckEA.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;Changing the default viewers to open Text Notebooks with a single click&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Alternatively, you can also list and set the default viewers with the &lt;code&gt;jupytext-config&lt;/code&gt; utility (which was developed recently by Thierry Parmentelat), using e.g.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;jupytext-config&lt;span class="w"&gt; &lt;/span&gt;set-default-viewer&lt;span class="w"&gt; &lt;/span&gt;python&lt;span class="w"&gt; &lt;/span&gt;markdown
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;to set “Jupytext Notebook” as the default viewer for both Python and Markdown files.&lt;/p&gt;
&lt;h2 id="pairing-notebooks-globally"&gt;Pairing notebooks globally&lt;/h2&gt;
&lt;p&gt;The pairing commands provided through the Jupytext Menu and commands act on individual notebooks, by settings a &lt;code&gt;jupytext.formats&lt;/code&gt; metadata in the notebook.&lt;/p&gt;
&lt;p&gt;It is also possible to pair all the notebooks within a certain folder using a &lt;code&gt;jupytext.toml&lt;/code&gt; configuration file - see &lt;a href="https://jupytext.readthedocs.io/en/latest/config.html"&gt;Jupytext’s documentation&lt;/a&gt;. Please note that:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The local metadata in the notebook takes precedence over the global configuration, and&lt;/li&gt;
&lt;li&gt;Jupyter is aware of the global &lt;code&gt;jupytext.toml&lt;/code&gt; file and will pair the notebooks accordingly, however the Jupytext Menu is not aware of the global configuration, so the paired formats selected through the global configuration will not be checked in the menu.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="installing-jupytext-v116"&gt;Installing Jupytext v1.16&lt;/h2&gt;
&lt;p&gt;The front end extension for JupyterLab shipped with Jupytext v1.16 requires JupyterLab 4, and/or Jupyter Notebook 7. Please upgrade Jupyter accordingly. Then, install Jupytext with&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;pip&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;jupytext&amp;gt;=1.16.0&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;conda&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;jupytext&amp;gt;=1.16.0&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-c&lt;span class="w"&gt; &lt;/span&gt;conda-forge
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and restart your Jupyter server with e.g. &lt;code&gt;jupyter lab&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="acknowledgments"&gt;Acknowledgments&lt;/h2&gt;
&lt;p&gt;I would like to thank &lt;a href="https://github.com/mahendrapaipuri"&gt;Mahendra Paipuri&lt;/a&gt; for his impressive work. I am pretty sure that the Jupytext Menu, and the option to create new text notebooks, will be much appreciated by Jupytext users!&lt;/p&gt;
&lt;p&gt;While users will mostly notice Mahendra’s work on the front end extension, it was actually not his only contribution to this release! Mahendra also thoroughly revisited the packaging of Jupytext, and helped us transition the project to the &lt;code&gt;src&lt;/code&gt; layout, and our old &lt;code&gt;setup.py&lt;/code&gt; to an up-to-date &lt;code&gt;pyproject.toml&lt;/code&gt; configuration that uses &lt;code&gt;hatch&lt;/code&gt; to build Jupytext.&lt;/p&gt;
&lt;p&gt;I also want to thank &lt;a href="https://github.com/LecrisUT"&gt;Cristian Le&lt;/a&gt; for his precious advice regarding the layout refactoring, and for helping us to tackle the CI reorganization. &lt;a href="https://github.com/parmentelat"&gt;Thierry Parmentelat&lt;/a&gt;, who had previously ported the front-end extension to JupyterLab 4, contributed much testing and feedback on this new version of the front-end extension.&lt;/p&gt;
&lt;p&gt;It is always a pleasure for me to maintain Jupytext, an amazing adventure that started five years ago already. However, I can get busy at times (Jupytext comes in addition to my day job, one cat, two bikes, three kids), so I am really thankful for receiving such contributions, especially when they are of such a great quality!&lt;/p&gt;
</content><category term="documentation"/></entry><entry><title>Introducing JupyterHub’s Outreachy interns! — December 2022 Cohort</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2022/introducing-jupyterhubs-outreachy-interns-december-2022/" rel="alternate"/><published>2022-12-07T07:45:00+00:00</published><updated>2022-12-07T07:45:00+00:00</updated><author><name>Sarah Gibson</name></author><id>tag:jasongrout.github.io,2022-12-07:/medium-archive/pelican/posts/2022/introducing-jupyterhubs-outreachy-interns-december-2022/</id><summary type="html">&lt;p&gt;As part of the community strategic support project funded by CZI’s EOSS grant series, the JupyterHub sub-project has funding to support…&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2022/introducing-jupyterhubs-outreachy-interns-december-2022/images/001-1_mRtgDdoRwjO3Kb2nSGOsdw.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;As part of the &lt;a href="/posts/2021/czi-awards-three-eoss-grants-to-jupyter-community/"&gt;community strategic support project funded by CZI’s EOSS grant series&lt;/a&gt;, the JupyterHub sub-project has funding to support Outreachy interns through four cohorts over the next two years. We would like to introduce you to the first cohort and the projects they will be working on!&lt;/p&gt;
&lt;h2 id="ogoh-blessing-onyowoicho-improve-accessibility-in-jupyterhub"&gt;Ogoh Blessing Onyowoicho — Improve Accessibility in JupyterHub&lt;/h2&gt;
&lt;p&gt;Accessibility is the ability of tools (in our case web tools) to be used by a variety of communities with different disabilities. There are a variety of standards and tools for evaluating and ensuring that a web page can be used effectively by as many people as possible. Work by the &lt;a href="https://jupyter-accessibility.readthedocs.io"&gt;Accessibility team&lt;/a&gt; is ongoing to define a set of standard tools to improve accessibility across the Jupyter ecosystem.&lt;/p&gt;
&lt;p&gt;The JupyterHub project is working to improve the accessibility of its pages to ensure we are providing tools that are as useful as they can be to as many people as we can. During the internship, we will evaluate JupyterHub’s accessibility, find ways to improve it, and integrate accessibility testing into the development process, in collaboration with the Accessibility team, to ensure we do a better job going forward.&lt;/p&gt;
&lt;h3 id="ogoh-blessing-says"&gt;Ogoh Blessing says:&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;My name is Ogoh Blessing Onyowoicho. I am a self-taught Frontend developer based in Lagos, Nigeria and I am an Outreachy intern working on Improving the accessibility of JupyterHub.&lt;br&gt;
I am excited to work on JupyterHub because it is giving me the opportunity to use skills that I have accrued over the years to proffer solutions to problems that affect people’s lives directly. On hearing accessibility, the first thought one has is that it involves building web products that people with special needs can use seamlessly. Though this is part of it, accessibility goes way beyond this. It involves building products that different users (e.g users at different locations, users with different devices etc) can use easily. The thought of contributing to improving the experience of so many people alone excites me.&lt;br&gt;
In the coming months, I hope to learn and continue to hone my skills as I am guided by my mentors and members of the community I get to interact with.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="allan-wasega-restructure-and-improve-jupyterhub-documentation-by-implementing-the-diataxis-framework"&gt;Allan Wasega — Restructure and improve JupyterHub documentation by implementing the Diátaxis framework&lt;/h2&gt;
&lt;p&gt;JupyterHub has a range of documentation that covers both developer and user audiences in order to help them deploy, maintain, and use their own instance of a JupyterHub. The success of an open source software project to (i) be adopted by users, and (ii) receive meaningful contributions relies heavily on the quality, navigability and accessibility of documentation so that users and developers have all the information they need to achieve what they want to do.&lt;/p&gt;
&lt;p&gt;A framework for organising technical documentation has arisen called &lt;a href="https://diataxis.fr"&gt;diátaxis&lt;/a&gt;. It takes a systematic approach to understanding user requirements of documentation throughout the lifecycle of interaction with a product and posits that different user needs require different approaches in creation of the documentation, as well as a layout to navigate these different “modes” of documentation.&lt;/p&gt;
&lt;p&gt;This project will focus on a refactoring of the documentation for the &lt;a href="https://github.com/jupyterhub/jupyterhub"&gt;JupyterHub package&lt;/a&gt;. We will begin by performing a review of the present documentation, categorise these into the diataxis framework, and then restructure the documentation files in the repository. Once we have transformed the documentation into this framework, it will be much easier to identify missing and unclear documentation (those that were difficult to categorise). We can then begin to curate resources that can fill the gaps and improve documentation that is not specific enough.&lt;/p&gt;
&lt;h3 id="allan-says"&gt;Allan says:&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;I am Allan Wasega, from Nairobi, Kenya. Broadly, I like to describe myself as a researcher and a writer. Researcher because looking into things to find patterns or hidden information has always been of interest to me. Writer because I figured early on that words allow me to express myself and to communicate to a larger audience than that inside my head :). As a Computer Science student, I looked for ways to bring these two skills together within the realm of computing and that is how I found myself in the technical writing space.&lt;br&gt;
As an undergraduate student, I used Jupyter Notebooks extensively for most of my programming assignments and projects. As a result, when making my Outreachy application, the JupyterHub project immediately piqued my interest because I did not know that there was a way to serve Jupyter Notebooks to multiple users, such as within a classroom setting. Presently, I serve as a mentor at KamiLimu, which is a mentorship program for students pursuing technology-aligned courses in tertiary institutions in Kenya. One of the objectives of KamiLimu is to introduce students to tech specializations such as Data Science and Machine Learning, which, from experience, uses Jupyter Notebooks! Therefore, I am excited to work on JupyterHub because I will be learning about and helping to improve a product I hold dear and which I can use to advance the skills of the next generation of computer technologists in Kenya.&lt;br&gt;
First, I hope to gain a deep understanding of how JupyterHub works so as to spread the word about it and its functionalities. Second, I hope to apply and advance my technical writing skills. I encountered the Diataxis Framework earlier this year while working as a technical writer at Tingle Software, a Nairobi-based software company. I have also been following Daniele Procida (the author of the framework) on Twitter for a while now and his work has been quite inspiring. Through this project, I will apply the Diataxis Framework to restructure JupyterHub’s documentation and, in doing so, further my understanding of the framework. Finally, I am passionate about mentorship, especially in the tech field. Therefore, besides expanding my professional and personal networks, this project will enable me to learn how to conduct mentorship within a global setting, and I can, in turn, apply this knowledge within my local community.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="sheila-kahwai-create-a-reusable-jupyterhub-pytest-plugin"&gt;Sheila Kahwai — Create a reusable JupyterHub pytest plugin&lt;/h2&gt;
&lt;p&gt;JupyterHub is a modular and extensible project, with parts, like the proxy, authenticator and spawner, that can be easily changed and extended. Testing the functionality of these components against JupyterHub is important and it requires various hub setups that can sometimes become complicated.&lt;/p&gt;
&lt;p&gt;Currently, each of these hub components and the hub itself define their own testing infrastructure, building everything from the ground up using the pytest framework. But some of this complex work is either repetitive across JupyterHub sub-projects, or under-specified for some of them.&lt;/p&gt;
&lt;p&gt;This project will abstract out these common parts into a separate testing framework. This framework should be a pip-installable pytest plugin that would provide various hub functionalities through pytest fixtures. These fixtures can then be re-used by JupyterHub and its components to bootstrap their own testing suite.&lt;/p&gt;
&lt;p&gt;Integrating this plugin will drive some important refactoring work of the current testing architecture of JupyterHub and have a great impact in improving the overall test coverage, maintainability and continuity of the JupyterHub project.&lt;/p&gt;
&lt;h3 id="sheila-says"&gt;Sheila says:&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;My name is Sheila Kahwai. I am a self-taught python developer from Nairobi, Kenya, working to specialize in back-end engineering.&lt;br&gt;
I am excited to work on JupyterHub because it has made many products I have used throughout my learning journey. It is a privilege to work with a diverse community that has created products that are very useful to equally diverse users like myself.&lt;br&gt;
While creating a reusable JupyterHub pytest plugin, I hope to gain more insight into creating plugins for massive codebases to improve maintainability and scalability with clean and reusable code. Through this project, I look forward to improving the overall testing infrastructure of the various JupyterHub components.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Welcome to the interns! We’re so excited to start working with you!&lt;/p&gt;
</content><category term="accessibility"/><category term="documentation"/><category term="JupyterHub"/><category term="Outreachy"/></entry><entry><title>Inspector JupyterLab</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2022/inspector-jupyterlab/" rel="alternate"/><published>2022-04-11T11:50:00+00:00</published><updated>2022-04-21T09:37:00+00:00</updated><author><name>Martin Renou</name></author><id>tag:jasongrout.github.io,2022-04-11:/medium-archive/pelican/posts/2022/inspector-jupyterlab/</id><summary type="html">&lt;p&gt;JupyterLab provides multiple ways to improve your coding workflow: code highlighting, code completion, theming, debugger with rich variable…&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2022/inspector-jupyterlab/images/001-1_pRzjLlwQIIMhJmx2G_3-Mw.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;JupyterLab provides multiple ways to improve your coding workflow: code highlighting, code completion, theming, debugger with rich variable rendering and more.&lt;/p&gt;
&lt;h2 id="the-jupyterlab-inspector"&gt;The JupyterLab inspector&lt;/h2&gt;
&lt;p&gt;The JupyterLab inspector is one of the ways to enhance your coding experience, it is a UI panel that provides &lt;strong&gt;contextual help&lt;/strong&gt; while you are typing:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2022/inspector-jupyterlab/images/002-1_zSExeL4Doygxl-o3lnStuQ.mp4" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;You can open the inspector using the &lt;strong&gt;Ctrl + I&lt;/strong&gt; shortcut (or &lt;strong&gt;⌘ + I&lt;/strong&gt; on Mac).&lt;/p&gt;
&lt;p&gt;With the Python kernel (ipykernel or xeus-python), this contextual help normally contains a text representation generated using the &lt;code&gt;inspect&lt;/code&gt; Python module and the docstrings associated to an object. But there is a way to make it much nicer!&lt;/p&gt;
&lt;h2 id="go-go-gadget-docrepr"&gt;Go-Go-Gadget Docrepr&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://github.com/spyder-ide/docrepr"&gt;Docrepr&lt;/a&gt; is a Python package which &lt;strong&gt;renders docstrings into HTML&lt;/strong&gt; using &lt;a href="https://www.sphinx-doc.org/"&gt;Sphinx&lt;/a&gt;, maintained by the Spyder team. IPython allows to use docrepr for code inspection, making it the perfect combination for a nice rendering of the contextual help in the inspector!&lt;/p&gt;
&lt;p&gt;Thanks to the recent work on the &lt;a href="https://github.com/jupyterlab/jupyterlab_pygments"&gt;jupyterlab-pygments&lt;/a&gt; extension, the docrepr output even &lt;strong&gt;respect the current JupyterLab theme&lt;/strong&gt; for syntax highlighting!&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2022/inspector-jupyterlab/images/003-1_OtluradnAZEDP_Cpe7x-hQ.mp4" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;h3 id="installation"&gt;Installation&lt;/h3&gt;
&lt;p&gt;First you will need to install the package (either with pip or mamba)&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;pip install docrepr jupyterlab_pygments
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Or:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;mamba install -c conda-forge docrepr jupyterlab_pygments
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In order for IPython to use docrepr, you will need to execute the following in your Notebook (&lt;em&gt;e.g.&lt;/em&gt; in the first cell):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;ip = get_ipython()
ip.sphinxify_docstring = True
ip.enable_html_pager = True
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This also can be set in your IPython configuration file located in &lt;code&gt;~/.ipython/profile_default/ipython_config.py&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;c = get_config()
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;c.InteractiveShell.sphinxify_docstring = True
c.InteractiveShell.enable_html_pager = True
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You are all set! The JupyterLab inspector will now render HTML representations of the contextual help.&lt;/p&gt;
&lt;h2 id="acknowledgments"&gt;Acknowledgments&lt;/h2&gt;
&lt;p&gt;Docrepr has a long history, it originates from the Sphinxify tool of the Sage project that was created back in 2009 by &lt;a href="https://twitter.com/timdumol"&gt;Tim Dumol&lt;/a&gt;. In 2010 &lt;a href="https://twitter.com/ccordoba12?lang=en"&gt;Carlos Córdoba&lt;/a&gt; used it to power Spyder’s help pane and in 2015 he extracted that code and created the docrepr Python package, so that other projects could benefit from it. It was later integrated in IPython by &lt;a href="https://twitter.com/SylvainCorlay"&gt;Sylvain Corlay&lt;/a&gt;. In 2021 &lt;a href="https://github.com/CAM-Gerlach"&gt;C.A.M. Gerlach&lt;/a&gt;, &lt;a href="https://github.com/fasiha"&gt;Ahmed Fasih&lt;/a&gt; and myself updated the package to support the latest Sphinx version.&lt;/p&gt;
&lt;p&gt;My work on this project at &lt;a href="https://twitter.com/QuantStack"&gt;&lt;strong&gt;QuantStack&lt;/strong&gt;&lt;/a&gt; was funded by &lt;a href="https://www.techatbloomberg.com/"&gt;&lt;strong&gt;Bloomberg&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="about-the-author"&gt;About the Author&lt;/h2&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2022/inspector-jupyterlab/images/004-0_Rb8PCWI-Ozz0Fhxy.jpg" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;My name is &lt;a href="https://twitter.com/martinRenou"&gt;Martin Renou&lt;/a&gt;, I am a Scientific Software Engineer at &lt;a href="https://quantstack.net/"&gt;&lt;strong&gt;QuantStack&lt;/strong&gt;&lt;/a&gt;. Before joining QuantStack, I studied at the aerospace engineering school &lt;a href="https://www.isae-supaero.fr/en"&gt;SUPAERO&lt;/a&gt; in Toulouse, France. I also worked at Logilab in Paris, France and Enthought in Cambridge, UK. As an open-source developer at QuantStack, I work on a variety of projects, from &lt;a href="https://github.com/QuantStack/xtensor"&gt;xtensor&lt;/a&gt; and &lt;a href="https://github.com/QuantStack/xeus-python/"&gt;xeus-python&lt;/a&gt; in C++ to &lt;a href="https://github.com/jupyter-widgets/ipyleaflet"&gt;ipyleaflet&lt;/a&gt; and &lt;a href="https://github.com/bqplot/bqplot"&gt;bqplot&lt;/a&gt; in Python and JavaScript/TypeScript, I am also the author of several JupyterLab extensions.&lt;/p&gt;
</content><category term="documentation"/><category term="JupyterLab"/></entry><entry><title>Integrating output in documentation with jupyter-sphinx</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2019/integrating-output-in-documentation-with-jupyter-sphinx/" rel="alternate"/><published>2019-05-30T18:22:00+00:00</published><updated>2019-05-30T18:22:00+00:00</updated><author><name>Anton Akhmerov</name></author><id>tag:jasongrout.github.io,2019-05-30:/medium-archive/pelican/posts/2019/integrating-output-in-documentation-with-jupyter-sphinx/</id><summary type="html">&lt;p&gt;The problem&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2019/integrating-output-in-documentation-with-jupyter-sphinx/images/001-1_XO_pZXORoGXPS1BX1Kd5Ig.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The problem&lt;/h2&gt;
&lt;p&gt;We love Jupyter notebooks for accommodating a &lt;em&gt;computational narrative&lt;/em&gt; — a combination of explanation, code, and the output of this code.&lt;br&gt;
Unfortunately, some tasks cannot be accomplished well by notebooks.&lt;br&gt;
If you are writing documentation for your software project, chances are that you want to provide navigation across many tutorials and explanation pages.&lt;br&gt;
You will also want to automatically document the API, perhaps also maintain a bibliography, and you certainly will want all the classes and functions from your module to automatically link to their documentation pages.&lt;br&gt;
In short, your best bet is Sphinx.&lt;/p&gt;
&lt;p&gt;Sphinx does not provide a way to build a computational narrative: by itself, it cannot execute any code, nor does it know how to handle the output of that code. This limitation is well known and there are great tools offering a workaround; I’ll list the ones that I know about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nbsphinx.readthedocs.io"&gt;&lt;code&gt;nbsphinx&lt;/code&gt;&lt;/a&gt; allows incorporating executed notebooks into a documentation website. Unfortunately, markdown used in notebooks is a much more limited markup language than restructured text.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sphinx-gallery.github.io"&gt;&lt;code&gt;sphinx-gallery&lt;/code&gt;&lt;/a&gt; takes a collection of scripts, executes them, shows the code and the output in the documentation, and even automatically links object names occurring in a script to their documentation. It also parses rst-formatted comments and renders those.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="jupyter-sphinx"&gt;Jupyter-sphinx&lt;/h2&gt;
&lt;p&gt;We have just made an addition to this list, a freshly rewritten &lt;a href="https://jupyter-sphinx.readthedocs.io"&gt;&lt;code&gt;jupyter-sphinx&lt;/code&gt;&lt;/a&gt; extension, that was previously specialized to render Jupyter widgets.&lt;br&gt;
To embed arbitrary output in your documentation using &lt;code&gt;jupyter-sphinx&lt;/code&gt; you only need to use the &lt;code&gt;jupyter-execute&lt;/code&gt; directive:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;..&lt;/span&gt; &lt;span class="ow"&gt;jupyter-execute&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;  print(&amp;#39;Hello world!&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Under the hood, all such code chunks are converted to cells in a notebook and executed using &lt;code&gt;nbconvert&lt;/code&gt;. We then rely on the Jupyter format and protocol to interpret what to do with the results of executing the code. This means you already know how the output will be shown: we apply exactly the same logic as Jupyter notebook does.&lt;/p&gt;
&lt;p&gt;For example, here we make a plot:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2019/integrating-output-in-documentation-with-jupyter-sphinx/images/002-1_rPi05lekdRaC4KuSYd4Zng.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;And here we are rendering some widgets:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2019/integrating-output-in-documentation-with-jupyter-sphinx/images/003-1_KqpHDFn7RehnmftNBwDPiQ.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;If you want to see &lt;code&gt;jupyter-sphinx&lt;/code&gt; used to make package documentation, check out &lt;a href="https://adaptive.readthedocs.io"&gt;&lt;code&gt;adaptive&lt;/code&gt;&lt;/a&gt;, the first adopter (full disclosure—I am one of its authors).&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;An important corollary: building upon the Jupyter kernel protocol makes &lt;code&gt;jupyter-sphinx&lt;/code&gt; language-agnostic; &lt;code&gt;jupyter-sphinx&lt;/code&gt; works with absolutely any language for which a kernel exists.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="try-it"&gt;Try it&lt;/h2&gt;
&lt;p&gt;We have freshly published a release candidate, give it a go using &lt;code&gt;pip install jupyter-sphinx==0.2.0rc1 --pre&lt;/code&gt;. We would love to hear your feedback, especially if you are using other ways of embedding outputs in the documentation, or if you are using an older version of &lt;code&gt;jupyter-sphinx&lt;/code&gt;.&lt;/p&gt;
</content><category term="documentation"/></entry></feed>