Module datapane.client.api.report.core

Datapane Reports Object

Describes the Report object and included APIs for saving and uploading them.

Classes

class Report (*arg_blocks: Union[ForwardRef('Page'), ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any], blocks: List[Union[ForwardRef('Page'), ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any]] = None, layout: Optional[datapane.client.api.report.core.PageLayout] = None, **kwargs)

Report documents collate plots, text, tables, and files into an interactive document that can be analysed and shared by users in their Browser

Args

*arg_blocks
Group to add to document
blocks
Allows providing the document blocks as a single list

Returns

A Report document object that can be uploaded, saved, etc.

Tip: Blocks can be passed using either arg parameters or the blocks kwarg, e.g.

dp.Report(plot, table) or dp.Report(blocks=[plot, table])

Tip: Create a list first to hold your blocks to edit them dynamically, for instance when using Jupyter, and use the blocks parameter

Ancestors

Class variables

var pages : List[Page]
var page_layout : Optional[datapane.client.api.report.core.PageLayout]
var list_fields : List[str]

Static methods

def get(name: str, project: Optional[str] = None) ‑> ~U

Inherited from: DPObjectRef.get

Lookup and retrieve an object from the Datapane Server by its name …

def by_id(id_or_url: str) ‑> ~U

Inherited from: DPObjectRef.by_id

Lookup and retrieve an object from the Datapane Server by its id …

def list() ‑> Iterable[Dict[str, Any]]

Inherited from: DPObjectRef.list

Returns: A list of the Datapane objects of this type that are owned by the user

Instance variables

var edit_url

Methods

def upload(self, name: str, description: str = '', source_url: str = '', publicly_visible: bool = False, tags: List[str] = None, project: Optional[str] = None, open: bool = False, formatting: Optional[datapane.client.api.report.core.ReportFormatting] = None, overwrite: bool = False, **kwargs) ‑> None

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

Args

name
The document name - can include spaces, caps, symbols, etc., e.g. "Profit & Loss 2020"
description
A high-level description for the document, this is displayed in searches and thumbnails
source_url
A URL pointing to the source code for the document, e.g. a GitHub repo or a Colab notebook
publicly_visible
Visible to anyone with the link
tags
A list of tags (as strings) used to categorise your document
project
Project to add the report to (Teams only)
open
Open the file in your browser after creating
formatting
Set the basic styling for your report
overwrite
Overwrite the report
def update_assets(self, *arg_blocks: Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty')], blocks: Union[Dict[str, Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any]], List[Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty')]]] = None, open: bool = False, **kw_blocks: Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any]) ‑> None

Upload updated plots, text, tables, and files for a report. Blocks can be created with the name parameter, if not set, one can be provided here using keyword args. Use the blocks dict parameter to add a dynamically generated set of named blocks, useful when working in Jupyter

Args

*arg_blocks
List of blocks to add to document, these must be wrapped, e.g. using dp.DataTable(df) instead of df
blocks
Allows providing the document blocks as a single list/dictionary of named blocks
open
Open the report in your browser for editing after updating
**kw_blocks
Keyword argument set of blocks, whose block name will be that given in the keyword

Returns

None

Tip: Blocks can be passed using either arg parameters or the blocks kwarg as a dictionary, e.g.

report.update_assets(my_plot=plot, my_table=table) or report.update_assets(blocks={"my_plot": plot, "my_table":table})

Tip: Create a dictionary first to hold your blocks to edit them dynamically, for instance when using Jupyter, and use the blocks parameter

def save(self, path: str, open: bool = False, name: Optional[str] = None, author: Optional[str] = None, formatting: Optional[datapane.client.api.report.core.ReportFormatting] = None) ‑> None

Save the report document to a local HTML file

Args

path
File path to store the document
open
Open in your browser after creating (default: False)
name
Name of the document (optional: uses path if not provided)
author
The report author / email / etc. (optional)
formatting
Sets the basic report styling
def preview(self, open: True, formatting: Optional[datapane.client.api.report.core.ReportFormatting] = None) ‑> None

Preview the report in a new browser window. Can be called multiple times, refreshing the existing created preview file. Pass open=False to stop openning a new tab on subsequent previews

Args

open
Open in your browser after creating (default: True)
formatting
Sets the basic report styling
def refresh(self)

Inherited from: DPObjectRef.refresh

Refresh the object with the latest data from the Datapane Server - override to pull updated fields from dto to top-level

def delete(self)

Inherited from: DPObjectRef.delete

Delete the object on the server

class ReportWidth (value, names=None, *, module=None, qualname=None, type=None, start=1)

The document width

Ancestors

  • enum.Enum

Class variables

var NARROW
var MEDIUM
var FULL