Skip to content

Commit c691af7

Browse files
authored
Merge pull request #99 from e10v/dev
Deprecate all extras
2 parents aa62a2b + 835aac6 commit c691af7

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

README.md

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,21 @@ More on the topic:
2222

2323
## Installation
2424

25-
Install the core functionality:
2625
```bash
2726
pip install rico
2827
```
2928

30-
The core functionality has no dependencies other than the standard Python packages. Optional additional dependencies are required to support the following content types:
31-
* Plots. Altair, Matplotlib Pyplot and Seaborn are currently supported.
29+
**rico** has no dependencies other than the standard Python packages.
3230

33-
Install one or several extras to use plots or Markdown in HTML documents.
34-
35-
[Altair](https://altair-viz.github.io/):
36-
```bash
37-
pip install rico[altair]
38-
```
39-
40-
[Matplotlib Pyplot](https://matplotlib.org/):
41-
```bash
42-
pip install rico[pyplot]
43-
```
44-
45-
[Seaborn](https://seaborn.pydata.org/):
46-
```bash
47-
pip install rico[seaborn]
48-
```
31+
### Deprecated
4932

50-
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.
33+
Optional additional dependencies were required to support the following content types:
34+
* Plots (`rico[altair]`, `rico[pyplot]`, `rico[seaborn]`).
35+
* Markdown (`rico[markdown]`).
5136

52-
All extras:
53-
```bash
54-
pip install rico[complete]
55-
```
56-
57-
### Deprecated
37+
The `rico[complete]` extra incudes all the dependencies above.
5838

59-
There is also the `rico[markdown]` extra. But it's no longer needed and will be removed in version 0.4.0.
39+
They are no longer needed and will be removed in version 0.4.0.
6040

6141
## User guide
6242

src/rico/_content.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io
88
from typing import TYPE_CHECKING
99
import urllib.request
10+
import warnings
1011
import xml.etree.ElementTree as ET
1112

1213
import rico._config
@@ -251,9 +252,14 @@ def __init__(
251252
"""Create an HTML element from a plot object and wrap it in a <div> container.
252253
253254
The supported plot types are the following:
254-
- Altair Chart,
255-
- Pyplot Axes and Figure,
256-
- Seaborn Plot (seaborn.objects interface).
255+
- Matplotlib Pyplot Axes and Figure,
256+
- [Deprecated] Altair Chart,
257+
- [Deprecated] Seaborn Plot (seaborn.objects interface).
258+
259+
Deprecated:
260+
Support of the Seaborn plots in this class/method is deprecated
261+
and will be removed in version 0.4.0.
262+
Use the rico.Obj or obj.append indstead.
257263
258264
Args:
259265
obj: The plot object.
@@ -277,10 +283,24 @@ def __init__(
277283
obj.savefig(stream, format=format, **kwargs)
278284
image = stream.getvalue()
279285
elif so is not None and isinstance(obj, so.Plot):
286+
warnings.warn(
287+
"Support of the Seaborn plots in this class/method is deprecated "
288+
"and will be removed in version 0.4.0. "
289+
"Use the rico.Obj or obj.append indstead.",
290+
DeprecationWarning,
291+
stacklevel=2,
292+
)
280293
stream = io.StringIO() if format == "svg" else io.BytesIO()
281294
obj.save(stream, format=format, **kwargs)
282295
image = stream.getvalue()
283296
elif alt is not None and isinstance(obj, alt.TopLevelMixin):
297+
warnings.warn(
298+
"Support of the Altair plots in this class/method is deprecated "
299+
"and will be removed in version 0.4.0. "
300+
"Use the rico.Obj or obj.append indstead.",
301+
DeprecationWarning,
302+
stacklevel=2,
303+
)
284304
convert = vlc.vegalite_to_svg if format == "svg" else vlc.vegalite_to_png # type: ignore # noqa: E501
285305
image = convert( # type: ignore
286306
obj.to_json(), # type: ignore

0 commit comments

Comments
 (0)