Skip to content

Env

ipyvizzustory.env

Environment dependent modules.

ipyvizzustory.env.st

Streamlit environment dependent modules.

story

A module for working with presentation stories in Streamlit environment.

Story

Bases: StoryLib

A class for representing a presentation story in Streamlit environment.

Source code in src/ipyvizzustory/env/st/story.py
class Story(StoryLib):
    """A class for representing a presentation story in `Streamlit` environment."""

    def __init__(self, data: Data, style: Optional[Style] = None):
        """
        Presentation Story constructor.

        Args:
            data: Data set for the whole presentation story.
                After initialization `data` can not be modified,
                but it can be filtered.
            style: Style settings for the presentation story.
                `style` can be changed at each presentation step.
        """

        super().__init__(data=data, style=style)

    def set_size(  # type: ignore  # pylint: disable=signature-differs
        self, width: int, height: int
    ) -> None:
        """
        A method for overwriting
        [storylib.story.Story.set_size][ipyvizzustory.storylib.story.Story.set_size] method.
        In `Streamlit` environment `width` and `height` must be specified in pixels.

        Args:
            width: Width of the presentation story in pixels.
            height: Height of the presentation story in pixels.

        Raises:
            ValueError: If `width` or `height` is not instance of `int`.
        """

        if any([not isinstance(width, int), not isinstance(height, int)]):
            raise ValueError("width and height should be in pixels as int")
        super().set_size(width=str(width) + "px", height=str(height) + "px")

    def play(self) -> None:
        """A method for displaying the assembled `HTML` code in `Streamlit` environment."""

        html(
            self.to_html(),
            width=int(self._size.width[:-2]),  # type: ignore
            height=int(self._size.height[:-2]),  # type: ignore
        )
__init__(data, style=None)

Presentation Story constructor.

Parameters:

Name Type Description Default
data Data

Data set for the whole presentation story. After initialization data can not be modified, but it can be filtered.

required
style Optional[Style]

Style settings for the presentation story. style can be changed at each presentation step.

None
Source code in src/ipyvizzustory/env/st/story.py
def __init__(self, data: Data, style: Optional[Style] = None):
    """
    Presentation Story constructor.

    Args:
        data: Data set for the whole presentation story.
            After initialization `data` can not be modified,
            but it can be filtered.
        style: Style settings for the presentation story.
            `style` can be changed at each presentation step.
    """

    super().__init__(data=data, style=style)
set_size(width, height)

A method for overwriting storylib.story.Story.set_size method. In Streamlit environment width and height must be specified in pixels.

Parameters:

Name Type Description Default
width int

Width of the presentation story in pixels.

required
height int

Height of the presentation story in pixels.

required

Raises:

Type Description
ValueError

If width or height is not instance of int.

Source code in src/ipyvizzustory/env/st/story.py
def set_size(  # type: ignore  # pylint: disable=signature-differs
    self, width: int, height: int
) -> None:
    """
    A method for overwriting
    [storylib.story.Story.set_size][ipyvizzustory.storylib.story.Story.set_size] method.
    In `Streamlit` environment `width` and `height` must be specified in pixels.

    Args:
        width: Width of the presentation story in pixels.
        height: Height of the presentation story in pixels.

    Raises:
        ValueError: If `width` or `height` is not instance of `int`.
    """

    if any([not isinstance(width, int), not isinstance(height, int)]):
        raise ValueError("width and height should be in pixels as int")
    super().set_size(width=str(width) + "px", height=str(height) + "px")
play()

A method for displaying the assembled HTML code in Streamlit environment.

Source code in src/ipyvizzustory/env/st/story.py
def play(self) -> None:
    """A method for displaying the assembled `HTML` code in `Streamlit` environment."""

    html(
        self.to_html(),
        width=int(self._size.width[:-2]),  # type: ignore
        height=int(self._size.height[:-2]),  # type: ignore
    )

ipyvizzustory.env.py

Python environment dependent modules.

story

A module for working with presentation stories in Python environment.

Story

Bases: StoryLib

A class for representing a presentation story in Python environment.

Source code in src/ipyvizzustory/env/py/story.py
class Story(StoryLib):
    """A class for representing a presentation story in `Python` environment."""

    def __init__(self, data: Data, style: Optional[Style] = None):
        """
        Presentation Story constructor.

        Args:
            data: Data set for the whole presentation story.
                After initialization `data` can not be modified,
                but it can be filtered.
            style: Style settings for the presentation story.
                `style` can be changed at each presentation step.
        """

        super().__init__(data=data, style=style)

    def play(self) -> str:
        """
        A method for returning the assembled `HTML` code in `Python` environment.

        Returns:
            The assembled `HTML` code as string.
        """

        return self.to_html()
__init__(data, style=None)

Presentation Story constructor.

Parameters:

Name Type Description Default
data Data

Data set for the whole presentation story. After initialization data can not be modified, but it can be filtered.

required
style Optional[Style]

Style settings for the presentation story. style can be changed at each presentation step.

