Skip to content

Commit

Permalink
chore: Assorted updates to feast packaging (#2683)
Browse files Browse the repository at this point in the history
* chore: Assorted updates to feast packaging

Signed-off-by: Achal Shah <[email protected]>

* fixup

Signed-off-by: Achal Shah <[email protected]>

* fixup

Signed-off-by: Achal Shah <[email protected]>

* fixup for dockerfile

Signed-off-by: Achal Shah <[email protected]>

* fixup for dockerfile

Signed-off-by: Achal Shah <[email protected]>

* fixup for dockerfile

Signed-off-by: Achal Shah <[email protected]>
  • Loading branch information
achals authored May 13, 2022
1 parent 01d3568 commit 7c69f1c
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
5 changes: 4 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ repos:
stages: [ push ]
language: system
entry: make format
pass_filenames: false
- id: lint
name: Lint
stages: [ push ]
language: system
entry: make lint
pass_filenames: false
- id: template
name: Build Templates
stages: [ commit ]
language: system
entry: make build-templates
entry: make build-templates
pass_filenames: false
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ prune docs
prune infra
prune examples

graft sdk/python/feast/ui/build
graft sdk/python/feast/ui/build
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
[build-system]
requires = ["setuptools>=60", "wheel", "setuptools_scm>=6.2", "grpcio", "grpcio-tools==1.44.0", "mypy-protobuf==3.1", "sphinx!=4.0.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
# Including this section is comparable to supplying use_scm_version=True in setup.py.

[tool.black]
line-length = 88
target-version = ['py37']
target-version = ['py38']
include = '\.pyi?$'
exclude = '''
(
Expand Down
10 changes: 7 additions & 3 deletions sdk/python/feast/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from pkg_resources import DistributionNotFound, get_distribution
try:
from importlib.metadata import PackageNotFoundError
from importlib.metadata import version as _version
except ModuleNotFoundError:
from importlib_metadata import PackageNotFoundError, version as _version # type: ignore

from feast.infra.offline_stores.bigquery_source import BigQuerySource
from feast.infra.offline_stores.file_source import FileSource
Expand Down Expand Up @@ -26,8 +30,8 @@
from .value_type import ValueType

try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
__version__ = _version("feast")
except PackageNotFoundError:
# package is not installed
pass

Expand Down
8 changes: 5 additions & 3 deletions sdk/python/feast/infra/feature_servers/aws_lambda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ COPY pyproject.toml pyproject.toml
COPY README.md README.md

# Install Feast for AWS with Lambda dependencies
# TODO(felixwang9817): Remove Snowflake dependencies once lazy loading of offline stores is supported.
# See https://github.com/feast-dev/feast/issues/2566 for more details.
RUN pip3 install -e '.[aws,redis,snowflake]'
# We need this mount thingy because setuptools_scm needs access to the
# git dir to infer the version of feast we're installing.
# https://github.com/pypa/setuptools_scm#usage-from-docker
# I think it also assumes that this dockerfile is being built from the root of the directory.
RUN SETUPTOOLS_SCM_PRETEND_VERSION=1 pip3 install --no-cache-dir -e '.[aws,redis]'
RUN pip3 install -r sdk/python/feast/infra/feature_servers/aws_lambda/requirements.txt --target "${LAMBDA_TASK_ROOT}"

# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
Expand Down
9 changes: 6 additions & 3 deletions sdk/python/feast/version.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import pkg_resources
try:
from importlib.metadata import PackageNotFoundError, version
except ModuleNotFoundError:
from importlib_metadata import PackageNotFoundError, version # type: ignore


def get_version():
"""Returns version information of the Feast Python Package."""
try:
sdk_version = pkg_resources.get_distribution("feast").version
except pkg_resources.DistributionNotFound:
sdk_version = version("feast")
except PackageNotFoundError:
sdk_version = "unknown"
return sdk_version

0 comments on commit 7c69f1c

Please sign in to comment.