Skip to main content

Hide_code

https://img.shields.io/github/license/mashape/apistatus.svg

Release build

https://travis-ci.org/kirbs-/hide_code.svg?branch=master

Development build

https://travis-ci.org/kirbs-/hide_code.svg?branch=dev)

Introduction

hide_code is an extension for Jupyter/IPython notebooks to selectively hide code and prompts. Make a notebook a code free document for exporting or presenting with a single click by pressing

https://raw.githubusercontent.com/kirbs-/hide_code/dev/images/button.png

Normal

https://raw.githubusercontent.com/kirbs-/hide_code/dev/images/1.1.png

Hide code enabled

https://raw.githubusercontent.com/kirbs-/hide_code/dev/images/1.2.png

Or customize each cell by selecting “Hide code” from the Cell Toolbar dropdown. Then use “Hide Code” and “Hide Prompts” checkboxes to hide the specific cell’s code or cell’s input/output prompts.

https://raw.githubusercontent.com/kirbs-/hide_code/dev/images/2.png

Normal

https://raw.githubusercontent.com/kirbs-/hide_code/dev/images/3.1.png

Hide code enabled

https://raw.githubusercontent.com/kirbs-/hide_code/dev/images/3.2.png

Exporting

Exporting respects hide code/prmpt cell selections only. Output is saved in Jupyter’s current working directory with the notebook’s file name + ‘.html’ or ‘.pdf’.**Exporting to PDF via notebook requires** wkhtmltopdf.

This feature continues to evolve. Items on the road map incude:

  • saving to a different file loaction.

  • saving as a different file name.

  • support for custom CSS.

  • single click exporting with all code and prompts hidden (similar to how the toolbar button).

Via notebook

To export via HTML or PDF simply click on the respective button.

https://raw.githubusercontent.com/kirbs-/hide_code/dev/images/4.1.png

Via nbconvert command line

To export via nbconvert command line, nbconvert 4.2 or later is required. Hide_code adds two export options to nbconvert, hide_code_html and hide_code_pdf.

Note: PDF exporting via command line uses nbconvert’s built in PDF exporter.

jupyter nbconvert –to hide_code_html notebook_to_convert.ipynb

jupyter nbconvert –to hide_code_pdf notebook_to_convert.ipynb

Installation

Via pip

pip install hide_code

Via setuptools

  1. Download and unzip this repository.

  2. Change to unzipped directory.

  3. Execute python setup.py install

Installation Troubleshooting

If installation complains the directory doesn’t exist, you’re Jupyter/IPython installation probably isn’t in one of the usual places. Locate Jupyter’s configuration directory, then use code below to install in a non-standard directory.

` import hide_code.hide_code as hc dir = “<full path to Jupyter config directory>” hc.install(dir) `

Requirements

  • Jupyter notebook 4.x+

  • Jupyter nbconvert 4.2+ if using nbconvert command line exporting

  • pdfkit & wkhtmltopdf

  • Python 2.7 or 3.3+

Metadata

Release files for hide-code 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hide-code 0.2.0
File Size Uploaded
hide_code-0.2.0.tar.gz 10.4 kB Details

Release files / hide_code-0.2.0.tar.gz

Download URL hide_code-0.2.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
61a54a79acedf25a0ef88aa99a2b14cf92e9da6e25b3561552fe67accf8d41fa
BLAKE2b-256 checksum
How to use checksums
91faec6d6fd628dcd3f86db7db66e962d32f05189f0b2dc8443e5d76cd3005a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.7.0

2 release files

0.6.0

1 release file

0.5.6

1 release file

0.5.5

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.1

1 release file

This release

0.2.0 This release

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page