Comparison pageNotebook format comparison

IPYNB vs PY

IPYNB and PY solve different problems. IPYNB is best for interactive exploration with narrative, code, saved outputs, and notebook context. PY is best for plain source code, Git review, linting, packaging, and script-first handoff after the notebook logic stabilizes.

Convert IPYNB to PDFOpen IPYNB to PY

IPYNB Tools editorial · Updated May 23, 2026

Extractable Summary

Page type
Comparison page for deciding between notebook-first and script-first artifacts.
Best for
Users who need to decide whether saved outputs, Markdown, and notebook context still matter.
Primary decision
Choose IPYNB for exploration, PY for source code handoff, PDF for fixed reports, and HTML for browser-first reading.
Common confusion
A Python script does not preserve notebook outputs, charts, tables, or rich notebook layout.
Best companion page
Use the IPYNB to Python tool when the decision is already clear and the goal is code extraction.

Best to keep IPYNB for exploration

notebooks keep Markdown, code, outputs, and cell order together while work is still changing.

Best to use PY for code review

plain scripts make diffs, linting, imports, and packaging much easier.

Best to use PDF for readers

PDF preserves the analysis as a fixed report when the reader does not need to run code.

Best to export both for handoff

a PDF explains the result while a PY script carries the source code forward.

Choose IPYNB, PY, or PDF

The right format depends on whether the next person needs to keep exploring, inspect code, read results, or publish a browser page.

What IPYNB preserves that PY does not

An .ipynb file stores code cells, Markdown explanations, saved outputs, metadata, and notebook order as JSON. That makes it stronger when charts, tables, formulas, execution results, and narrative context are still part of the artifact.

A .py file stores source code as a script. It is cleaner for Git diffs, code review, refactoring, linting, packaging, and automation, but it is not a reader-facing replacement for notebook outputs.

  • IPYNB keeps outputs
  • IPYNB keeps notebook context
  • PY is cleaner for Git and scripts

What gets lost when converting IPYNB to PY

Converting IPYNB to PY typically removes saved outputs, execution counts, rich displays, and notebook layout. Markdown can be converted to comments, but it will not look like the original notebook.

That means a .py file is not enough when the audience needs charts, tables, formulas, screenshots, or notebook-style explanation. In those cases, PDF or HTML is usually a better final artifact than a Python script.

  • Outputs are lost
  • Rich media is lost
  • Notebook layout is lost
  • Execution state is lost

When PDF, HTML, or PY is the better output

Choose PDF when the next reader needs a fixed report, assignment, printable file, stakeholder brief, or archive artifact. Choose HTML when the next reader will stay in a browser, documentation page, or LMS instead of needing a fixed document.

Choose PY when the next reader needs source code more than presentation. A common real workflow is: explore in IPYNB, publish results as PDF or HTML, and extract stable code to PY once the notebook stops changing.

Format Comparison

Each format optimizes for a different next reader.

Handoff Workflow

Many teams need both a report artifact and a code artifact.

Recommended steps

  1. 1

    Decide what the next reader needs

    Readers need PDF, developers need PY, and collaborators may need IPYNB.

  2. 2

    Check whether outputs matter

    If outputs are part of the story, use IPYNB, PDF, or HTML instead of PY.

  3. 3

    Extract only stable code

    Remove scratch cells before creating a Python script.

  4. 4

    Keep the report artifact

    Export PDF when decisions, charts, tables, or conclusions need to be shared.

Specs and limitations

Best IPYNB use
Exploration, tutorials, notebooks with charts and narrative context.
Best PY use
Reusable code, code review, automation, package modules, and Git history.
Best PDF use
Assignments, reports, client delivery, print, and archive.
Best HTML use
Browser-readable documentation, LMS pages, and internal notebook review.
Common mistake
Sending PY when the recipient actually needs saved outputs and explanation.

FAQ

What is the difference between IPYNB and PY?

descriptive

IPYNB is a notebook document that can store Markdown, code cells, saved outputs, and metadata. PY is a plain Python script focused on source code.

Is IPYNB better than PY?

decision

Neither is universally better. IPYNB is better for mixed narrative, code, and outputs; PY is better for plain source code workflows.

Why are IPYNB diffs noisy?

mechanism

Notebook JSON stores cells, metadata, execution counts, and outputs, so small notebook changes can create large diffs.

Should I submit IPYNB, PY, or PDF?

decision

Follow the assignment or team requirement. If no format is specified, use PDF for readable results and PY for source-code review.

Does converting to PY keep charts?

mechanism

No. Charts are notebook outputs, not Python script content. Use PDF or HTML when chart outputs matter.

When should I choose HTML instead of PY?

decision

Choose HTML when the next reader should review the notebook in a browser, documentation page, or LMS. Choose PY when the next reader needs source code for editing or reuse.