Jupyter Notebooks for Print Media [PyCon DE & PyData Berlin 2024]

Learn how to create professional PDF reports from Jupyter notebooks using nbprint, combining interactive data science with print-ready layouts, pagination & styling.

Key takeaways
  • nbprint is a Python library that helps create print-oriented media (PDF reports) from Jupyter notebooks while maintaining interactive capabilities

  • The library bridges nbconvert and page.js to enable professional PDF output with features like:

    • Pagination
    • Headers/footers
    • Table of contents
    • Multi-column layouts
    • Custom CSS/JavaScript
    • MathJax rendering
  • Reports can be parameterized to generate multiple versions with different inputs, useful for:

    • Model assessments
    • Financial reports
    • Academic research
    • News/documentation
  • No need to context switch between notebook development and report creation - research and presentation happen in the same environment

  • Supports common data science libraries like matplotlib, bokeh, and plotly with outputs properly rendered in PDF

  • Configurable via YAML files to define document structure and layout regions

  • Integration with tools like:

    • Papermill for parameterized execution
    • Pydantic for configuration models
    • MathJax for equation rendering
  • Particularly useful for:

    • Financial institutions requiring formal reports
    • Academic research papers
    • Municipal bonds documentation
    • Model performance reporting
    • On-demand document generation
  • Currently in active development but already functional for production use cases

  • Fills a gap in the Jupyter ecosystem focusing specifically on print media output rather than interactive dashboards/apps