Skip to content

Commit

Permalink
Fix SDK release building
Browse files Browse the repository at this point in the history
Signed-off-by: Willem Pienaar <git@willem.co>
  • Loading branch information
woop committed Mar 21, 2021
1 parent 96d8ff7 commit 2e57db6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ dmypy.json
*.code-workspace

# Protos
sdk/python/docs/source
sdk/python/docs/html
sdk/python/feast/protos/
sdk/python/tensorflow_metadata
Expand Down
9 changes: 3 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
default_stages:
- push
repos:
- repo: local
hooks:
- id: lint
name: Lint
stages: [ push ]
language: system
entry: make lint
- id: compile-protos-python
name: Compile Python Protos
stages: [ push ]
language: system
entry: make compile-protos-python
entry: make lint
17 changes: 8 additions & 9 deletions sdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from setuptools.command.install import install
from setuptools.command.develop import develop
from setuptools.command.egg_info import egg_info
from setuptools.command.sdist import sdist

except ImportError:
from distutils.core import setup
from distutils.command.install import install
Expand Down Expand Up @@ -61,9 +63,9 @@
# README file from Feast repo root directory
repo_root = (
subprocess.Popen(["git", "rev-parse", "--show-toplevel"], stdout=subprocess.PIPE)
.communicate()[0]
.rstrip()
.decode("utf-8")
.communicate()[0]
.rstrip()
.decode("utf-8")
)
README_FILE = os.path.join(repo_root, "README.md")
with open(os.path.join(README_FILE), "r") as f:
Expand All @@ -76,20 +78,15 @@
r"^(?:[\/\w-]+)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$"
)


proto_dirs = [x for x in os.listdir(repo_root + "/protos/feast")]
proto_dirs.remove("third_party")


def pre_install_build():
"""
Build Python protos when installing Feast using setup.py
"""
subprocess.check_call("make compile-protos-python", shell=True, cwd=f"{repo_root}")
subprocess.check_call("make build-sphinx", shell=True, cwd=f"{repo_root}")


# Classes used to inject pre_install_build()
class CustomInstallCommand(install):
def do_egg_install(self):
pre_install_build()
Expand All @@ -116,7 +113,7 @@ def run(self):
long_description_content_type="text/markdown",
python_requires=REQUIRES_PYTHON,
url=URL,
packages=find_packages(exclude=("tests",)),
packages=find_packages(exclude=("tests",)) + ['.'],
install_requires=REQUIRED,
# https://stackoverflow.com/questions/28509965/setuptools-development-requirements
# Install dev requirements with: pip install -e .[dev]
Expand All @@ -143,6 +140,8 @@ def run(self):
"protos/feast/**/*.proto",
"protos/feast/third_party/grpc/health/v1/*.proto",
"protos/tensorflow_metadata/proto/v0/*.proto",
"feast/protos/feast/**/*.py",
"tensorflow_metadata/proto/v0/*.py"
],
},
cmdclass={
Expand Down

0 comments on commit 2e57db6

Please sign in to comment.