Skip to content

esparto._options

Info

Default options are configured through es.options, page level options can be passed to the Page constructor.

Please read the user guide for more details.

OutputOptions dataclass

Options for configuring page rendering and output.

Config options will automatically be loaded if a yaml file is found at either ./esparto-config.yaml or ~/esparto-data/esparto-config.yaml.

Attributes:

Name Type Description
dependency_source str

How dependencies should be provisioned: 'cdn' or 'inline'.

bootstrap_cdn str

Link to Bootstrap CDN. Used if dependency source is 'cdn'.

bootstrap_css str

Path to Bootstrap CSS file. Used if dependency source is 'inline'.

esparto_css str

Path to additional CSS file with esparto specific styles.

esparto_js str

Path to JavaScript file for interactive page elements.

jinja_template str

Path to Jinja HTML page template.

matplotlib MatplotlibOptions

Additional config options for Matplotlib.

plotly PlotlyOptions

Additional config options for Plotly.

bokeh BokehOptions

Additional config options for Bokeh.

yaml_loader

__init__(self, stream) special

Initialize the scanner.

Source code in esparto/_options.py
def __init__(self, stream):
    Reader.__init__(self, stream)
    Scanner.__init__(self)
    Parser.__init__(self)
    Composer.__init__(self)
    SafeConstructor.__init__(self)
    Resolver.__init__(self)

load(path) classmethod

Load config from yaml file at path.

Source code in esparto/_options.py
@classmethod
def load(cls, path: Union[str, Path]) -> "OutputOptions":
    """Load config from yaml file at `path`."""
    yaml_str = Path(path).read_text()
    opts: OutputOptions = yaml.safe_load(yaml_str)
    opts._options_source = str(path)
    return opts

save(self, path='./esparto-config.yaml')

Save config to yaml file at path.

Source code in esparto/_options.py
def save(self, path: Union[str, Path] = "./esparto-config.yaml") -> None:
    """Save config to yaml file at `path`."""
    Path(path).write_text(self._to_yaml_str())

MatplotlibOptions dataclass

Options for Matplotlib output.

Attributes:

Name Type Description
html_output_format str

How plots are rendered in HTML: 'png' or 'svg'.

notebook_format str

How plots are rendered in Jupyter Notebooks: 'png' or 'svg'.

pdf_figsize tuple or int

Specify size of Matplotlib figures in PDF output. An integer tuple can be passed as: (height, width). A float can be passed as a scaling factor.

yaml_loader

__init__(self, stream) special

Initialize the scanner.

Source code in esparto/_options.py
def __init__(self, stream):
    Reader.__init__(self, stream)
    Scanner.__init__(self)
    Parser.__init__(self)
    Composer.__init__(self)
    SafeConstructor.__init__(self)
    Resolver.__init__(self)

PlotlyOptions dataclass

Options for Plotly output.

Attributes:

Name Type Description
layout_args dict

Arguments passed to figure.update_layout() at rendering time.

yaml_loader

__init__(self, stream) special

Initialize the scanner.

Source code in esparto/_options.py
def __init__(self, stream):
    Reader.__init__(self, stream)
    Scanner.__init__(self)
    Parser.__init__(self)
    Composer.__init__(self)
    SafeConstructor.__init__(self)
    Resolver.__init__(self)

BokehOptions dataclass

Options for Bokeh output.

Attributes:

Name Type Description
layout_attributes dict

Bokeh layout object attributes to set at rendering time.

yaml_loader

__init__(self, stream) special

Initialize the scanner.

Source code in esparto/_options.py
def __init__(self, stream):
    Reader.__init__(self, stream)
    Scanner.__init__(self)
    Parser.__init__(self)
    Composer.__init__(self)
    SafeConstructor.__init__(self)
    Resolver.__init__(self)