Skip to content

Reports

Once you have built up the blocks that make up your report, you can use one of the following functions to convert it into a report.

Note

If your blocks include any App-specific blocks, e.g. dp.Form, you will not be able to output them as a report. Consider building as an app instead - see here

save_report

Save the app document to a local HTML file

Parameters:

Name Type Description Default
blocks BlocksT

The Blocks object or a list of Blocks

required
path str

File path to store the document

required
open bool

Open in your browser after creating (default: False)

False
name str

Name of the document (optional: uses path if not provided)

'Report'
formatting t.Optional[Formatting]

Sets the basic app styling

None

build_report

Build an (static) app with a directory structure, which can be served by a local http server

Note

This outputs compressed assets into the dir as well, may be an issue if self-hosting...

Parameters:

Name Type Description Default
blocks BlocksT

The Blocks object or a list of Blocks

required
name str

The name of the app directory to be created

'Report'
dest t.Optional[NPath]

File path to store the app directory

None
formatting t.Optional[Formatting]

Sets the basic app styling

None
overwrite bool

Replace existing app with the same name and destination if already exists (default: False)

False

upload_report

Upload as a report, including its attached assets, to the logged-in Datapane Server.

Parameters:

Name Type Description Default
blocks BlocksT

The Blocks object or a list of Blocks

required
name str

The document name - can include spaces, caps, symbols, etc., e.g. "Profit & Loss 2020"

required
description str

A high-level description for the document, this is displayed in searches and thumbnails

''
source_url str

A URL pointing to the source code for the document, e.g. a GitHub repo or a Colab notebook

''
publicly_visible t.Optional[bool]

Visible to anyone with the link

None
tags t.Optional[t.List[str]]

A list of tags (as strings) used to categorise your document

None
project t.Optional[str]

Project to add the app to

None
open bool

Open the file in your browser after creating

False
formatting t.Optional[Formatting]

Set the basic styling for your app

None
overwrite bool

Overwrite the app

False

stringify_report

Stringify the app document to a HTML string

Parameters:

Name Type Description Default
blocks BlocksT

The Blocks object or a list of Blocks

required
name t.Optional[str]

Name of the document (optional: uses path if not provided)

None
formatting t.Optional[Formatting]

Sets the basic app styling

None