diff --git a/Makefile b/Makefile index e8c3276015..ae776771cd 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/sdk/python/setup.py b/sdk/python/setup.py index 81a2461d38..351f32b71b 100644 --- a/sdk/python/setup.py +++ b/sdk/python/setup.py @@ -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: