Skip to content

Commit 24d7d01

Browse files
reflect pfeed's update
1 parent 754d91e commit 24d7d01

11 files changed

Lines changed: 2014 additions & 1008 deletions

File tree

docs/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ e.g. there are also `pn.pane.Bokeh`, `pn.pane.Matplotlib`, `pn.pane.ECharts`, `p
6969
## Example
7070
Your function will look something like this:
7171
```python
72-
# tDataFrame is just a type alias for pandas, polars and dask dataframes
73-
from pfeed.types.core import tDataFrame
72+
# GenericFrame is just a type alias for pandas, polars and dask dataframes
73+
from pfeed.typing import GenericFrame
7474
from typing import Literal
7575
from pfund_plot.renderer import render
7676

7777

7878
def your_plot(
79-
data: tDataFrame,
79+
data: GenericFrame,
8080
streaming: bool = False,
8181
display_mode: Literal['notebook', 'browser', 'desktop'] = "notebook",
8282
raw_figure: bool = False, # add this if your function uses hvplot

pfund_plot/cli/commands/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import click
22

3-
from pfeed.const.enums import DataTool
3+
from pfeed.enums import DataTool
44
from pfund_plot.const.paths import PROJ_NAME
55

66

pfund_plot/plots/candlestick.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import TYPE_CHECKING
33
if TYPE_CHECKING:
44
from narwhals.typing import IntoFrame, Frame
5-
from pfeed.types.core import tDataFrame
5+
from pfeed.typing import GenericFrame
66
from pfeed.feeds.base_feed import BaseFeed
77
from pfund_plot.types.literals import tDISPLAY_MODE
88
from pfund_plot.types.core import tOutput
@@ -92,7 +92,7 @@ def _create_hover_tool(df: Frame) -> HoverTool:
9292

9393

9494
def candlestick_plot(
95-
data: tDataFrame | BaseFeed,
95+
data: GenericFrame | BaseFeed,
9696
streaming: bool = False,
9797
display_mode: tDISPLAY_MODE = "notebook",
9898
num_data: int = 100,
@@ -147,7 +147,7 @@ def candlestick_plot(
147147

148148
# Main Component: candlestick plot
149149
def _create_plot(_df: Frame, _num_data: int):
150-
plot_df: tDataFrame = _df.tail(_num_data).to_native()
150+
plot_df: GenericFrame = _df.tail(_num_data).to_native()
151151
return (
152152
plot_df
153153
.hvplot

pfund_plot/plots/dataframe.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22
from typing import TYPE_CHECKING
33
if TYPE_CHECKING:
4-
from pfeed.types.core import tDataFrame
4+
from pfeed.typing import GenericFrame
55
from pfeed.feeds.base_feed import BaseFeed
66
from pfund_plot.types.literals import tDISPLAY_MODE, tDATAFRAME_BACKEND
77
from pfund_plot.types.core import tOutput
@@ -12,7 +12,7 @@
1212
from bokeh.models.widgets.tables import DateFormatter
1313

1414
from pfund import print_warning
15-
from pfeed.etl import convert_to_pandas_df
15+
from pfeed._etl.base import convert_to_pandas_df
1616
from pfund_plot.const.enums import DisplayMode, DataType, DataFrameBackend, NotebookType
1717
from pfund_plot.utils.validate import validate_data_type
1818
from pfund_plot.utils.utils import get_notebook_type, get_sizing_mode
@@ -34,7 +34,7 @@
3434

3535
# EXTEND: maybe add some common functionalities here, e.g. search, sort, filter etc. not sure what users want for now.
3636
def dataframe_plot(
37-
data: tDataFrame | BaseFeed,
37+
data: GenericFrame | BaseFeed,
3838
display_mode: tDISPLAY_MODE = "notebook",
3939
backend: tDATAFRAME_BACKEND = "tabulator",
4040
streaming: bool = False,

pfund_plot/plots/orderbook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import TYPE_CHECKING
33
if TYPE_CHECKING:
44
from narwhals.typing import IntoFrame, Frame
5-
from pfeed.types.core import tDataFrame
5+
from pfeed.typing import GenericFrame
66
from pfeed.feeds.base_feed import BaseFeed
77
from pfund_plot.types.literals import tDISPLAY_MODE, tDATAFRAME_BACKEND
88
from pfund_plot.types.core import tOutput
@@ -19,7 +19,7 @@
1919

2020
# TODO: use perspective to plot orderbook
2121
def orderbook_plot(
22-
data: tDataFrame | BaseFeed,
22+
data: GenericFrame | BaseFeed,
2323
display_mode: tDISPLAY_MODE = 'notebook',
2424
streaming: bool = False,
2525
streaming_freq: int = 1000, # in milliseconds

pfund_plot/templates/dashboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pfeed.types.literals import tDATA_SOURCE
1+
from pfeed.typing import tDATA_SOURCE
22
from pfund_plot.templates.template import Template
33
from pfund_plot.const.enums import DashboardType
44

pfund_plot/templates/notebook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Literal
22

3-
from pfeed.types.literals import tDATA_SOURCE
3+
from pfeed.typing import tDATA_SOURCE
44
from pfund_plot.templates.template import Template
55
from pfund_plot.const.enums import NotebookType
66

pfund_plot/templates/template.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from pfeed.types.literals import tDATA_SOURCE
2-
from pfeed.const.enums import DataSource
1+
from pfeed.typing import tDATA_SOURCE
2+
from pfeed.enums import DataSource
33

44

55

pfund_plot/utils/validate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
dd = None
1212
import pandas as pd
1313

14-
from pfeed.types.core import tDataFrame, is_dataframe
14+
from pfeed.typing import GenericFrame, is_dataframe
1515
from pfeed.feeds.base_feed import BaseFeed
1616

1717
from pfund_plot.const.enums import DataType
1818

1919

20-
def _import_hvplot(data: tDataFrame | BaseFeed) -> None:
20+
def _import_hvplot(data: GenericFrame | BaseFeed) -> None:
2121
if is_dataframe(data):
2222
if isinstance(data, pd.DataFrame):
2323
import hvplot.pandas
@@ -33,7 +33,7 @@ def _import_hvplot(data: tDataFrame | BaseFeed) -> None:
3333
raise ValueError("Input data must be a dataframe or pfeed's feed object")
3434

3535

36-
def validate_data_type(data: tDataFrame | BaseFeed, streaming: bool, import_hvplot: bool = True) -> DataType:
36+
def validate_data_type(data: GenericFrame | BaseFeed, streaming: bool, import_hvplot: bool = True) -> DataType:
3737
if is_dataframe(data):
3838
data_type = DataType.dataframe
3939
elif isinstance(data, BaseFeed):

0 commit comments

Comments
 (0)