Package datapane.client.api
API docs for Datapane Client
These docs describe the Python API for building Datapane documents, along with additional information on the Datapane Teams API.
Usage docs for Datapane can be found at https://docs.datapane.com
These objects are all available under the datapane
module, via import datapane as dp
(they are re-exported from datapane.client.api
).
Datapane Reports API
The core document APIs are available for both Datapane Community and Datapane Teams, these are found in datapane.client.api.report
, including,
Report
- Layout Blocks
- Data Blocks
Datapane Teams
Additional API docs are found in datapane.client.api.teams
that provide building, deployment, and sharing of data analytics apps and workflows
Note: These docs describe the latest version of the datapane API available on pypi
Sub-modules
datapane.client.api.builtins
-
Datapane built-in helper functions to make creating your reports a bit simpler and reduce common tasks
datapane.client.api.common
-
Common objects …
datapane.client.api.dp_object
-
Base classes …
datapane.client.api.files
datapane.client.api.files_optional
datapane.client.api.report
-
Main Document API module, includes both the core
Report
object, and the blocks in … datapane.client.api.runtime
-
App runtime API …
datapane.client.api.teams
-
Datapane Teams API …
datapane.client.api.user
-
Datapane User API …
Functions
def init(config_env: str = 'default', config: Optional[datapane.client.config.Config] = None) ‑> datapane.client.config.Config
-
Init an API config - this MUST handle being called multiple times and only from the main-thread
def _reset_runtime(params: Dict[str, Any])
-
Called between each script invocation
def hello_world()
-
Create and run an example report, and open in the browser
def login(token: Optional[str], server: str = 'https://datapane.com', env: str = 'default', cli_login: bool = True) ‑> str
-
Login to the specified Datapane Server, storing the token within a config-file called
env
for future useArgs
token
- Token to use when logging in
server
- Datapane Server to connect to (default: Datapane Community at https://datapane.com/)
env
- The environment profile to store these login details to (default:
default
) cli_login
- Toggle if this login is occuring via the CLI (optional)
Returns
the email for the logged in user
Note: Can also be ran via CLI as
"datapane login"
def logout(env: str = 'default') ‑> None
-
Logout from Datapane Server, removing local credentials
Args
env
- Environment profile to logout from
Note: Can also be ran via CLI as
"datapane logout"
def ping(config: Optional[datapane.client.config.Config] = None, cli_login: bool = False, verbose: bool = True) ‑> str
-
Ping the Datapane Server to check login credentials
Classes
class IncompatibleVersionError (*args, **kwargs)
-
Common base class for all non-exit exceptions.
Ancestors
- datapane.common.dp_types.DPError
- builtins.Exception
- builtins.BaseException
class HTTPError (*args, **kwargs)
-
An HTTP error occurred.
Initialize RequestException with
request
andresponse
objects.Ancestors
- requests.exceptions.RequestException
- builtins.OSError
- builtins.Exception
- builtins.BaseException
class Resource (endpoint: str)
-
Class variables
var endpoint : str
var url : str
var session
var timeout
Methods
def post(self, params: Dict = None, overwrite: bool = False, **data: Union[str, int, float, bool, ForwardRef(None), Mapping[str, ForwardRef('JSON')], List[ForwardRef('JSON')]]) ‑> Union[str, int, float, bool, ForwardRef(None), Mapping[str, Union[str, int, float, bool, ForwardRef(None), Mapping[str, JSON], List[JSON]]], List[Union[str, int, float, bool, ForwardRef(None), Mapping[str, JSON], List[JSON]]]]
def post_files(self, files: Dict[str, List[pathlib.Path]], overwrite: bool = False, **data: Union[str, int, float, bool, ForwardRef(None), Mapping[str, ForwardRef('JSON')], List[ForwardRef('JSON')]]) ‑> munch.Munch
def get(self, empty_ok: bool = False, **params) ‑> munch.Munch
def patch(self, params: Dict = None, **data: Union[str, int, float, bool, ForwardRef(None), Mapping[str, ForwardRef('JSON')], List[ForwardRef('JSON')]]) ‑> Union[str, int, float, bool, ForwardRef(None), Mapping[str, Union[str, int, float, bool, ForwardRef(None), Mapping[str, JSON], List[JSON]]], List[Union[str, int, float, bool, ForwardRef(None), Mapping[str, JSON], List[JSON]]]]
def delete(self) ‑> None
def nest_endpoint(self, endpoint: str) ‑> Generator[datapane.client.api.common.Resource, None, None]
-
Returns a context manager allowing recursive nesting in endpoints
class DPObjectRef (dto: Optional[munch.Munch] = None)
-
Abstract class used to reference core Datapane server objects - not used directly.
Subclasses
- Report
- App
- Environment
- File
- datapane.client.api.teams.Run
- Schedule
Class variables
var endpoint : str
var res : datapane.client.api.common.Resource
var list_fields : List[str]
Static methods
def get(name: str, project: Optional[str] = None) ‑> ~U
-
Lookup and retrieve an object from the Datapane Server by its name
Args
name
- The name of the object, e.g. 'my-file-3
or
project1/my-file-3` project
- The project of the object, e.g.
project1
(can be provided with the name as shown above)
Returns
The object if found
def by_id(id_or_url: str) ‑> ~U
-
Lookup and retrieve an object from the Datapane Server by its id
Args
id_or_url
- The
id
, or full URL that represents the object
Returns
The object if found
def post_with_files(files: Dict[str, List[pathlib.Path]] = None, file: Optional[pathlib.Path] = None, overwrite: bool = False, **kwargs: Union[str, int, float, bool, ForwardRef(None), Mapping[str, ForwardRef('JSON')], List[ForwardRef('JSON')]]) ‑> ~U
def post(overwrite: bool = False, **kwargs) ‑> ~U
def list() ‑> Iterable[Dict[str, Any]]
-
Returns: A list of the Datapane objects of this type that are owned by the user
Instance variables
var dto : Optional[munch.Munch]
var has_dto : bool
var url : URL
Methods
def refresh(self)
-
Refresh the object with the latest data from the Datapane Server - override to pull updated fields from dto to top-level
def delete(self)
-
Delete the object on the server
def update(self, **kwargs)
class HTML (html: Union[str, dominate.dom_tag.dom_tag], name: str = None, label: str = None)
-
HTML blocks can be used to embed an arbitrary HTML fragment in a report.
Args
html
- The HTML fragment to embed - can be a string or a dominate tag
name
- A unique name for the block to reference when adding text or embedding (optional)
label
- A label used when displaying the block (optional)
Ancestors
- datapane.client.api.report.blocks.EmbeddedTextBlock
- DataBlock
- BaseElement
- abc.ABC
Class variables
var content : str
class Attachment (data: Optional[Any] = None, file: Union[pathlib.Path, os.PathLike, str, ForwardRef(None)] = None, filename: Optional[str] = None, caption: Optional[str] = None, name: str = None, label: str = None)
-
Attachment blocks are used to attach a file to the report that can be downloaded by report viewers
Any type of file may be attached, for instance, images (png / jpg), PDFs, JSON data, Excel files, etc.
Tip: To attach streamable / viewable video, audio or images, use the
dp.Media
block insteadArgs
data
- A python object to attach to the report (e.g. a dictionary)
file
- Path to a file to attach to the report (e.g. a csv file)
filename
- Name to be used when downloading the file (optional)
caption
- A caption to display below the file (optional)
name
- A unique name for the block to reference when adding text or embedding (optional)
label
- A label used when displaying the block (optional)
Note: either
data
orfile
must be providedAncestors
- datapane.client.api.report.blocks.AssetBlock
- DataBlock
- BaseElement
- abc.ABC
Class variables
var file : pathlib.Path
var file_attribs : Dict[str, str]
var caption : Optional[str]
class BigNumber (heading: str, value: Union[str, int, float], change: Union[str, int, float, ForwardRef(None)] = None, prev_value: Union[str, int, float, ForwardRef(None)] = None, is_positive_intent: Optional[bool] = None, is_upward_change: Optional[bool] = None, name: str = None, label: str = None)
-
BigNumber blocks display a numerical value with a heading, alongside optional contextual information about the previous value.
Args
heading
- A title that gives context to the displayed number
value
- The value of the number
prev_value
- The previous value to display as comparison (optional)
change
- The amount changed between the value and previous value (optional)
is_positive_intent
- Displays the change on a green background if
True
, and red otherwise. Followsis_upward_change
if not set (optional) is_upward_change
- Whether the change is upward or downward (required when
change
is set) name
- A unique name for the block to reference when adding text or embedding (optional)
label
- A label used when displaying the block (optional)
Ancestors
- DataBlock
- BaseElement
- abc.ABC
Class variables
var name : Optional[str]
class Code (code: str, language: str = 'python', caption: str = None, name: str = None, label: str = None)
-
Code objects store source code that can be displayed as formatted text when viewing your report.
Args
code
- The source code
language
- The language of the code, most common languages are supported (optional - defaults to Python)
caption
- A caption to display below the Code (optional)
name
- A unique name for the block to reference when adding text or embedding (optional)
label
- A label used when displaying the block (optional)
Ancestors
- datapane.client.api.report.blocks.EmbeddedTextBlock
- DataBlock
- BaseElement
- abc.ABC
Class variables
var content : str
class DataTable (df: pandas.core.frame.DataFrame, caption: Optional[str] = None, name: str = None, label: str = None)
-
DataTable blocks store a dataframe that can be viewed, sorted, filtered by users viewing your report, similar to a spreadsheet, and can be downloaded by them as a CSV or Excel file.
Tip: For smaller dataframes where you don't require sorting and filtering, also consider using the
Table
blockNote: The DataTable component has advanced analysis features that requires a server and is not supported when saving locally, please upload such reports to a Datapane Server or use dp.Table
Args
df
- The pandas dataframe to attach to the report
caption
- A caption to display below the plot (optional)
name
- A unique name for the block to reference when adding text or embedding (optional)
label
- A label used when displaying the block (optional)
Ancestors
- datapane.client.api.report.blocks.AssetBlock
- DataBlock
- BaseElement
- abc.ABC
Class variables
var file : pathlib.Path
var file_attribs : Dict[str, str]
var caption : Optional[str]
class Divider
-
Divider blocks add a horizontal line to your report, normally used to break up report contents
Args
name
- A unique name to reference the block, used when referencing blocks via the report editor and when embedding
Ancestors
- datapane.client.api.report.blocks.EmbeddedTextBlock
- DataBlock
- BaseElement
- abc.ABC
Class variables
var content : str
class Embed (url: str, width: int = 960, height: int = 540, name: str = None, label: str = None)
-
Embed blocks allow HTML from OEmbed providers (e.g. Youtube, Twitter, Vimeo) to be embedded in a report.
Args
url
- The URL of the resource to be embedded
width
- The width of the embedded object (optional)
height
- The height of the embedded object (optional)
name
- A unique name for the block to reference when adding text or embedding (optional)
label
- A label used when displaying the block (optional)
Ancestors
- datapane.client.api.report.blocks.EmbeddedTextBlock
- DataBlock
- BaseElement
- abc.ABC
Class variables
var content : str
class Empty (name: str)
-
An empty block that can be patched later
Args
name
- A unique name for the block to reference when updating the report
Args
name
- A unique name to reference the block, used when referencing blocks via the report editor and when embedding
Ancestors
- BaseElement
- abc.ABC
Class variables
var name : Optional[str]
class Formula (formula: str, caption: str = None, name: str = None, label: str = None)
-
Formula blocks can be used to embed LaTeX in a report.
Args
formula
- The formula to embed, using LaTeX format (use raw strings)
caption
- A caption to display below the Formula (optional)
name
- A unique name for the block to reference when adding text or embedding (optional)
label
- A label used when displaying the block (optional)
Note: LaTeX commonly uses special characters, hence prefix your formulas with
r
to make themraw strings, e.g. r"\frac{1}{\sqrt{x^2 + 1}}"
Ancestors
- datapane.client.api.report.blocks.EmbeddedTextBlock
- DataBlock
- BaseElement
- abc.ABC
Class variables
var content : str
class Group (*arg_blocks: Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any], blocks: List[Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any]] = None, name: str = None, label: str = None, columns: int = 1)
-
Groups act as a container that holds a list of nested Blocks objects, such as Tables, Plots, etc.. - they may even hold Group themselves recursively.
Group are used to provide a grouping for blocks can have layout options applied to them
Note: Group expects a list of Blocks, e.g. a Plot or Table, but also including Select or Groups themselves,
but if a Python object is passed, e.g. a Dataframe, Datapane will attempt to convert it automatically.
Args
*arg_blocks
- Group to add to report
blocks
- Allows providing the report blocks as a single list
name
- A unique id for the blocks to aid querying (optional)
label
- A label used when displaying the block (optional)
columns
- Display the contained blocks, e.g. Plots, using n columns (default = 1), setting to 0 auto-wraps the columns
Tip: Group can be passed using either arg parameters or the
blocks
kwarg, e.g.dp.Group(plot, table, columns=2)
ordp.Group(blocks=[plot, table], columns=2)
Ancestors
- datapane.client.api.report.blocks.LayoutBlock
- BaseElement
- abc.ABC
Class variables
var blocks : List[Union[Group, Select, DataBlock, Empty]]
class Media (file: Union[pathlib.Path, os.PathLike, str], name: str = None, label: str = None, caption: Optional[str] = None)
-
Media blocks are used to attach a file to the report that can be viewed or streamed by report viewers
Note: Supported video, audio and image formats depends on the browser used to view the report. MP3, MP4, and all common image formats are generally supported by modern browsers
Args
file
- Path to a file to attach to the report (e.g. a JPEG image)
name
- A unique name for the block to reference when adding text or embedding (optional)
caption
- A caption to display below the file (optional)
label
- A label used when displaying the block (optional)
Ancestors
- datapane.client.api.report.blocks.AssetBlock
- DataBlock
- BaseElement
- abc.ABC
Class variables
var file : pathlib.Path
var file_attribs : Dict[str, str]
var caption : Optional[str]
class Page (*arg_blocks: Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any], blocks: List[Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any]] = None, title: str = None, name: str = None)
-
All
Report
s consist of a list of Pages. A Page itself is a Block, but is only allowed at the top-level and cannot be nested.Page objects take a list of blocks which make up the Page.
Note: You can pass ordinary Blocks to a page, e.g. Plots or DataTables.
Additionally, if a Python object is passed, e.g. a Dataframe, Datapane will attempt to convert it automatically.
Args
*arg_blocks
- Blocks to add to Page
blocks
- Allows providing the report blocks as a single list
title
- The page title (optional)
name
- A unique id for the Page to aid querying (optional)
Tip: Page can be passed using either arg parameters or the
blocks
kwarg, e.g.dp.Page(group, select)
ordp.Group(blocks=[group, select])
Ancestors
- datapane.client.api.report.blocks.LayoutBlock
- BaseElement
- abc.ABC
Class variables
var blocks : List[Union[Group, Select, DataBlock, Empty]]
class Plot (data: Any, caption: Optional[str] = None, responsive: bool = True, scale: float = 1.0, name: str = None, label: str = None)
-
Plot blocks store a Python-based plot object, including ones created by Altair, Plotly, Matplotlib, Bokeh, Folium, and PlotAPI, for interactive display in your report when viewed in the browser.
Args
data
- The
plot
object to attach caption
- A caption to display below the plot (optional)
responsive
- Whether the plot should automatically be resized to fit, set to False if your plot looks odd (optional, default: True)
scale
- Set the scaling factor for the plt (optional, default = 1.0)
name
- A unique name for the block to reference when adding text or embedding (optional)
label
- A label used when displaying the block (optional)
Ancestors
- datapane.client.api.report.blocks.AssetBlock
- DataBlock
- BaseElement
- abc.ABC
Class variables
var file : pathlib.Path
var file_attribs : Dict[str, str]
var caption : Optional[str]
class Select (*arg_blocks: Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any], blocks: List[Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any]] = None, type: Optional[SelectType] = None, name: str = None, label: str = None)
-
Selects act as a container that holds a list of nested Blocks objects, such as Tables, Plots, etc.. - but only one may be visible, or "selected", at once.
The user can choose which nested object to view dynamically using either tabs or a dropdown.
Note: Select expects a list of Blocks, e.g. a Plot or Table, but also including Select or Groups themselves,
but if a Python object is passed, e.g. a Dataframe, Datapane will attempt to convert it automatically.
Args
*arg_blocks
- Page to add to report
blocks
- Allows providing the report blocks as a single list
type
- An instance of SelectType that indicates if the select should use tabs or a dropdown
name
- A unique id for the blocks to aid querying (optional)
label
- A label used when displaying the block (optional)
Tip: Select can be passed using either arg parameters or the
blocks
kwarg, e.g.dp.Select(table, plot, type=dp.SelectType.TABS)
ordp.Group(blocks=[table, plot])
Ancestors
- datapane.client.api.report.blocks.LayoutBlock
- BaseElement
- abc.ABC
Class variables
var blocks : List[Union[Group, Select, DataBlock, Empty]]
class SelectType (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
An enumeration.
Ancestors
- enum.Enum
Class variables
var DROPDOWN
var TABS
class Table (data: Union[pandas.core.frame.DataFrame, pandas.io.formats.style.Styler], caption: Optional[str] = None, name: str = None, label: str = None)
-
Table blocks store the contents of a dataframe as a HTML
table
whose style can be customised using pandas'Styler
API.Args
data
- The pandas
Styler
instance or dataframe to generate the table from caption
- A caption to display below the table (optional)
name
- A unique name for the block to reference when adding text or embedding (optional)
label
- A label used when displaying the block (optional)
Ancestors
- datapane.client.api.report.blocks.AssetBlock
- DataBlock
- BaseElement
- abc.ABC
Class variables
var file : pathlib.Path
var file_attribs : Dict[str, str]
var caption : Optional[str]
class Text (text: str = None, file: Union[pathlib.Path, os.PathLike, str] = None, name: str = None, label: str = None)
-
Markdown objects store Markdown text that can be displayed as formatted text when viewing your report.
Note: This object is also available as
dp.Text
, and any strings provided directly to the Report/Group object are converted automatically to Markdown blocksTip: You can also insert a dataframe in a Markdown block as a table by using
df.to_markdown()
, or use dp.Table or dp.DataTable for dedicated dataframe tables.Args
text
- The markdown formatted text, use triple-quotes, (
"""# My Title"""
) to create multi-line markdown text file
- Path to a file containing markdown text
name
- A unique name for the block to reference when adding text or embedding (optional)
label
- A label used when displaying the block (optional)
Note: File encodings are auto-detected, if this fails please read the file manually with an explicit encoding and use the text parameter on dp.Attachment
Ancestors
- datapane.client.api.report.blocks.EmbeddedTextBlock
- DataBlock
- BaseElement
- abc.ABC
Class variables
var content : str
Methods
def format(self, *args: Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any], **kwargs: Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any]) ‑> Group
-
Format the markdown text template, using the supplied context to insert blocks into
{{}}
markers in the template.{}
markers can be empty, hence positional, or have a name, e.g.{{plot}}
, which is used to lookup the value from the keyword context.Args
*args
- positional template context arguments
**kwargs
- keyword template context arguments
Tip: Either Python objects, e.g. dataframes, and plots, or Datapane blocks as context
Returns
A datapane Group object containing the list of text and embedded objects
class Toggle (*arg_blocks: Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any], blocks: List[Union[ForwardRef('Group'), ForwardRef('Select'), ForwardRef('DataBlock'), ForwardRef('Empty'), Any]] = None, name: str = None, label: str = None)
-
Toggles act as a container that holds a list of nested Block objects, whose visbility can be toggled on or off by the report viewer
Args
*arg_blocks
- Group to add to report
blocks
- Allows providing the report blocks as a single list
name
- A unique id for the blocks to aid querying (optional)
label
- A label used when displaying the block (optional)
Ancestors
- datapane.client.api.report.blocks.LayoutBlock
- BaseElement
- abc.ABC
Class variables
var blocks : List[Union[Group, Select, DataBlock, Empty]]
class FontChoice (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
An enumeration.
Ancestors
- enum.Enum
Class variables
var DEFAULT
var SANS
var SERIF
var MONOSPACE
class PageLayout (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
An enumeration.
Ancestors
- enum.Enum
Class variables
var TOP
var SIDE
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)
ordp.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
parameterAncestors
Class variables
var pages : List[Page]
var page_layout : Optional[datapane.client.api.report.core.PageLayout]
var list_fields : List[str]
var endpoint : 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 : str
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 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: bool, 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 ReportFormatting (bg_color: str = '#FFF', accent_color: str = '#4E46E5', font: Union[datapane.client.api.report.core.FontChoice, str] = FontChoice.DEFAULT, text_alignment: datapane.client.api.report.core.TextAlignment = TextAlignment.JUSTIFY, width: ReportWidth = ReportWidth.MEDIUM, light_prose: bool = False)
-
Sets the report styling and formatting
Class variables
var bg_color : str
var accent_color : str
var font : Union[datapane.client.api.report.core.FontChoice, str]
var text_alignment : datapane.client.api.report.core.TextAlignment
var width : ReportWidth
var light_prose : bool
Methods
def to_css(self) ‑> str
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
class TextAlignment (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
An enumeration.
Ancestors
- enum.Enum
Class variables
var JUSTIFY
var LEFT
var RIGHT
var CENTER
class App (dto: Optional[munch.Munch] = None)
-
Apps allow users to build, deploy, and automate data-driven Python workflows and apps to their cloud that can be customised and run by other users.
Tip: We recommend using either the Web UI or CLI, e.g.
datapane app deploy / run / ...
to work with apps rather than using the low-level APIAncestors
Class variables
var endpoint : str
Static methods
def upload_pkg(sdist: Path, dp_cfg: DatapaneCfg, overwrite: bool = False, **kwargs) ‑> App
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
Methods
def download_pkg(self) ‑> pathlib.Path
def call(self, env: SSDict, **params)
-
Download, install, and call the app with the provided params
def run(self, parameters: t.Dict[str, t.Any] = None, cache: bool = True) ‑> datapane.client.api.teams.Run
-
(remote) run the given app (cloning if needed?)
def local_run(self, parameters=None) ‑> datapane.client.api.teams.Run
-
(local) run the given app
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 Environment (dto: Optional[munch.Munch] = None)
-
Environments are used to set environment variables and an optional docker image for running your apps
Tip: Use the static methods to create
Environment
rather than the constructorAttributes
name
- Name of the environment
environment
- Key-value pair of environment variables
docker_image
- docker_image to be used with apps.
project
- Project name (optional and only applicable for organisations)
Ancestors
Class variables
var endpoint : str
var list_fields : List[str]
Static methods
def create(name: str, environment: Optional[dict] = None, docker_image: Optional[str] = None, project: Optional[str] = None, overwrite: bool = False) ‑> Environment
-
Create a shareable Datapane Environment with provided
name
,environment
anddocker_image
Args
name
- Name of the environment
environment
- Key-value pair of environment variables
docker_image
- docker_image to be used with apps.
project
- Project name (optional and only applicable for organisations)
overwrite
- Overwrite an existing environment
Returns
An instance of the created
Environment
object 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
Methods
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 File (dto: Optional[munch.Munch] = None)
-
Files are files that can be uploaded and downloaded for use in your apps, for instance trained models, datasets, and (pickled) Python objects. They are generally large, but can be any size.
Attributes
content_type
- the file content-type
size_bytes
- the file size
num_rows
- number of rows in the file (if a dataframe)
num_colums
- number of colums in the file (if a dataframe)
cells
- number of cells in the file (if a dataframe)
overwrite
- overwrite the file in project
Tip: Use the static methods to create
Files
rather than the constructorAncestors
Class variables
var endpoint : str
Static methods
def upload_df(df: pd.DataFrame, **kwargs) ‑> File
-
Create a file containing the dataframe provided
Args
df
- The pandas dataframe to upload as a File
Returns
An instance of the created
File
object def upload_file(fn: NPath, **kwargs) ‑> File
-
Create a file containing the contents of the file provided
Args
fn
- Path to the file to upload as a File
Returns
An instance of the created
File
object def upload_obj(data: t.Any, **kwargs) ‑> File
-
Create a file containing the contents of the Python object provided, the object may be pickled or converted to JSON before storing.
Args
data
- Python object to upload as a File
Returns
An instance of the created
File
object 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
Methods
def download_df(self) ‑> pd.DataFrame
-
Download the file and return it as a Dataframe
Returns
A pandas dataframe generated from the file
def download_file(self, fn: NPath) ‑> None
-
Download the file to the file provided
Args
fn
- Path representing the location to save the file
def download_obj(self) ‑> Any
-
Download the file and return it as a Python object
Returns
The object created by deserialising the File (either via Pickle or JSON decoding)
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 Run (dto: Optional[munch.Munch] = None)
-
Runs represent the running of a app, indicating their status, output, errors, etc.
Tip: We recommend using either the Web UI or CLI, e.g.
datapane app run / ...
to work with runs rather than the low-level APIAncestors
Class variables
var endpoint : 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
Methods
def is_complete(self) ‑> bool
-
Return true if the run has finished
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 Schedule (dto: Optional[munch.Munch] = None)
-
Runs represent the running of a app, indicating their status, output, errors, etc.
Tip: We recommend using the CLI, e.g.
datapane schedule create / ...
to work with schedules rather than the low-level APIAncestors
Class variables
var endpoint : str
var list_fields : List[str]
Static methods
def create(app: App, cron: str, parameters: SDict) ‑> Schedule
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
Methods
def update(self, cron: str = None, parameters: SDict = None) ‑> None
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