None
Source code in src/ipyvizzustory/env/py/story.py
def __init__(self, data: Data, style: Optional[Style] = None):
    """
    Presentation Story constructor.

    Args:
        data: Data set for the whole presentation story.
            After initialization `data` can not be modified,
            but it can be filtered.
        style: Style settings for the presentation story.
            `style` can be changed at each presentation step.
    """

    super().__init__(data=data, style=style)
play()

A method for returning the assembled HTML code in Python environment.

Returns:

Type Description
str

The assembled HTML code as string.

Source code in src/ipyvizzustory/env/py/story.py
def play(self) -> str:
    """
    A method for returning the assembled `HTML` code in `Python` environment.

    Returns:
        The assembled `HTML` code as string.
    """

    return self.to_html()

ipyvizzustory.env.pn

Panel environment dependent modules.

story

A module for working with presentation stories in Panel environment.

Story

Bases: StoryLib

A class for representing a presentation story in Panel environment.

Source code in src/ipyvizzustory/env/pn/story.py
class Story(StoryLib):
    """A class for representing a presentation story in `Panel` environment."""

    def __init__(self, data: Data, style: Optional[Style] = None):
        """
        Presentation Story constructor.

        Args:
            data: Data set for the whole presentation story.
                After initialization `data` can not be modified,
                but it can be filtered.
            style: Style settings for the presentation story.
                `style` can be changed at each presentation step.
        """

        super().__init__(data=data, style=style)

    def play(self) -> None:
        """
        A method for displaying the assembled `HTML` code in `Panel` environment.

        Raises:
            ValueError: If `width` or `height` is not in pixel.
        """

        if any(
            [
                not StorySize.is_pixel(self._size.width),
                not StorySize.is_pixel(self._size.height),
            ]
        ):
            raise ValueError("width and height should be in pixels")

        HTML(
            self.to_html(),
            width=int(self._size.width[:-2]),  # type: ignore
            height=int(self._size.height[:-2]),  # type: ignore
        ).servable()
__init__(data, style=None)

Presentation Story constructor.

Parameters:

Name Type Description Default
data Data

Data set for the whole presentation story. After initialization data can not be modified, but it can be filtered.

required
style Optional[Style]

Style settings for the presentation story. style can be changed at each presentation step.

None
Source code in src/ipyvizzustory/env/pn/story.py
def __init__(self, data: Data, style: Optional[Style] = None):
    """
    Presentation Story constructor.

    Args:
        data: Data set for the whole presentation story.
            After initialization `data` can not be modified,
            but it can be filtered.
        style: Style settings for the presentation story.
            `style` can be changed at each presentation step.
    """

    super().__init__(data=data, style=style)
play()

A method for displaying the assembled HTML code in Panel environment.

Raises:

Type Description
ValueError

If width or height is not in pixel.

Source code in src/ipyvizzustory/env/pn/story.py
def play(self) -> None:
    """
    A method for displaying the assembled `HTML` code in `Panel` environment.

    Raises:
        ValueError: If `width` or `height` is not in pixel.
    """

    if any(
        [
            not StorySize.is_pixel(self._size.width),
            not StorySize.is_pixel(self._size.height),
        ]
    ):
        raise ValueError("width and height should be in pixels")

    HTML(
        self.to_html(),
        width=int(self._size.width[:-2]),  # type: ignore
        height=int(self._size.height[:-2]),  # type: ignore
    ).servable()

ipyvizzustory.env.ipy

Jupyter/IPython environment dependent modules.

story

A module for working with presentation stories in Jupyter/IPython environment.

Story

Bases: StoryLib

A class for representing a presentation story in Jupyter/IPython environment.

Source code in src/ipyvizzustory/env/ipy/story.py
class Story(StoryLib):
    """A class for representing a presentation story in `Jupyter`/`IPython` environment."""

    def __init__(self, data: Data, style: Optional[Style] = None):
        """
        Presentation Story constructor.

        Args:
            data: Data set for the whole presentation story.
                After initialization `data` can not be modified,
                but it can be filtered.
            style: Style settings for the presentation story.
                `style` can be changed at each presentation step.
        """

        super().__init__(data=data, style=style)

    def play(self) -> None:
        """A method for displaying the assembled `HTML` code in `Jupyter`/`IPython` environment."""

        display_html(HTML(self.to_html()))
__init__(data, style=None)

Presentation Story constructor.

Parameters:

Name Type Description Default
data Data

Data set for the whole presentation story. After initialization data can not be modified, but it can be filtered.

required
style Optional[Style]

Style settings for the presentation story. style can be changed at each presentation step.

None
Source code in src/ipyvizzustory/env/ipy/story.py
def __init__(self, data: Data, style: Optional[Style] = None):
    """
    Presentation Story constructor.

    Args:
        data: Data set for the whole presentation story.
            After initialization `data` can not be modified,
            but it can be filtered.
        style: Style settings for the presentation story.
            `style` can be changed at each presentation step.
    """

    super().__init__(data=data, style=style)
play()

A method for displaying the assembled HTML code in Jupyter/IPython environment.

Source code in src/ipyvizzustory/env/ipy/story.py
def play(self) -> None:
    """A method for displaying the assembled `HTML` code in `Jupyter`/`IPython` environment."""

    display_html(HTML(self.to_html()))