diff --git a/README.md b/README.md index e6cb936..03e6a0b 100644 --- a/README.md +++ b/README.md @@ -22,41 +22,21 @@ More on the topic: ## Installation -Install the core functionality: ```bash pip install rico ``` -The core functionality has no dependencies other than the standard Python packages. Optional additional dependencies are required to support the following content types: -* Plots. Altair, Matplotlib Pyplot and Seaborn are currently supported. +**rico** has no dependencies other than the standard Python packages. -Install one or several extras to use plots or Markdown in HTML documents. - -[Altair](https://altair-viz.github.io/): -```bash -pip install rico[altair] -``` - -[Matplotlib Pyplot](https://matplotlib.org/): -```bash -pip install rico[pyplot] -``` - -[Seaborn](https://seaborn.pydata.org/): -```bash -pip install rico[seaborn] -``` +### Deprecated -Install `rico[seaborn]` extra only to use the [seaborn.objects](https://seaborn.pydata.org/tutorial/objects_interface.html) interface. Otherwise install `rico[pyplot]` as the old Seaborn plotting functions return Matplotlib Pyplot Axes objects. +Optional additional dependencies were required to support the following content types: +* Plots (`rico[altair]`, `rico[pyplot]`, `rico[seaborn]`). +* Markdown (`rico[markdown]`). -All extras: -```bash -pip install rico[complete] -``` - -### Deprecated +The `rico[complete]` extra incudes all the dependencies above. -There is also the `rico[markdown]` extra. But it's no longer needed and will be removed in version 0.4.0. +They are no longer needed and will be removed in version 0.4.0. ## User guide diff --git a/src/rico/_content.py b/src/rico/_content.py index 7e4fd48..9818ce1 100644 --- a/src/rico/_content.py +++ b/src/rico/_content.py @@ -7,6 +7,7 @@ import io from typing import TYPE_CHECKING import urllib.request +import warnings import xml.etree.ElementTree as ET import rico._config @@ -251,9 +252,14 @@ def __init__( """Create an HTML element from a plot object and wrap it in a
container. The supported plot types are the following: - - Altair Chart, - - Pyplot Axes and Figure, - - Seaborn Plot (seaborn.objects interface). + - Matplotlib Pyplot Axes and Figure, + - [Deprecated] Altair Chart, + - [Deprecated] Seaborn Plot (seaborn.objects interface). + + Deprecated: + Support of the Seaborn plots in this class/method is deprecated + and will be removed in version 0.4.0. + Use the rico.Obj or obj.append indstead. Args: obj: The plot object. @@ -277,10 +283,24 @@ def __init__( obj.savefig(stream, format=format, **kwargs) image = stream.getvalue() elif so is not None and isinstance(obj, so.Plot): + warnings.warn( + "Support of the Seaborn plots in this class/method is deprecated " + "and will be removed in version 0.4.0. " + "Use the rico.Obj or obj.append indstead.", + DeprecationWarning, + stacklevel=2, + ) stream = io.StringIO() if format == "svg" else io.BytesIO() obj.save(stream, format=format, **kwargs) image = stream.getvalue() elif alt is not None and isinstance(obj, alt.TopLevelMixin): + warnings.warn( + "Support of the Altair plots in this class/method is deprecated " + "and will be removed in version 0.4.0. " + "Use the rico.Obj or obj.append indstead.", + DeprecationWarning, + stacklevel=2, + ) convert = vlc.vegalite_to_svg if format == "svg" else vlc.vegalite_to_png # type: ignore # noqa: E501 image = convert( # type: ignore obj.to_json(), # type: ignore