Skip to content

Commit 36c77dd

Browse files
authored
Python docs formatting fixes (feast-dev#1473)
* Python docs formatting fixes Signed-off-by: Jacob Klegar <[email protected]> * lint Signed-off-by: Jacob Klegar <[email protected]>
1 parent 982b567 commit 36c77dd

File tree

5 files changed

+35
-42
lines changed

5 files changed

+35
-42
lines changed

sdk/python/docs/index.rst

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,24 @@ Feast Python API Documentation
33

44

55
Feature Store
6-
---------------------------
6+
==================
77

88
.. automodule:: feast.feature_store
99
:members:
10-
:undoc-members:
11-
:show-inheritance:
1210

1311
Config
1412
==================
1513

1614
.. automodule:: feast.repo_config
1715
:members:
18-
:exclude-members: load_repo_config
16+
:exclude-members: load_repo_config, FeastBaseModel
1917

2018
Data Source
2119
==================
2220

2321
.. automodule:: feast.data_source
2422
:members:
23+
:exclude-members: KafkaOptions, KafkaSource, KinesisOptions, KinesisSource
2524

2625

2726
Entity
@@ -38,12 +37,6 @@ Feature View
3837
.. automodule:: feast.feature_view
3938
:members:
4039

41-
Feature Table
42-
==================
43-
44-
.. automodule:: feast.feature_table
45-
:members:
46-
4740
Feature
4841
==================
4942

sdk/python/feast/feature.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ def __init__(self, name: str, feature_table: str):
110110
def from_proto(cls, proto: FeatureRefProto):
111111
"""
112112
Construct a feature reference from the given FeatureReference proto
113-
Arg:
113+
114+
Args:
114115
proto: Protobuf FeatureReference to construct from
115116
Returns:
116117
FeatureRef that refers to the given feature
@@ -124,6 +125,7 @@ def from_str(cls, feature_ref_str: str):
124125
String feature reference should be in the format feature_table:feature.
125126
Where "feature_table" and "name" are the feature_table name and feature name
126127
respectively.
128+
127129
Args:
128130
feature_ref_str: String representation of the feature reference
129131
Returns:
@@ -144,6 +146,7 @@ def from_str(cls, feature_ref_str: str):
144146
def to_proto(self) -> FeatureRefProto:
145147
"""
146148
Convert and return this feature table reference to protobuf.
149+
147150
Returns:
148151
Protobuf respresentation of this feature table reference.
149152
"""

sdk/python/feast/feature_store.py

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
class FeatureStore:
4242
"""
4343
A FeatureStore object is used to define, create, and retrieve features.
44+
45+
Args:
46+
repo_path: Path to a `feature_store.yaml` used to configure the feature store
47+
config (RepoConfig): Configuration object used to configure the feature store
4448
"""
4549

4650
config: RepoConfig
@@ -50,12 +54,6 @@ class FeatureStore:
5054
def __init__(
5155
self, repo_path: Optional[str] = None, config: Optional[RepoConfig] = None,
5256
):
53-
""" Initializes a new FeatureStore object. Used to manage a feature store.
54-
55-
Args:
56-
repo_path: Path to a `feature_store.yaml` used to configure the feature store
57-
config (RepoConfig): Configuration object used to configure the feature store
58-
"""
5957
if repo_path is not None and config is not None:
6058
raise ValueError("You cannot specify both repo_path and config")
6159
if config is not None:
@@ -188,11 +186,13 @@ def apply(
188186
infrastructure (e.g., create tables in an online store) in order to reflect these new definitions. All
189187
operations are idempotent, meaning they can safely be rerun.
190188
191-
Args: objects (List[Union[FeatureView, Entity]]): A list of FeatureView or Entity objects that should be
192-
registered
189+
Args:
190+
objects (List[Union[FeatureView, Entity]]): A list of FeatureView or Entity objects that should be
191+
registered
193192
194193
Examples:
195194
Register a single Entity and FeatureView.
195+
196196
>>> from feast.feature_store import FeatureStore
197197
>>> from feast import Entity, FeatureView, Feature, ValueType, FileSource
198198
>>> from datetime import timedelta
@@ -219,16 +219,16 @@ def apply(
219219
views_to_update = []
220220
for ob in objects:
221221
if isinstance(ob, FeatureView):
222-
self._registry.apply_feature_view(ob, project=self.config.project)
222+
self._registry.apply_feature_view(ob, project=self.project)
223223
views_to_update.append(ob)
224224
elif isinstance(ob, Entity):
225-
self._registry.apply_entity(ob, project=self.config.project)
225+
self._registry.apply_entity(ob, project=self.project)
226226
else:
227227
raise ValueError(
228228
f"Unknown object type ({type(ob)}) provided as part of apply() call"
229229
)
230230
self._get_provider().update_infra(
231-
project=self.config.project,
231+
project=self.project,
232232
tables_to_delete=[],
233233
tables_to_keep=views_to_update,
234234
partial=True,
@@ -263,6 +263,7 @@ def get_historical_features(
263263
264264
Examples:
265265
Retrieve historical features using a BigQuery SQL entity dataframe
266+
266267
>>> from feast.feature_store import FeatureStore
267268
>>>
268269
>>> fs = FeatureStore(config=RepoConfig(provider="gcp"))
@@ -275,9 +276,7 @@ def get_historical_features(
275276
"""
276277
self._tele.log("get_historical_features")
277278

278-
all_feature_views = self._registry.list_feature_views(
279-
project=self.config.project
280-
)
279+
all_feature_views = self._registry.list_feature_views(project=self.project)
281280
try:
282281
feature_views = _get_requested_feature_views(
283282
feature_refs, all_feature_views
@@ -319,6 +318,7 @@ def materialize_incremental(
319318
320319
Examples:
321320
Materialize all features into the online store up to 5 minutes ago.
321+
322322
>>> from datetime import datetime, timedelta
323323
>>> from feast.feature_store import FeatureStore
324324
>>>
@@ -330,13 +330,11 @@ def materialize_incremental(
330330
feature_views_to_materialize = []
331331
if feature_views is None:
332332
feature_views_to_materialize = self._registry.list_feature_views(
333-
self.config.project
333+
self.project
334334
)
335335
else:
336336
for name in feature_views:
337-
feature_view = self._registry.get_feature_view(
338-
name, self.config.project
339-
)
337+
feature_view = self._registry.get_feature_view(name, self.project)
340338
feature_views_to_materialize.append(feature_view)
341339

342340
# TODO paging large loads
@@ -378,6 +376,7 @@ def materialize(
378376
Examples:
379377
Materialize all features into the online store over the interval
380378
from 3 hours ago to 10 minutes ago.
379+
381380
>>> from datetime import datetime, timedelta
382381
>>> from feast.feature_store import FeatureStore
383382
>>>
@@ -396,13 +395,11 @@ def materialize(
396395
feature_views_to_materialize = []
397396
if feature_views is None:
398397
feature_views_to_materialize = self._registry.list_feature_views(
399-
self.config.project
398+
self.project
400399
)
401400
else:
402401
for name in feature_views:
403-
feature_view = self._registry.get_feature_view(
404-
name, self.config.project
405-
)
402+
feature_view = self._registry.get_feature_view(name, self.project)
406403
feature_views_to_materialize.append(feature_view)
407404

408405
# TODO paging large loads
@@ -445,7 +442,7 @@ def get_online_features(
445442
>>> entity_rows = [{"customer_id": 0},{"customer_id": 1}]
446443
>>>
447444
>>> online_response = store.get_online_features(
448-
>>> feature_refs, entity_rows, project="my_project")
445+
>>> feature_refs, entity_rows)
449446
>>> online_response_dict = online_response.to_dict()
450447
>>> print(online_response_dict)
451448
{'sales:daily_transactions': [1.1,1.2], 'sales:customer_id': [0,1]}
@@ -481,7 +478,7 @@ def get_online_features(
481478
result_rows.append(_entity_row_to_field_values(entity_row_proto))
482479

483480
all_feature_views = self._registry.list_feature_views(
484-
project=self.config.project, allow_cache=True
481+
project=self.project, allow_cache=True
485482
)
486483

487484
grouped_refs = _group_refs(feature_refs, all_feature_views)

sdk/python/feast/repo_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class RegistryConfig(FeastBaseModel):
4141
""" Metadata Store Configuration. Configuration that relates to reading from and writing to the Feast registry."""
4242

4343
path: StrictStr
44-
""" str: Path to metadata store. Can be a local path, or remote object storage path, e.g. gcs://foo/bar """
44+
""" str: Path to metadata store. Can be a local path, or remote object storage path, e.g. a GCS URI """
4545

4646
cache_ttl_seconds: StrictInt = 600
4747
"""int: The cache TTL is the amount of time registry state will be cached in memory. If this TTL is exceeded then
@@ -54,7 +54,7 @@ class RepoConfig(FeastBaseModel):
5454
""" Repo config. Typically loaded from `feature_store.yaml` """
5555

5656
registry: Union[StrictStr, RegistryConfig] = "data/registry.db"
57-
""" str: Path to metadata store. Can be a local path, or remote object storage path, e.g. gcs://foo/bar """
57+
""" str: Path to metadata store. Can be a local path, or remote object storage path, e.g. a GCS URI """
5858

5959
project: StrictStr
6060
""" str: Feast project id. This can be any alphanumeric string up to 16 characters.

sdk/python/tests/test_online_retrieval.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_online() -> None:
3232
join_keys=["driver"], entity_values=[ValueProto(int64_val=1)]
3333
)
3434
provider.online_write_batch(
35-
project=store.config.project,
35+
project=store.project,
3636
table=driver_locations_fv,
3737
data=[
3838
(
@@ -52,7 +52,7 @@ def test_online() -> None:
5252
join_keys=["customer"], entity_values=[ValueProto(int64_val=5)]
5353
)
5454
provider.online_write_batch(
55-
project=store.config.project,
55+
project=store.project,
5656
table=customer_profile_fv,
5757
data=[
5858
(
@@ -74,7 +74,7 @@ def test_online() -> None:
7474
entity_values=[ValueProto(int64_val=5), ValueProto(int64_val=1)],
7575
)
7676
provider.online_write_batch(
77-
project=store.config.project,
77+
project=store.project,
7878
table=customer_driver_combined_fv,
7979
data=[
8080
(
@@ -130,7 +130,7 @@ def test_online() -> None:
130130
path=store.config.registry, cache_ttl_seconds=cache_ttl
131131
),
132132
online_store=store.config.online_store,
133-
project=store.config.project,
133+
project=store.project,
134134
provider=store.config.provider,
135135
)
136136
)
@@ -189,7 +189,7 @@ def test_online() -> None:
189189
path=store.config.registry, cache_ttl_seconds=0
190190
),
191191
online_store=store.config.online_store,
192-
project=store.config.project,
192+
project=store.project,
193193
provider=store.config.provider,
194194
)
195195
)

0 commit comments

Comments
 (0)