Skip to content

Commit fbdd5fc

Browse files
chore: Fix typing (feast-dev#2534)
* Remove Array, Float32, etc. as top-level imports Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix type imports in docs Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix type imports in templates Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix type imports in tests Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix doctests Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Format Signed-off-by: Felix Wang <wangfelix98@gmail.com>
1 parent eefc34a commit fbdd5fc

File tree

22 files changed

+50
-73
lines changed

22 files changed

+50
-73
lines changed

docs/getting-started/concepts/feature-view.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ A feature view is an object that represents a logical group of time-series featu
77
{% tabs %}
88
{% tab title="driver_trips_feature_view.py" %}
99
```python
10-
from feast import BigQuerySource, FeatureView, Field, Float32, Int64
10+
from feast import BigQuerySource, FeatureView, Field
11+
from feast.types import Float32, Int64
1112

1213
driver_stats_fv = FeatureView(
1314
name="driver_activity",
@@ -41,7 +42,8 @@ If a feature view contains features that are not related to a specific entity, t
4142
{% tabs %}
4243
{% tab title="global_stats.py" %}
4344
```python
44-
from feast import BigQuerySource, FeatureView, Field, Int64
45+
from feast import BigQuerySource, FeatureView, Field
46+
from feast.types import Int64
4547

4648
global_stats_fv = FeatureView(
4749
name="global_stats",
@@ -74,7 +76,8 @@ It is suggested that you dynamically specify the new FeatureView name using `.wi
7476
{% tabs %}
7577
{% tab title="location_stats_feature_view.py" %}
7678
```python
77-
from feast import BigQuerySource, Entity, FeatureView, Field, Int32, ValueType
79+
from feast import BigQuerySource, Entity, FeatureView, Field, ValueType
80+
from feast.types import Int32
7881

7982
location = Entity(name="location", join_key="location_id", value_type=ValueType.INT64)
8083

@@ -121,7 +124,8 @@ A feature is an individual measurable property. It is typically a property obser
121124
Features are defined as part of feature views. Since Feast does not transform data, a feature is essentially a schema that only contains a name and a type:
122125

123126
```python
124-
from feast import Field, Float32
127+
from feast import Field
128+
from feast.types import Float32
125129

126130
trips_today = Field(
127131
name="trips_today",
@@ -138,7 +142,8 @@ Feature names must be unique within a [feature view](feature-view.md#feature-vie
138142
On demand feature views allows users to use existing features and request time data (features only available at request time) to transform and create new features. Users define python transformation logic which is executed in both historical retrieval and online retrieval paths:
139143

140144
```python
141-
from feast import Field, Float64, RequestSource
145+
from feast import Field, RequestSource
146+
from feast.types import Float64
142147

143148
# Define a request data source which encodes features / information only
144149
# available at request time (e.g. part of the user initiated HTTP request)

docs/getting-started/concepts/point-in-time-joins.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Feature values in Feast are modeled as time-series records. Below is an example
77
The above table can be registered with Feast through the following feature view:
88

99
```python
10-
from feast import FeatureView, Field, FileSource, Float32, Int64
10+
from feast import FeatureView, Field, FileSource
11+
from feast.types import Float32, Int64
1112

1213
driver_stats_fv = FeatureView(
1314
name="driver_hourly_stats",

docs/getting-started/quickstart.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ online_store:
8282

8383
from datetime import timedelta
8484

85-
from feast import Entity, FeatureView, Field, FileSource, Float32, Int64, ValueType
85+
from feast import Entity, FeatureView, Field, FileSource, ValueType
86+
from feast.types import Float32, Int64
8687

8788
# Read data from parquet files. Parquet is convenient for local development mode. For
8889
# production, you can use your favorite DWH, such as BigQuery. See Feast documentation
@@ -151,7 +152,8 @@ feast apply
151152

152153
from datetime import timedelta
153154

154-
from feast import Entity, FeatureView, Field, FileSource, Float32, Int64, ValueType
155+
from feast import Entity, FeatureView, Field, FileSource, ValueType
156+
from feast.types import Float32, Int64
155157

156158
# Read data from parquet files. Parquet is convenient for local development mode. For
157159
# production, you can use your favorite DWH, such as BigQuery. See Feast documentation

docs/reference/alpha-on-demand-feature-view.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ See [https://github.com/feast-dev/on-demand-feature-views-demo](https://github.c
2828
We register `RequestDataSource` inputs and the transform in `on_demand_feature_view`:
2929

3030
```python
31-
from feast import Field, Float64, RequestSource
31+
from feast import Field, RequestSource
32+
from feast.types import Float64
3233

3334
# Define a request data source which encodes features / information only
3435
# available at request time (e.g. part of the user initiated HTTP request)

docs/reference/data-sources/push.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ When using a PushSource as a stream source in the definition of a feature view,
1414
### Defining a push source
1515

1616
```python
17-
from feast import PushSource, ValueType, BigQuerySource, FeatureView, Feature, Field, Int64
17+
from feast import PushSource, ValueType, BigQuerySource, FeatureView, Feature, Field
18+
from feast.types import Int64
1819

1920
push_source = PushSource(
2021
name="push_source",

docs/reference/feature-repository.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ A feature repository can also contain one or more Python files that contain feat
8989
```python
9090
from datetime import timedelta
9191
92-
from feast import BigQuerySource, Entity, Feature, FeatureView, Field, Float32, String, ValueType
92+
from feast import BigQuerySource, Entity, Feature, FeatureView, Field, ValueType
93+
from feast.types import Float32, String
9394
9495
driver_locations_source = BigQuerySource(
9596
table_ref="rh_prod.ride_hailing_co.drivers",

docs/reference/feature-repository/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ A feature repository can also contain one or more Python files that contain feat
9494
```python
9595
from datetime import timedelta
9696
97-
from feast import BigQuerySource, Entity, Feature, FeatureView, Field, Float32, String, ValueType
97+
from feast import BigQuerySource, Entity, Feature, FeatureView, Field, ValueType
98+
from feast.types import Float32, String
9899
99100
driver_locations_source = BigQuerySource(
100101
table_ref="rh_prod.ride_hailing_co.drivers",

docs/tutorials/validating-historical-features.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ pyarrow.parquet.write_table(entities_2019_table, "entities.parquet")
107107
import pyarrow.parquet
108108
import pandas as pd
109109

110-
from feast import FeatureView, Entity, FeatureStore, Field, Float64, Int64
110+
from feast import FeatureView, Entity, FeatureStore, Field
111+
from feast.types import Float64, Int64
111112
from feast.value_type import ValueType
112113
from feast.data_format import ParquetFormat
113114
from feast.on_demand_feature_view import on_demand_feature_view

sdk/python/feast/__init__.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@
1717
from .on_demand_feature_view import OnDemandFeatureView
1818
from .repo_config import RepoConfig
1919
from .request_feature_view import RequestFeatureView
20-
from .types import (
21-
Array,
22-
Bool,
23-
Bytes,
24-
Float32,
25-
Float64,
26-
Int32,
27-
Int64,
28-
Invalid,
29-
String,
30-
UnixTimestamp,
31-
)
3220
from .value_type import ValueType
3321

3422
logging.basicConfig(
@@ -62,15 +50,4 @@
6250
"RequestFeatureView",
6351
"SnowflakeSource",
6452
"PushSource",
65-
# Types
66-
"Array",
67-
"Invalid",
68-
"Bytes",
69-
"String",
70-
"Bool",
71-
"Int32",
72-
"Int64",
73-
"Float32",
74-
"Float64",
75-
"UnixTimestamp",
7653
]

sdk/python/feast/templates/aws/driver_repo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import timedelta
22

3-
from feast import Entity, FeatureView, Field, Float32, Int64, RedshiftSource, ValueType
3+
from feast import Entity, FeatureView, Field, RedshiftSource, ValueType
4+
from feast.types import Float32, Int64
45

56
# Define an entity for the driver. Entities can be thought of as primary keys used to
67
# retrieve features. Entities are also used to join multiple tables/views during the

0 commit comments

Comments
 (0)