Skip to content

Commit

Permalink
fix: Fix warnings from deprecated paths and update default log level (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
adchia authored and james-crabtree-sp committed Sep 14, 2023
1 parent d3d615f commit db6fb8a
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 30 deletions.
6 changes: 3 additions & 3 deletions sdk/python/feast/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
from typing import List, Optional

import click
import pkg_resources
import yaml
from colorama import Fore, Style
from dateutil import parser
from importlib_metadata import version as importlib_version
from pygments import formatters, highlight, lexers

from feast import utils
Expand Down Expand Up @@ -68,7 +68,7 @@ def format_options(self, ctx: click.Context, formatter: click.HelpFormatter):
)
@click.option(
"--log-level",
default="info",
default="warning",
help="The logging level. One of DEBUG, INFO, WARNING, ERROR, and CRITICAL (case-insensitive).",
)
@click.option(
Expand Down Expand Up @@ -122,7 +122,7 @@ def version():
"""
Display Feast SDK version
"""
print(f'Feast SDK Version: "{pkg_resources.get_distribution("feast")}"')
print(f'Feast SDK Version: "{importlib_version("feast")}"')


@cli.command()
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/infra/offline_stores/file_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def get_table_column_names_and_types(
# Adding support for different file format path
# based on S3 filesystem
if filesystem is None:
schema = ParquetDataset(path).schema
schema = ParquetDataset(path, use_legacy_dataset=False).schema
if hasattr(schema, "names") and hasattr(schema, "types"):
# Newer versions of pyarrow doesn't have this method,
# but this field is good enough.
Expand Down
8 changes: 4 additions & 4 deletions sdk/python/feast/proto_json.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import uuid
from typing import Any, Callable, Type

import pkg_resources
from google.protobuf.json_format import ( # type: ignore
_WKTJSONMETHODS,
ParseError,
_Parser,
_Printer,
)
from importlib_metadata import version as importlib_version
from packaging import version

from feast.protos.feast.serving.ServingService_pb2 import FeatureList
Expand Down Expand Up @@ -118,7 +118,7 @@ def from_json_object_updated(

# https://github.com/feast-dev/feast/issues/2484 Certain feast users need a higher version of protobuf but the
# parameters of `from_json_object` changes in feast 3.20.1. This change gives users flexibility to use earlier versions.
current_version = pkg_resources.get_distribution("protobuf").version
current_version = importlib_version("protobuf")
if version.parse(current_version) < version.parse("3.20"):
_patch_proto_json_encoding(Value, to_json_object, from_json_object)
else:
Expand Down Expand Up @@ -168,7 +168,7 @@ def from_json_object(

# https://github.com/feast-dev/feast/issues/2484 Certain feast users need a higher version of protobuf but the
# parameters of `from_json_object` changes in feast 3.20.1. This change gives users flexibility to use earlier versions.
current_version = pkg_resources.get_distribution("protobuf").version
current_version = importlib_version("protobuf")
if version.parse(current_version) < version.parse("3.20"):
_patch_proto_json_encoding(RepeatedValue, to_json_object, from_json_object)
else:
Expand Down Expand Up @@ -221,7 +221,7 @@ def from_json_object_updated(

# https://github.com/feast-dev/feast/issues/2484 Certain feast users need a higher version of protobuf but the
# parameters of `from_json_object` changes in feast 3.20.1. This change gives users flexibility to use earlier versions.
current_version = pkg_resources.get_distribution("protobuf").version
current_version = importlib_version("protobuf")
if version.parse(current_version) < version.parse("3.20"):
_patch_proto_json_encoding(FeatureList, to_json_object, from_json_object)
else:
Expand Down
31 changes: 16 additions & 15 deletions sdk/python/feast/ui_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import threading
from typing import Callable, Optional

import pkg_resources
import importlib_resources
import uvicorn
from fastapi import FastAPI, Response
from fastapi.middleware.cors import CORSMiddleware
Expand Down Expand Up @@ -51,20 +51,21 @@ def shutdown_event():

async_refresh()

ui_dir = pkg_resources.resource_filename(__name__, "ui/build/")
# Initialize with the projects-list.json file
with open(ui_dir + "projects-list.json", mode="w") as f:
projects_dict = {
"projects": [
{
"name": "Project",
"description": "Test project",
"id": project_id,
"registryPath": f"{root_path}/registry",
}
]
}
f.write(json.dumps(projects_dict))
ui_dir_ref = importlib_resources.files(__name__) / "ui/build/"
with importlib_resources.as_file(ui_dir_ref) as ui_dir:
# Initialize with the projects-list.json file
with ui_dir.joinpath("projects-list.json").open(mode="w") as f:
projects_dict = {
"projects": [
{
"name": "Project",
"description": "Test project",
"id": project_id,
"registryPath": f"{root_path}/registry",
}
]
}
f.write(json.dumps(projects_dict))

@app.get("/registry")
def read_registry():
Expand Down
3 changes: 3 additions & 0 deletions sdk/python/requirements/py3.10-ci-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,10 @@ imagesize==1.4.1
importlib-metadata==6.8.0
# via
# dask
# feast (setup.py)
# great-expectations
importlib-resources==6.0.1
# via feast (setup.py)
iniconfig==2.0.0
# via pytest
ipykernel==6.25.2
Expand Down
6 changes: 5 additions & 1 deletion sdk/python/requirements/py3.10-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ idna==3.4
# httpx
# requests
importlib-metadata==6.8.0
# via dask
# via
# dask
# feast (setup.py)
importlib-resources==6.0.1
# via feast (setup.py)
jinja2==3.1.2
# via feast (setup.py)
jsonschema==4.19.0
Expand Down
4 changes: 3 additions & 1 deletion sdk/python/requirements/py3.8-ci-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ importlib-metadata==6.8.0
# via
# build
# dask
# feast (setup.py)
# great-expectations
# jupyter-client
# jupyter-lsp
Expand All @@ -379,6 +380,7 @@ importlib-metadata==6.8.0
# sphinx
importlib-resources==6.0.1
# via
# feast (setup.py)
# jsonschema
# jsonschema-specifications
# jupyterlab
Expand Down Expand Up @@ -533,7 +535,7 @@ mypy-extensions==1.0.0
# via
# black
# mypy
mypy-protobuf==3.1
mypy-protobuf==3.1.0
# via feast (setup.py)
mysqlclient==2.2.0
# via feast (setup.py)
Expand Down
7 changes: 5 additions & 2 deletions sdk/python/requirements/py3.8-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,12 @@ idna==3.4
# httpx
# requests
importlib-metadata==6.8.0
# via dask
# via
# dask
# feast (setup.py)
importlib-resources==6.0.1
# via
# feast (setup.py)
# jsonschema
# jsonschema-specifications
jinja2==3.1.2
Expand All @@ -105,7 +108,7 @@ mypy==1.5.1
# via sqlalchemy
mypy-extensions==1.0.0
# via mypy
mypy-protobuf==3.1
mypy-protobuf==3.1.0
# via feast (setup.py)
numpy==1.24.4
# via
Expand Down
7 changes: 6 additions & 1 deletion sdk/python/requirements/py3.9-ci-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,16 @@ importlib-metadata==6.8.0
# via
# build
# dask
# feast (setup.py)
# great-expectations
# jupyter-client
# jupyter-lsp
# jupyterlab
# jupyterlab-server
# nbconvert
# sphinx
importlib-resources==6.0.1
# via feast (setup.py)
iniconfig==2.0.0
# via pytest
ipykernel==6.25.2
Expand Down Expand Up @@ -1080,7 +1083,9 @@ xmltodict==0.13.0
yarl==1.9.2
# via aiohttp
zipp==3.16.2
# via importlib-metadata
# via
# importlib-metadata
# importlib-resources

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
10 changes: 8 additions & 2 deletions sdk/python/requirements/py3.9-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ idna==3.4
# httpx
# requests
importlib-metadata==6.8.0
# via dask
# via
# dask
# feast (setup.py)
importlib-resources==6.0.1
# via feast (setup.py)
jinja2==3.1.2
# via feast (setup.py)
jsonschema==4.19.0
Expand Down Expand Up @@ -214,7 +218,9 @@ watchfiles==0.20.0
websockets==11.0.3
# via uvicorn
zipp==3.16.2
# via importlib-metadata
# via
# importlib-metadata
# importlib-resources

# The following packages are considered to be unsafe in a requirements file:
# setuptools
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
# FastAPI does not correctly pull starlette dependency on httpx see thread(https://github.com/tiangolo/fastapi/issues/5656).
"httpx>=0.23.3",
"pyOpenSSL"
"importlib-resources>=6.0.0,<7",
"importlib_metadata>=6.8.0,<7"
]

GCP_REQUIRED = [
Expand Down

0 comments on commit db6fb8a

Please sign in to comment.