File: usage-inspect.rst

package info (click to toggle)
python-papermill 2.6.0-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,216 kB
  • sloc: python: 4,977; makefile: 17; sh: 5
file content (56 lines) | stat: -rw-r--r-- 1,466 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Inspect
=======

The two ways to inspect the notebook to discover its parameters are: (1) through the
Python API and (2) through the command line interface.

Execute via the Python API
~~~~~~~~~~~~~~~~~~~~~~~~~~

The `inspect_notebook` function can be called to inspect a notebook:

.. code-block:: python

   inspect_notebook(<notebook path>)



.. code-block:: python

   import papermill as pm

   pm.inspect_notebook('path/to/input.ipynb')

.. note::
    If your path is parameterized, you can pass those parameters in a dictionary
    as second parameter:

    ``inspect_notebook('path/to/input_{month}.ipynb', parameters={month='Feb'})``

Inspect via CLI
~~~~~~~~~~~~~~~

To inspect a notebook using the CLI, enter the ``papermill --help-notebook`` command in the
terminal with the notebook and optionally path parameters.

.. seealso::

    :doc:`CLI reference <./usage-cli>`

Inspect a notebook
^^^^^^^^^^^^^^^^^^

Here's an example of a local notebook being inspected and an output example:

.. code-block:: bash

    papermill --help-notebook ./papermill/tests/notebooks/complex_parameters.ipynb

    Usage: papermill [OPTIONS] NOTEBOOK_PATH [OUTPUT_PATH]

    Parameters inferred for notebook './papermill/tests/notebooks/complex_parameters.ipynb':
    msg: Unknown type (default None)
    a: float (default 2.25)         Variable a
    b: List[str] (default ['Hello','World'])
                                    Nice list
    c: NoneType (default None)