Skip to content

Commit 92785b8

Browse files
chore: Widen dependencies (feast-dev#2928)
* Widen dependencies. This should make it easier to install Feast alongside other Python packages. Signed-off-by: Abhin Chhabra <chhabra.abhin@gmail.com> Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Exclude embedded_go/lib from black Signed-off-by: Abhin Chhabra <chhabra.abhin@gmail.com> Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Generate lockfiles for Python3.9 and Python 3.10 Signed-off-by: Abhin Chhabra <chhabra.abhin@gmail.com> Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Switch to `google-cloud-bigquery[pandas]`. This was covered in feast-dev#2537. I've only generated lockfiles for Python 3.8 to test this in CI. I'll do the same for the rest of the Python versions later. Signed-off-by: Abhin Chhabra <abhin.chhabra@shopify.com> Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Fix Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Update 3.9 reqs Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * UPdate 3.10 Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Fix Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Fix Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Fix lint Signed-off-by: Kevin Zhang <kzhang@tecton.ai> * Fix dependencies Signed-off-by: Kevin Zhang <kzhang@tecton.ai> Co-authored-by: Kevin Zhang <kzhang@tecton.ai>
1 parent 3e3489c commit 92785b8

File tree

98 files changed

+845
-369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+845
-369
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ exclude = '''
2525
| pb2.py
2626
| \.pyi
2727
| protos
28+
| sdk/python/feast/embedded_go/lib
2829
)/
2930
)
3031
'''

sdk/python/feast/cli.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,10 @@ def registry_dump_command(ctx: click.Context):
524524
@click.argument("start_ts")
525525
@click.argument("end_ts")
526526
@click.option(
527-
"--views", "-v", help="Feature views to materialize", multiple=True,
527+
"--views",
528+
"-v",
529+
help="Feature views to materialize",
530+
multiple=True,
528531
)
529532
@click.pass_context
530533
def materialize_command(
@@ -551,7 +554,10 @@ def materialize_command(
551554
@cli.command("materialize-incremental")
552555
@click.argument("end_ts")
553556
@click.option(
554-
"--views", "-v", help="Feature views to incrementally materialize", multiple=True,
557+
"--views",
558+
"-v",
559+
help="Feature views to incrementally materialize",
560+
multiple=True,
555561
)
556562
@click.pass_context
557563
def materialize_incremental_command(ctx: click.Context, end_ts: str, views: List[str]):
@@ -622,10 +628,14 @@ def init_command(project_directory, minimal: bool, template: str):
622628
help="Specify a server type: 'http' or 'grpc' [default: http]",
623629
)
624630
@click.option(
625-
"--no-access-log", is_flag=True, help="Disable the Uvicorn access log.",
631+
"--no-access-log",
632+
is_flag=True,
633+
help="Disable the Uvicorn access log.",
626634
)
627635
@click.option(
628-
"--no-feature-log", is_flag=True, help="Disable logging served features",
636+
"--no-feature-log",
637+
is_flag=True,
638+
help="Disable logging served features",
629639
)
630640
@click.pass_context
631641
def serve_command(
@@ -771,13 +781,19 @@ def disable_alpha_features(ctx: click.Context):
771781

772782
@cli.command("validate")
773783
@click.option(
774-
"--feature-service", "-f", help="Specify a feature service name",
784+
"--feature-service",
785+
"-f",
786+
help="Specify a feature service name",
775787
)
776788
@click.option(
777-
"--reference", "-r", help="Specify a validation reference name",
789+
"--reference",
790+
"-r",
791+
help="Specify a validation reference name",
778792
)
779793
@click.option(
780-
"--no-profile-cache", is_flag=True, help="Do not store cached profile in registry",
794+
"--no-profile-cache",
795+
is_flag=True,
796+
help="Do not store cached profile in registry",
781797
)
782798
@click.argument("start_ts")
783799
@click.argument("end_ts")

sdk/python/feast/data_source.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ class KinesisOptions:
116116
"""
117117

118118
def __init__(
119-
self, record_format: StreamFormat, region: str, stream_name: str,
119+
self,
120+
record_format: StreamFormat,
121+
region: str,
122+
stream_name: str,
120123
):
121124
self.record_format = record_format
122125
self.region = region

sdk/python/feast/diff/infra_diff.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ def diff_infra_protos(
126126
infra_objects_to_delete,
127127
infra_objects_to_add,
128128
) = tag_infra_proto_objects_for_keep_delete_add(
129-
current_infra_objects, new_infra_objects,
129+
current_infra_objects,
130+
new_infra_objects,
130131
)
131132

132133
for e in infra_objects_to_add:
@@ -199,5 +200,10 @@ def diff_between(
199200
)
200201
)
201202
return InfraObjectDiff(
202-
new.name, infra_object_type, current, new, property_diffs, transition,
203+
new.name,
204+
infra_object_type,
205+
current,
206+
new,
207+
property_diffs,
208+
transition,
203209
)

sdk/python/feast/diff/registry_diff.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ def diff_registry_objects(
161161

162162

163163
def extract_objects_for_keep_delete_update_add(
164-
registry: BaseRegistry, current_project: str, desired_repo_contents: RepoContents,
164+
registry: BaseRegistry,
165+
current_project: str,
166+
desired_repo_contents: RepoContents,
165167
) -> Tuple[
166168
Dict[FeastObjectType, Set[FeastObject]],
167169
Dict[FeastObjectType, Set[FeastObject]],
@@ -208,7 +210,9 @@ def extract_objects_for_keep_delete_update_add(
208210

209211

210212
def diff_between(
211-
registry: BaseRegistry, current_project: str, desired_repo_contents: RepoContents,
213+
registry: BaseRegistry,
214+
current_project: str,
215+
desired_repo_contents: RepoContents,
212216
) -> RegistryDiff:
213217
"""
214218
Returns the difference between the current and desired repo states.
@@ -305,12 +309,16 @@ def apply_diff_to_registry(
305309
BaseFeatureView, feast_object_diff.current_feast_object
306310
)
307311
registry.delete_feature_view(
308-
feature_view_obj.name, project, commit=False,
312+
feature_view_obj.name,
313+
project,
314+
commit=False,
309315
)
310316
elif feast_object_diff.feast_object_type == FeastObjectType.DATA_SOURCE:
311317
ds_obj = cast(DataSource, feast_object_diff.current_feast_object)
312318
registry.delete_data_source(
313-
ds_obj.name, project, commit=False,
319+
ds_obj.name,
320+
project,
321+
commit=False,
314322
)
315323

316324
if feast_object_diff.transition_type in [

sdk/python/feast/driver_test_data.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ def _convert_event_timestamp(event_timestamp: pd.Timestamp, t: EventTimestampTyp
3030

3131

3232
def create_orders_df(
33-
customers, drivers, start_date, end_date, order_count, locations=None,
33+
customers,
34+
drivers,
35+
start_date,
36+
end_date,
37+
order_count,
38+
locations=None,
3439
) -> pd.DataFrame:
3540
"""
3641
Example df generated by this function (if locations):

sdk/python/feast/embedded_go/online_features_service.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def __init__(
5050
)
5151

5252
self._service = NewOnlineFeatureService(
53-
self._config, self._transformation_callback,
53+
self._config,
54+
self._transformation_callback,
5455
)
5556

5657
# This should raise an exception if there were any errors in NewOnlineFeatureService.
@@ -263,7 +264,9 @@ def transformation_callback(
263264

264265

265266
def logging_callback(
266-
fs: "FeatureStore", feature_service_name: str, dataset_dir: str,
267+
fs: "FeatureStore",
268+
feature_service_name: str,
269+
dataset_dir: str,
267270
) -> bytes:
268271
feature_service = fs.get_feature_service(feature_service_name, allow_cache=True)
269272
try:

sdk/python/feast/feature.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ class Feature:
3030
"""
3131

3232
def __init__(
33-
self, name: str, dtype: ValueType, labels: Optional[Dict[str, str]] = None,
33+
self,
34+
name: str,
35+
dtype: ValueType,
36+
labels: Optional[Dict[str, str]] = None,
3437
):
3538
"""Creates a Feature object."""
3639
self._name = name
@@ -91,7 +94,9 @@ def to_proto(self) -> FeatureSpecProto:
9194
value_type = ValueTypeProto.Enum.Value(self.dtype.name)
9295

9396
return FeatureSpecProto(
94-
name=self.name, value_type=value_type, tags=self.labels,
97+
name=self.name,
98+
value_type=value_type,
99+
tags=self.labels,
95100
)
96101

97102
@classmethod

sdk/python/feast/feature_logging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ class LoggingSource:
3434

3535
@abc.abstractmethod
3636
def get_schema(self, registry: "BaseRegistry") -> pa.Schema:
37-
""" Generate schema for logs destination. """
37+
"""Generate schema for logs destination."""
3838
raise NotImplementedError
3939

4040
@abc.abstractmethod
4141
def get_log_timestamp_column(self) -> str:
42-
""" Return timestamp column that must exist in generated schema. """
42+
"""Return timestamp column that must exist in generated schema."""
4343
raise NotImplementedError
4444

4545

sdk/python/feast/feature_store.py

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ class FeatureStore:
118118

119119
@log_exceptions
120120
def __init__(
121-
self, repo_path: Optional[str] = None, config: Optional[RepoConfig] = None,
121+
self,
122+
repo_path: Optional[str] = None,
123+
config: Optional[RepoConfig] = None,
122124
):
123125
"""
124126
Creates a FeatureStore object.
@@ -253,7 +255,9 @@ def list_request_feature_views(
253255
)
254256

255257
def _list_feature_views(
256-
self, allow_cache: bool = False, hide_dummy_entity: bool = True,
258+
self,
259+
allow_cache: bool = False,
260+
hide_dummy_entity: bool = True,
257261
) -> List[FeatureView]:
258262
feature_views = []
259263
for fv in self._registry.list_feature_views(
@@ -266,7 +270,9 @@ def _list_feature_views(
266270
return feature_views
267271

268272
def _list_stream_feature_views(
269-
self, allow_cache: bool = False, hide_dummy_entity: bool = True,
273+
self,
274+
allow_cache: bool = False,
275+
hide_dummy_entity: bool = True,
270276
) -> List[StreamFeatureView]:
271277
stream_feature_views = []
272278
for sfv in self._registry.list_stream_feature_views(
@@ -480,7 +486,9 @@ def delete_feature_service(self, name: str):
480486
return self._registry.delete_feature_service(name, self.project)
481487

482488
def _get_features(
483-
self, features: Union[List[str], FeatureService], allow_cache: bool = False,
489+
self,
490+
features: Union[List[str], FeatureService],
491+
allow_cache: bool = False,
484492
) -> List[str]:
485493
_features = features
486494

@@ -589,7 +597,8 @@ def _make_inferences(
589597
feature_service.infer_features(fvs_to_update=fvs_to_update_map)
590598

591599
def _get_feature_views_to_materialize(
592-
self, feature_views: Optional[List[str]],
600+
self,
601+
feature_views: Optional[List[str]],
593602
) -> List[FeatureView]:
594603
"""
595604
Returns the list of feature views that should be materialized.
@@ -1069,7 +1078,8 @@ def get_historical_features(
10691078
for feature_name in odfv_request_data_schema.keys():
10701079
if feature_name not in entity_df.columns:
10711080
raise RequestDataNotFoundInEntityDfException(
1072-
feature_name=feature_name, feature_view_name=odfv.name,
1081+
feature_name=feature_name,
1082+
feature_view_name=odfv.name,
10731083
)
10741084

10751085
_validate_feature_refs(_feature_refs, full_feature_names)
@@ -1182,7 +1192,9 @@ def get_saved_dataset(self, name: str) -> SavedDataset:
11821192

11831193
@log_exceptions_and_usage
11841194
def materialize_incremental(
1185-
self, end_date: datetime, feature_views: Optional[List[str]] = None,
1195+
self,
1196+
end_date: datetime,
1197+
feature_views: Optional[List[str]] = None,
11861198
) -> None:
11871199
"""
11881200
Materialize incremental new data from the offline store into the online store.
@@ -1264,7 +1276,10 @@ def tqdm_builder(length):
12641276
)
12651277

12661278
self._registry.apply_materialization(
1267-
feature_view, self.project, start_date, end_date,
1279+
feature_view,
1280+
self.project,
1281+
start_date,
1282+
end_date,
12681283
)
12691284

12701285
@log_exceptions_and_usage
@@ -1336,7 +1351,10 @@ def tqdm_builder(length):
13361351
)
13371352

13381353
self._registry.apply_materialization(
1339-
feature_view, self.project, start_date, end_date,
1354+
feature_view,
1355+
self.project,
1356+
start_date,
1357+
end_date,
13401358
)
13411359

13421360
@log_exceptions_and_usage
@@ -1439,8 +1457,8 @@ def write_to_offline_store(
14391457
)
14401458

14411459
# Get columns of the batch source and the input dataframe.
1442-
column_names_and_types = feature_view.batch_source.get_table_column_names_and_types(
1443-
self.config
1460+
column_names_and_types = (
1461+
feature_view.batch_source.get_table_column_names_and_types(self.config)
14441462
)
14451463
source_columns = [column for column, _ in column_names_and_types]
14461464
input_columns = df.columns.values.tolist()
@@ -1701,12 +1719,17 @@ def _get_online_features(
17011719
for table, requested_features in grouped_refs:
17021720
# Get the correct set of entity values with the correct join keys.
17031721
table_entity_values, idxs = self._get_unique_entities(
1704-
table, join_key_values, entity_name_to_join_key_map,
1722+
table,
1723+
join_key_values,
1724+
entity_name_to_join_key_map,
17051725
)
17061726

17071727
# Fetch feature data for the minimum set of Entities.
17081728
feature_data = self._read_from_online_store(
1709-
table_entity_values, provider, requested_features, table,
1729+
table_entity_values,
1730+
provider,
1731+
requested_features,
1732+
table,
17101733
)
17111734

17121735
# Populate the result_rows with the Features from the OnlineStore inplace.
@@ -1875,7 +1898,9 @@ def _get_unique_entities(
18751898
"""
18761899
# Get the correct set of entity values with the correct join keys.
18771900
table_entity_values = self._get_table_entity_values(
1878-
table, entity_name_to_join_key_map, join_key_values,
1901+
table,
1902+
entity_name_to_join_key_map,
1903+
join_key_values,
18791904
)
18801905

18811906
# Convert back to rowise.
@@ -2060,7 +2085,8 @@ def _augment_response_with_on_demand_transforms(
20602085
for odfv_name, _feature_refs in odfv_feature_refs.items():
20612086
odfv = requested_odfv_map[odfv_name]
20622087
transformed_features_df = odfv.get_transformed_features_df(
2063-
initial_response_df, full_feature_names,
2088+
initial_response_df,
2089+
full_feature_names,
20642090
)
20652091
selected_subset = [
20662092
f for f in transformed_features_df.columns if f in _feature_refs
@@ -2117,9 +2143,7 @@ def _get_feature_views_to_use(
21172143
features: Optional[Union[List[str], FeatureService]],
21182144
allow_cache=False,
21192145
hide_dummy_entity: bool = True,
2120-
) -> Tuple[
2121-
List[FeatureView], List[RequestFeatureView], List[OnDemandFeatureView],
2122-
]:
2146+
) -> Tuple[List[FeatureView], List[RequestFeatureView], List[OnDemandFeatureView]]:
21232147

21242148
fvs = {
21252149
fv.name: fv
@@ -2364,10 +2388,10 @@ def get_validation_reference(
23642388
self, name: str, allow_cache: bool = False
23652389
) -> ValidationReference:
23662390
"""
2367-
Retrieves a validation reference.
2391+
Retrieves a validation reference.
23682392
2369-
Raises:
2370-
ValidationReferenceNotFoundException: The validation reference could not be found.
2393+
Raises:
2394+
ValidationReferenceNotFoundException: The validation reference could not be found.
23712395
"""
23722396
ref = self._registry.get_validation_reference(
23732397
name, project=self.project, allow_cache=allow_cache

0 commit comments

Comments
 (0)