Skip to content

Commit b74a5de

Browse files
authored
fix: add information to ydataprofiling (#1716)
1 parent 8910e19 commit b74a5de

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

src/ydata_profiling/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from ydata_profiling.controller import pandas_decorator # isort:skip # noqa
1212
from ydata_profiling.profile_report import ProfileReport # isort:skip # noqa
1313
from ydata_profiling.version import __version__ # isort:skip # noqa
14+
from ydata_profiling.utils.information import display_banner
1415

1516
# backend
1617
import ydata_profiling.model.pandas # isort:skip # noqa
@@ -25,6 +26,8 @@
2526

2627
warnings.simplefilter("ignore", category=NumbaDeprecationWarning)
2728

29+
display_banner()
30+
2831
__all__ = [
2932
"pandas_decorator",
3033
"ProfileReport",
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
References and information regarding ydata-profiling and ydata-sdk
3+
"""
4+
from IPython.display import HTML, display
5+
6+
_displayed_banner = False
7+
8+
link = "https://ydata.ai/register"
9+
title = "Upgrade to ydata-sdk"
10+
info_text = "Improve your data and profiling with ydata-sdk, featuring data quality scoring, redundancy detection, outlier identification, text validation, and synthetic data generation."
11+
12+
13+
def in_jupyter_notebook() -> bool:
14+
"""Check if the code is running inside a Jupyter Notebook"""
15+
from IPython import get_ipython
16+
17+
isiPython = not get_ipython() is None
18+
return isiPython
19+
20+
21+
def display_banner() -> None:
22+
global _displayed_banner
23+
if in_jupyter_notebook() and not _displayed_banner:
24+
banner_html = f"""
25+
<div>
26+
<ins><a href="{link}">{title}</a></ins>
27+
<p>
28+
{info_text}
29+
</p>
30+
</div>
31+
"""
32+
display(HTML(banner_html))
33+
else:
34+
print(f"\033[1;34m{title}\033[0m") # noqa: T201
35+
print(info_text) # noqa: T201
36+
print(f"Register at {link}") # noqa: T201
37+
_displayed_banner = True

0 commit comments

Comments
 (0)