Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Create __init__ files for the proto-generated python dirs #2410

Merged
merged 2 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ package-protos:
cp -r ${ROOT_DIR}/protos ${ROOT_DIR}/sdk/python/feast/protos

compile-protos-python:
python setup.py build_python_protos
python sdk/python/setup.py build_python_protos

install-python:
cd sdk/python && python -m piptools sync requirements/py$(PYTHON)-requirements.txt
Expand Down
10 changes: 8 additions & 2 deletions sdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,14 @@ def _generate_python_protos(self, path: str):
def run(self):
for sub_folder in self.sub_folders:
self._generate_python_protos(f"feast/{sub_folder}/*.proto")

from pathlib import Path
# We need the __init__ files for each of the generated subdirs
# so that they are regular packages, and don't need the `--namespace-packages` flags
# when being typechecked using mypy. BUT, we need to exclude `types` because that clashes
# with an existing module in the python standard library.
if sub_folder == "types":
continue
with open(f"{self.python_folder}/feast/{sub_folder}/__init__.py", 'w'):
pass

for path in Path("feast/protos").rglob("*.py"):
for folder in self.sub_folders:
Expand Down