Skip to content

Commit 662f867

Browse files
authored
Enable isort for Python SDK (#843)
* Enable isort for Python SDK * Allow isort to distinguish first and third party modules * Allow isort to distinguish first and third party modules in e2e tests
1 parent cf5ed2d commit 662f867

File tree

12 files changed

+19
-13
lines changed

12 files changed

+19
-13
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,12 @@ format-python:
7979

8080
lint-python:
8181
cd ${ROOT_DIR}/sdk/python; mypy feast/ tests/
82+
cd ${ROOT_DIR}/sdk/python; isort -rc feast tests --check-only
8283
cd ${ROOT_DIR}/sdk/python; flake8 feast/ tests/
8384
cd ${ROOT_DIR}/sdk/python; black --check feast tests
8485

8586
cd ${ROOT_DIR}/tests/e2e; mypy bq/ redis/
87+
cd ${ROOT_DIR}/tests/e2e; isort -rc . --check-only
8688
cd ${ROOT_DIR}/tests/e2e; flake8 .
8789
cd ${ROOT_DIR}/tests/e2e; black --check .
8890

sdk/python/feast/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import pyarrow as pa
3030
import pyarrow.parquet as pq
3131
from google.protobuf.timestamp_pb2 import Timestamp
32+
from tensorflow_metadata.proto.v0 import statistics_pb2
3233

3334
import feast.grpc.auth as feast_auth
3435
from feast.config import Config
@@ -86,7 +87,6 @@
8687
GetOnlineFeaturesResponse,
8788
)
8889
from feast.serving.ServingService_pb2_grpc import ServingServiceStub
89-
from tensorflow_metadata.proto.v0 import statistics_pb2
9090

9191
_logger = logging.getLogger(__name__)
9292

sdk/python/feast/feature_set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from google.protobuf.timestamp_pb2 import Timestamp
2626
from pandas.api.types import is_datetime64_ns_dtype
2727
from pyarrow.lib import TimestampType
28+
from tensorflow_metadata.proto.v0 import schema_pb2
2829

2930
from feast.core.FeatureSet_pb2 import FeatureSet as FeatureSetProto
3031
from feast.core.FeatureSet_pb2 import FeatureSetMeta as FeatureSetMetaProto
@@ -41,7 +42,6 @@
4142
pa_to_feast_value_type,
4243
python_type_to_feast_value_type,
4344
)
44-
from tensorflow_metadata.proto.v0 import schema_pb2
4545

4646

4747
class FeatureSet:

sdk/python/feast/field.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
from collections import OrderedDict
1515
from typing import MutableMapping, Optional, Union
1616

17+
from tensorflow_metadata.proto.v0 import schema_pb2
18+
1719
from feast.core.FeatureSet_pb2 import FeatureSpec
1820
from feast.value_type import ValueType
19-
from tensorflow_metadata.proto.v0 import schema_pb2
2021

2122

2223
class Field:

sdk/python/feast/job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import fastavro
55
import pandas as pd
66
from google.protobuf.json_format import MessageToJson
7+
from tensorflow_metadata.proto.v0 import statistics_pb2
78

89
from feast.constants import CONFIG_TIMEOUT_KEY
910
from feast.constants import FEAST_DEFAULT_OPTIONS as defaults
@@ -23,7 +24,6 @@
2324
from feast.source import Source
2425
from feast.staging.storage_client import get_staging_client
2526
from feast.wait import wait_retry_backoff
26-
from tensorflow_metadata.proto.v0 import statistics_pb2
2727

2828
# Maximum no of seconds to wait until the retrieval jobs status is DONE in Feast
2929
# Currently set to the maximum query execution time limit in BigQuery

sdk/python/setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ force_grid_wrap=0
55
use_parentheses=True
66
line_length=88
77
skip=feast/types,feast/core,feast/serving,feast/storage
8+
known_first_party=feast,feast_serving_server,feast_core_server
9+
default_section=THIRDPARTY
810

911
[flake8]
1012
ignore = E203, E266, E501, W503

sdk/python/tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from datetime import datetime
2020
from unittest import mock
2121

22+
import dataframes
2223
import grpc
2324
import pandas as pd
2425
import pandavro
@@ -27,7 +28,6 @@
2728
from mock import MagicMock, patch
2829
from pytz import timezone
2930

30-
import dataframes
3131
import feast.core.CoreService_pb2_grpc as Core
3232
import feast.serving.ServingService_pb2_grpc as Serving
3333
from feast.client import Client

sdk/python/tests/test_feature_set.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
from concurrent import futures
1818
from datetime import datetime
1919

20+
import dataframes
2021
import grpc
2122
import pandas as pd
2223
import pytest
2324
import pytz
2425
from google.protobuf import json_format
26+
from tensorflow_metadata.proto.v0 import schema_pb2
2527

26-
import dataframes
2728
import feast.core.CoreService_pb2_grpc as Core
2829
from feast.client import Client
2930
from feast.entity import Entity
@@ -35,7 +36,6 @@
3536
)
3637
from feast.value_type import ValueType
3738
from feast_core_server import CoreServicer
38-
from tensorflow_metadata.proto.v0 import schema_pb2
3939

4040
CORE_URL = "core.feast.local"
4141
SERVING_URL = "serving.feast.local"

tests/e2e/bq/bq-batch-retrieval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
import pandas as pd
1111
import pytest
1212
import pytz
13+
import tensorflow_data_validation as tfdv
14+
from bq.testutils import assert_stats_equal, clear_unsupported_fields
1315
from google.cloud import bigquery, storage
1416
from google.cloud.storage import Blob
1517
from google.protobuf.duration_pb2 import Duration
1618
from pandavro import to_avro
1719

18-
import tensorflow_data_validation as tfdv
19-
from bq.testutils import assert_stats_equal, clear_unsupported_fields
2020
from feast.client import Client
2121
from feast.core.CoreService_pb2 import ListStoresRequest
2222
from feast.core.IngestionJob_pb2 import IngestionJobStatus

tests/e2e/bq/feature-stats.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
import pandas as pd
77
import pytest
88
import pytz
9-
from google.protobuf.duration_pb2 import Duration
10-
119
import tensorflow_data_validation as tfdv
1210
from bq.testutils import (
1311
assert_stats_equal,
1412
clear_unsupported_agg_fields,
1513
clear_unsupported_fields,
1614
)
15+
from google.protobuf.duration_pb2 import Duration
16+
1717
from feast.client import Client
1818
from feast.entity import Entity
1919
from feast.feature import Feature

0 commit comments

Comments
 (0)