Skip to content

Commit a541b1d

Browse files
authored
Move Python proto package into submodule (#1393)
* Move Python proto package into subdirectory Signed-off-by: Willem Pienaar <[email protected]> * Enable CI dep installation Signed-off-by: Willem Pienaar <[email protected]> * Add tensorflow types back Signed-off-by: Willem Pienaar <[email protected]>
1 parent 73a7247 commit a541b1d

34 files changed

+102
-90
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ package-protos:
4545
cp -r ${ROOT_DIR}/protos ${ROOT_DIR}/sdk/python/feast/protos
4646

4747
compile-protos-python: install-python-ci-dependencies
48-
@$(foreach dir,$(PROTO_TYPE_SUBDIRS),cd ${ROOT_DIR}/protos; python -m grpc_tools.protoc -I. --python_out=../sdk/python/ --mypy_out=../sdk/python/ feast/$(dir)/*.proto;)
49-
@$(foreach dir,$(PROTO_SERVICE_SUBDIRS),cd ${ROOT_DIR}/protos; python -m grpc_tools.protoc -I. --grpc_python_out=../sdk/python/ feast/$(dir)/*.proto;)
48+
@$(foreach dir,$(PROTO_TYPE_SUBDIRS),cd ${ROOT_DIR}/protos; python -m grpc_tools.protoc -I. --grpc_python_out=../sdk/python/feast/protos/ --python_out=../sdk/python/feast/protos/ --mypy_out=../sdk/python/feast/protos/ feast/$(dir)/*.proto;)
49+
@$(foreach dir,$(PROTO_TYPE_SUBDIRS),grep -rli 'from feast.$(dir)' sdk/python/feast/protos | xargs -i@ sed -i 's/from feast.$(dir)/from feast.protos.feast.$(dir)/g' @;)
5050
cd ${ROOT_DIR}/protos; python -m grpc_tools.protoc -I. --python_out=../sdk/python/ --mypy_out=../sdk/python/ tensorflow_metadata/proto/v0/*.proto
5151

5252
install-python: compile-protos-python

sdk/python/feast/client.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,23 @@
2626

2727
from feast.config import Config
2828
from feast.constants import ConfigOptions as opt
29-
from feast.core.CoreService_pb2 import (
29+
from feast.data_format import ParquetFormat
30+
from feast.data_source import BigQuerySource, FileSource
31+
from feast.entity import Entity
32+
from feast.feature import Feature, FeatureRef, _build_feature_references
33+
from feast.feature_table import FeatureTable
34+
from feast.grpc import auth as feast_auth
35+
from feast.grpc.grpc import create_grpc_channel
36+
from feast.loaders.ingest import (
37+
_check_field_mappings,
38+
_read_table_from_source,
39+
_upload_to_bq_source,
40+
_upload_to_file_source,
41+
_write_non_partitioned_table_from_source,
42+
_write_partitioned_table_from_source,
43+
)
44+
from feast.online_response import OnlineResponse, _infer_online_entity_rows
45+
from feast.protos.feast.core.CoreService_pb2 import (
3046
ApplyEntityRequest,
3147
ApplyEntityResponse,
3248
ApplyFeatureTableRequest,
@@ -50,29 +66,13 @@
5066
ListProjectsRequest,
5167
ListProjectsResponse,
5268
)
53-
from feast.core.CoreService_pb2_grpc import CoreServiceStub
54-
from feast.data_format import ParquetFormat
55-
from feast.data_source import BigQuerySource, FileSource
56-
from feast.entity import Entity
57-
from feast.feature import Feature, FeatureRef, _build_feature_references
58-
from feast.feature_table import FeatureTable
59-
from feast.grpc import auth as feast_auth
60-
from feast.grpc.grpc import create_grpc_channel
61-
from feast.loaders.ingest import (
62-
_check_field_mappings,
63-
_read_table_from_source,
64-
_upload_to_bq_source,
65-
_upload_to_file_source,
66-
_write_non_partitioned_table_from_source,
67-
_write_partitioned_table_from_source,
68-
)
69-
from feast.online_response import OnlineResponse, _infer_online_entity_rows
70-
from feast.registry import Registry
71-
from feast.serving.ServingService_pb2 import (
69+
from feast.protos.feast.core.CoreService_pb2_grpc import CoreServiceStub
70+
from feast.protos.feast.serving.ServingService_pb2 import (
7271
GetFeastServingInfoRequest,
7372
GetOnlineFeaturesRequestV2,
7473
)
75-
from feast.serving.ServingService_pb2_grpc import ServingServiceStub
74+
from feast.protos.feast.serving.ServingService_pb2_grpc import ServingServiceStub
75+
from feast.registry import Registry
7676
from feast.telemetry import log_usage
7777

7878
_logger = logging.getLogger(__name__)

sdk/python/feast/data_format.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
from abc import ABC, abstractmethod
1717

18-
from feast.core.DataFormat_pb2 import FileFormat as FileFormatProto
19-
from feast.core.DataFormat_pb2 import StreamFormat as StreamFormatProto
18+
from feast.protos.feast.core.DataFormat_pb2 import FileFormat as FileFormatProto
19+
from feast.protos.feast.core.DataFormat_pb2 import StreamFormat as StreamFormatProto
2020

2121

2222
class FileFormat(ABC):

sdk/python/feast/data_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import enum
1717
from typing import Dict, Optional
1818

19-
from feast.core.DataSource_pb2 import DataSource as DataSourceProto
2019
from feast.data_format import FileFormat, StreamFormat
20+
from feast.protos.feast.core.DataSource_pb2 import DataSource as DataSourceProto
2121

2222

2323
class SourceType(enum.Enum):

sdk/python/feast/entity.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
from google.protobuf.json_format import MessageToDict, MessageToJson
2020
from google.protobuf.timestamp_pb2 import Timestamp
2121

22-
from feast.core.Entity_pb2 import Entity as EntityV2Proto
23-
from feast.core.Entity_pb2 import EntityMeta as EntityMetaProto
24-
from feast.core.Entity_pb2 import EntitySpecV2 as EntitySpecProto
2522
from feast.loaders import yaml as feast_yaml
23+
from feast.protos.feast.core.Entity_pb2 import Entity as EntityV2Proto
24+
from feast.protos.feast.core.Entity_pb2 import EntityMeta as EntityMetaProto
25+
from feast.protos.feast.core.Entity_pb2 import EntitySpecV2 as EntitySpecProto
2626
from feast.value_type import ValueType
2727

2828

sdk/python/feast/feature.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414

1515
from typing import List, MutableMapping, Optional
1616

17-
from feast.core.Feature_pb2 import FeatureSpecV2 as FeatureSpecProto
18-
from feast.serving.ServingService_pb2 import FeatureReferenceV2 as FeatureRefProto
19-
from feast.types import Value_pb2 as ValueTypeProto
17+
from feast.protos.feast.core.Feature_pb2 import FeatureSpecV2 as FeatureSpecProto
18+
from feast.protos.feast.serving.ServingService_pb2 import (
19+
FeatureReferenceV2 as FeatureRefProto,
20+
)
21+
from feast.protos.feast.types import Value_pb2 as ValueTypeProto
2022
from feast.value_type import ValueType
2123

2224

sdk/python/feast/feature_table.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
from google.protobuf.json_format import MessageToDict, MessageToJson
2121
from google.protobuf.timestamp_pb2 import Timestamp
2222

23-
from feast.core.FeatureTable_pb2 import FeatureTable as FeatureTableProto
24-
from feast.core.FeatureTable_pb2 import FeatureTableMeta as FeatureTableMetaProto
25-
from feast.core.FeatureTable_pb2 import FeatureTableSpec as FeatureTableSpecProto
2623
from feast.data_source import (
2724
BigQuerySource,
2825
DataSource,
@@ -32,6 +29,13 @@
3229
)
3330
from feast.feature import Feature
3431
from feast.loaders import yaml as feast_yaml
32+
from feast.protos.feast.core.FeatureTable_pb2 import FeatureTable as FeatureTableProto
33+
from feast.protos.feast.core.FeatureTable_pb2 import (
34+
FeatureTableMeta as FeatureTableMetaProto,
35+
)
36+
from feast.protos.feast.core.FeatureTable_pb2 import (
37+
FeatureTableSpec as FeatureTableSpecProto,
38+
)
3539
from feast.value_type import ValueType
3640

3741

sdk/python/feast/feature_view.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717
from google.protobuf.duration_pb2 import Duration
1818
from google.protobuf.timestamp_pb2 import Timestamp
1919

20-
from feast.core.FeatureView_pb2 import FeatureView as FeatureViewProto
21-
from feast.core.FeatureView_pb2 import FeatureViewMeta as FeatureViewMetaProto
22-
from feast.core.FeatureView_pb2 import FeatureViewSpec as FeatureViewSpecProto
2320
from feast.data_source import BigQuerySource, DataSource, FileSource
2421
from feast.feature import Feature
22+
from feast.protos.feast.core.FeatureView_pb2 import FeatureView as FeatureViewProto
23+
from feast.protos.feast.core.FeatureView_pb2 import (
24+
FeatureViewMeta as FeatureViewMetaProto,
25+
)
26+
from feast.protos.feast.core.FeatureView_pb2 import (
27+
FeatureViewSpec as FeatureViewSpecProto,
28+
)
2529
from feast.value_type import ValueType
2630

2731

sdk/python/feast/infra/gcp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
from feast import FeatureTable, FeatureView
88
from feast.infra.provider import Provider
9+
from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
10+
from feast.protos.feast.types.Value_pb2 import Value as ValueProto
911
from feast.repo_config import DatastoreOnlineStoreConfig
10-
from feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
11-
from feast.types.Value_pb2 import Value as ValueProto
1212

1313
from .key_encoding_utils import serialize_entity_key
1414

sdk/python/feast/infra/key_encoding_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import struct
22
from typing import List, Tuple
33

4-
from feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
5-
from feast.types.Value_pb2 import Value as ValueProto
6-
from feast.types.Value_pb2 import ValueType
4+
from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
5+
from feast.protos.feast.types.Value_pb2 import Value as ValueProto
6+
from feast.protos.feast.types.Value_pb2 import ValueType
77

88

99
def _serialize_val(value_type, v: ValueProto) -> Tuple[bytes, int]:

0 commit comments

Comments
 (0)