Reports¶
Once you have built up the blocks that make up your report, you can use the following methods to save it as a local report.
import arakawa as ar
report = ar.Report(ar.Text("Hello, world!"))
report.save("report.html")
# or
report.stringify()
Report
¶
App documents collate plots, text, tables, and files into an interactive document that can be analyzed and shared by users in their browser
save
¶
Save a report as an HTML file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
A file path to store the document. |
required |
open
|
bool
|
Open in your browser after creating. Default to False. |
False
|
name
|
str | None
|
A name of a report. Optional. Uses path if not provided. |
None
|
formatting
|
Formatting | None
|
Sets the basic app styling. |
None
|
cdn_base
|
str | None
|
Base URL of CDN. Defaults to None. |
None
|
standalone
|
bool
|
Whether or not to inline assets in an HTML instead of loading via CDN or not. Defaults to False. |
False
|
stringify
¶
Stringify a report as an HTML string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str | None
|
A name of a report. Optional. Uses path if not provided. |
None
|
formatting
|
Formatting | None
|
Sets the basic app styling. |
None
|
cdn_base
|
str | None
|
Base URL of CDN. Defaults to None. |
None
|
resizable
|
bool
|
Wether or not to allow make an iframed report resizable or not. Defaults to True. |
True
|
standalone
|
bool
|
Whether or not to inline assets in an HTML instead of loading via CDN or not. Defaults to False. |
False
|
Alternatively, you can use the following functions to save or stringify a report or blocks.
save_report
¶
Save a report as an HTML file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
blocks
|
BlocksT
|
A |
required |
path
|
str
|
A file path to store the document. |
required |
open
|
bool
|
Open in your browser after creating. Default to False. |
False
|
name
|
str | None
|
A name of a report. Optional. Uses path if not provided. |
None
|
formatting
|
Formatting | None
|
Sets the basic app styling. |
None
|
cdn_base
|
str | None
|
Base URL of CDN. Defaults to None. |
None
|
standalone
|
bool
|
Whether or not to inline assets in an HTML instead of loading via CDN or not. Defaults to False. |
False
|
stringify_report
¶
Stringify a report as an HTML string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
blocks
|
BlocksT
|
A |
required |
name
|
str | None
|
A name of a report. Optional. Uses path if not provided. |
None
|
formatting
|
Formatting | None
|
Sets the basic app styling. |
None
|
cdn_base
|
str | None
|
Base URL of CDN. Defaults to None. |
None
|
resizable
|
bool
|
Wether or not to allow make an iframed report resizable or not. Defaults to True. |
True
|
standalone
|
bool
|
Whether or not to inline assets in an HTML instead of loading via CDN or not. Defaults to False. |
False
|
Standalone Mode¶
A report uses CDN (jsDelivr) to load assets by default.
As an alternative, you can use standalone mode which inlines assets in a report.
Note
Inlining assets significantly increases the size of a report. The size can exceed 20MB.
In-House CDN¶
There is an option to use an in-house CDN by configuring CDN URL via AR_CDN_BASE
environment variable (defaults to https://cdn.jsdelivr.net/npm/arakawa@{VERSION)/dist
).
- Download frontend assets via jsDelivr or NPM:
- https://www.jsdelivr.com/package/npm/arakawa
- https://www.npmjs.com/package/arakawa (
npm pack arakawa
to download)
- Unpack it and upload files into your CDN (e.g. S3 or S3-like object storage)