Skip to content

Commit 7c69f1c

Browse files
authored
chore: Assorted updates to feast packaging (#2683)
* chore: Assorted updates to feast packaging Signed-off-by: Achal Shah <achals@gmail.com> * fixup Signed-off-by: Achal Shah <achals@gmail.com> * fixup Signed-off-by: Achal Shah <achals@gmail.com> * fixup for dockerfile Signed-off-by: Achal Shah <achals@gmail.com> * fixup for dockerfile Signed-off-by: Achal Shah <achals@gmail.com> * fixup for dockerfile Signed-off-by: Achal Shah <achals@gmail.com>
1 parent 01d3568 commit 7c69f1c

File tree

6 files changed

+31
-12
lines changed

6 files changed

+31
-12
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ repos:
88
stages: [ push ]
99
language: system
1010
entry: make format
11+
pass_filenames: false
1112
- id: lint
1213
name: Lint
1314
stages: [ push ]
1415
language: system
1516
entry: make lint
17+
pass_filenames: false
1618
- id: template
1719
name: Build Templates
1820
stages: [ commit ]
1921
language: system
20-
entry: make build-templates
22+
entry: make build-templates
23+
pass_filenames: false

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ prune docs
55
prune infra
66
prune examples
77

8-
graft sdk/python/feast/ui/build
8+
graft sdk/python/feast/ui/build

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
[build-system]
2+
requires = ["setuptools>=60", "wheel", "setuptools_scm>=6.2", "grpcio", "grpcio-tools==1.44.0", "mypy-protobuf==3.1", "sphinx!=4.0.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools_scm]
6+
# Including this section is comparable to supplying use_scm_version=True in setup.py.
7+
18
[tool.black]
29
line-length = 88
3-
target-version = ['py37']
10+
target-version = ['py38']
411
include = '\.pyi?$'
512
exclude = '''
613
(

sdk/python/feast/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
from pkg_resources import DistributionNotFound, get_distribution
1+
try:
2+
from importlib.metadata import PackageNotFoundError
3+
from importlib.metadata import version as _version
4+
except ModuleNotFoundError:
5+
from importlib_metadata import PackageNotFoundError, version as _version # type: ignore
26

37
from feast.infra.offline_stores.bigquery_source import BigQuerySource
48
from feast.infra.offline_stores.file_source import FileSource
@@ -26,8 +30,8 @@
2630
from .value_type import ValueType
2731

2832
try:
29-
__version__ = get_distribution(__name__).version
30-
except DistributionNotFound:
33+
__version__ = _version("feast")
34+
except PackageNotFoundError:
3135
# package is not installed
3236
pass
3337

sdk/python/feast/infra/feature_servers/aws_lambda/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ COPY pyproject.toml pyproject.toml
1212
COPY README.md README.md
1313

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

2022
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)

sdk/python/feast/version.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import pkg_resources
1+
try:
2+
from importlib.metadata import PackageNotFoundError, version
3+
except ModuleNotFoundError:
4+
from importlib_metadata import PackageNotFoundError, version # type: ignore
25

36

47
def get_version():
58
"""Returns version information of the Feast Python Package."""
69
try:
7-
sdk_version = pkg_resources.get_distribution("feast").version
8-
except pkg_resources.DistributionNotFound:
10+
sdk_version = version("feast")
11+
except PackageNotFoundError:
912
sdk_version = "unknown"
1013
return sdk_version

0 commit comments

Comments
 (0)