We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Optimize `_populate_result_rows_from_feature_view`
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>

<!--  Thanks for sending a pull request!  Here are some tips for you:

1. Ensure that your code follows our code conventions: https://github.com/feast-dev/feast/blob/master/CONTRIBUTING.md#code-style--linting
2. Run unit tests and ensure that they are passing: https://github.com/feast-dev/feast/blob/master/CONTRIBUTING.md#unit-tests
3. If your change introduces any API changes, make sure to update the integration tests scripts here: https://github.com/feast-dev/feast/tree/master/sdk/python/tests or https://github.com/feast-dev/feast/tree/master/sdk/go
4. Make sure documentation is updated for your PR!
5. Make sure you have signed the CLA https://cla.developers.google.com/clas

-->

**What this PR does / why we need it**:
This commit optimizes the fetching of features by only fetching
the features for each unique Entity once and then expands the result
to the shape of input EntityKeys.

Previously, if an Entity occurred twice the features would be fetched
from the OnlineStore twice. This can be hugely inefficient.

The only assumption that this makes is that the OnlineStore will return 
the feature data in the same order as the EntityKeyProtos are provided.

**Which issue(s) this PR fixes**:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes #

**Does this PR introduce a user-facing change?**:
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".

For more information about release notes, see kubernetes' guide here:
http://git.k8s.io/community/contributors/guide/release-notes.md
-->
```release-note
Speed up `get_online_features` when duplicate Entities are present.
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `sdk/python/setup.py`
Content:
```
1 # Copyright 2019 The Feast Authors
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     https://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 import glob
15 import os
16 import re
17 import shutil
18 import subprocess
19 import pathlib
20 
21 from distutils.cmd import Command
22 from setuptools import find_packages
23 
24 try:
25     from setuptools import setup
26     from setuptools.command.install import install
27     from setuptools.command.develop import develop
28     from setuptools.command.egg_info import egg_info
29     from setuptools.command.sdist import sdist
30     from setuptools.command.build_py import build_py
31 except ImportError:
32     from distutils.core import setup
33     from distutils.command.install import install
34     from distutils.command.build_py import build_py
35 
36 NAME = "feast"
37 DESCRIPTION = "Python SDK for Feast"
38 URL = "https://github.com/feast-dev/feast"
39 AUTHOR = "Feast"
40 REQUIRES_PYTHON = ">=3.7.0"
41 
42 REQUIRED = [
43     "Click==8.*",
44     "colorama>=0.3.9",
45     "dill==0.3.*",
46     "fastavro>=1.1.0",
47     "google-api-core>=1.23.0",
48     "googleapis-common-protos==1.52.*",
49     "grpcio>=1.34.0",
50     "grpcio-reflection>=1.34.0",
51     "Jinja2>=2.0.0",
52     "jsonschema",
53     "mmh3",
54     "pandas>=1.0.0",
55     "pandavro==1.5.*",
56     "protobuf>=3.10",
57     "proto-plus<1.19.7",
58     "pyarrow>=4.0.0",
59     "pydantic>=1.0.0",
60     "PyYAML>=5.4.*",
61     "tabulate==0.8.*",
62     "tenacity>=7.*",
63     "toml==0.10.*",
64     "tqdm==4.*",
65     "fastapi>=0.68.0",
66     "uvicorn[standard]>=0.14.0",
67     "proto-plus<1.19.7",
68     "tensorflow-metadata>=1.0.0,<2.0.0",
69 ]
70 
71 GCP_REQUIRED = [
72     "google-cloud-bigquery>=2.28.1",
73     "google-cloud-bigquery-storage >= 2.0.0",
74     "google-cloud-datastore>=2.1.*",
75     "google-cloud-storage>=1.34.*,<1.41",
76     "google-cloud-core>=1.4.0,<2.0.0",
77 ]
78 
79 REDIS_REQUIRED = [
80     "redis>=4.1.0",
81     "hiredis>=2.0.0",
82 ]
83 
84 AWS_REQUIRED = [
85     "boto3>=1.17.0",
86     "docker>=5.0.2",
87 ]
88 
89 CI_REQUIRED = (
90     [
91         "cryptography==3.3.2",
92         "flake8",
93         "black==19.10b0",
94         "isort>=5",
95         "grpcio-tools==1.34.0",
96         "grpcio-testing==1.34.0",
97         "minio==7.1.0",
98         "mock==2.0.0",
99         "moto",
100         "mypy==0.931",
101         "mypy-protobuf==3.1.0",
102         "avro==1.10.0",
103         "gcsfs",
104         "urllib3>=1.25.4",
105         "pytest>=6.0.0",
106         "pytest-cov",
107         "pytest-xdist",
108         "pytest-benchmark>=3.4.1",
109         "pytest-lazy-fixture==0.6.3",
110         "pytest-timeout==1.4.2",
111         "pytest-ordering==0.6.*",
112         "pytest-mock==1.10.4",
113         "Sphinx!=4.0.0,<4.4.0",
114         "sphinx-rtd-theme",
115         "testcontainers==3.4.2",
116         "adlfs==0.5.9",
117         "firebase-admin==4.5.2",
118         "pre-commit",
119         "assertpy==1.1",
120         "pip-tools",
121         "types-protobuf",
122         "types-python-dateutil",
123         "types-pytz",
124         "types-PyYAML",
125         "types-redis",
126         "types-requests",
127         "types-setuptools",
128         "types-tabulate",
129     ]
130     + GCP_REQUIRED
131     + REDIS_REQUIRED
132     + AWS_REQUIRED
133 )
134 
135 DEV_REQUIRED = ["mypy-protobuf>=1.*", "grpcio-testing==1.*"] + CI_REQUIRED
136 
137 # Get git repo root directory
138 repo_root = str(pathlib.Path(__file__).resolve().parent.parent.parent)
139 
140 # README file from Feast repo root directory
141 README_FILE = os.path.join(repo_root, "README.md")
142 with open(README_FILE, "r", encoding="utf8") as f:
143     LONG_DESCRIPTION = f.read()
144 
145 # Add Support for parsing tags that have a prefix containing '/' (ie 'sdk/go') to setuptools_scm.
146 # Regex modified from default tag regex in:
147 # https://github.com/pypa/setuptools_scm/blob/2a1b46d38fb2b8aeac09853e660bcd0d7c1bc7be/src/setuptools_scm/config.py#L9
148 TAG_REGEX = re.compile(
149     r"^(?:[\/\w-]+)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$"
150 )
151 
152 # Only set use_scm_version if git executable exists (setting this variable causes pip to use git under the hood)
153 if shutil.which("git"):
154     use_scm_version = {"root": "../..", "relative_to": __file__, "tag_regex": TAG_REGEX}
155 else:
156     use_scm_version = None
157 
158 
159 class BuildProtoCommand(Command):
160     description = "Builds the proto files into python files."
161 
162     def initialize_options(self):
163         self.protoc = ["python", "-m", "grpc_tools.protoc"]  # find_executable("protoc")
164         self.proto_folder = os.path.join(repo_root, "protos")
165         self.this_package = os.path.join(os.path.dirname(__file__) or os.getcwd(), 'feast/protos')
166         self.sub_folders = ["core", "serving", "types", "storage"]
167 
168     def finalize_options(self):
169         pass
170 
171     def _generate_protos(self, path):
172         proto_files = glob.glob(os.path.join(self.proto_folder, path))
173 
174         subprocess.check_call(self.protoc + [
175             '-I', self.proto_folder,
176             '--python_out', self.this_package,
177             '--grpc_python_out', self.this_package,
178             '--mypy_out', self.this_package] + proto_files)
179 
180     def run(self):
181         for sub_folder in self.sub_folders:
182             self._generate_protos(f'feast/{sub_folder}/*.proto')
183 
184         from pathlib import Path
185 
186         for path in Path('feast/protos').rglob('*.py'):
187             for folder in self.sub_folders:
188                 # Read in the file
189                 with open(path, 'r') as file:
190                     filedata = file.read()
191 
192                 # Replace the target string
193                 filedata = filedata.replace(f'from feast.{folder}', f'from feast.protos.feast.{folder}')
194 
195                 # Write the file out again
196                 with open(path, 'w') as file:
197                     file.write(filedata)
198 
199 
200 class BuildCommand(build_py):
201     """Custom build command."""
202 
203     def run(self):
204         self.run_command('build_proto')
205         build_py.run(self)
206 
207 
208 class DevelopCommand(develop):
209     """Custom develop command."""
210 
211     def run(self):
212         self.run_command('build_proto')
213         develop.run(self)
214 
215 
216 setup(
217     name=NAME,
218     author=AUTHOR,
219     description=DESCRIPTION,
220     long_description=LONG_DESCRIPTION,
221     long_description_content_type="text/markdown",
222     python_requires=REQUIRES_PYTHON,
223     url=URL,
224     packages=find_packages(exclude=("tests",)),
225     install_requires=REQUIRED,
226     # https://stackoverflow.com/questions/28509965/setuptools-development-requirements
227     # Install dev requirements with: pip install -e .[dev]
228     extras_require={
229         "dev": DEV_REQUIRED,
230         "ci": CI_REQUIRED,
231         "gcp": GCP_REQUIRED,
232         "aws": AWS_REQUIRED,
233         "redis": REDIS_REQUIRED,
234     },
235     include_package_data=True,
236     license="Apache",
237     classifiers=[
238         # Trove classifiers
239         # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
240         "License :: OSI Approved :: Apache Software License",
241         "Programming Language :: Python",
242         "Programming Language :: Python :: 3",
243         "Programming Language :: Python :: 3.7",
244     ],
245     entry_points={"console_scripts": ["feast=feast.cli:cli"]},
246     use_scm_version=use_scm_version,
247     setup_requires=["setuptools_scm", "grpcio", "grpcio-tools==1.34.0", "mypy-protobuf==1.*", "sphinx!=4.0.0"],
248     package_data={
249         "": [
250             "protos/feast/**/*.proto",
251             "protos/feast/third_party/grpc/health/v1/*.proto",
252             "feast/protos/feast/**/*.py",
253         ],
254     },
255     cmdclass={
256         "build_proto": BuildProtoCommand,
257         "build_py": BuildCommand,
258         "develop": DevelopCommand,
259     },
260 )
261
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/sdk/python/setup.py b/sdk/python/setup.py
--- a/sdk/python/setup.py
+++ b/sdk/python/setup.py
@@ -132,7 +132,7 @@
     + AWS_REQUIRED
 )
 
-DEV_REQUIRED = ["mypy-protobuf>=1.*", "grpcio-testing==1.*"] + CI_REQUIRED
+DEV_REQUIRED = ["mypy-protobuf>=3.1.0", "grpcio-testing==1.*"] + CI_REQUIRED
 
 # Get git repo root directory
 repo_root = str(pathlib.Path(__file__).resolve().parent.parent.parent)
@@ -244,7 +244,7 @@
     ],
     entry_points={"console_scripts": ["feast=feast.cli:cli"]},
     use_scm_version=use_scm_version,
-    setup_requires=["setuptools_scm", "grpcio", "grpcio-tools==1.34.0", "mypy-protobuf==1.*", "sphinx!=4.0.0"],
+    setup_requires=["setuptools_scm", "grpcio", "grpcio-tools==1.34.0", "mypy-protobuf==3.1.0", "sphinx!=4.0.0"],
     package_data={
         "": [
             "protos/feast/**/*.proto",

{"golden_diff": "diff --git a/sdk/python/setup.py b/sdk/python/setup.py\n--- a/sdk/python/setup.py\n+++ b/sdk/python/setup.py\n@@ -132,7 +132,7 @@\n     + AWS_REQUIRED\n )\n \n-DEV_REQUIRED = [\"mypy-protobuf>=1.*\", \"grpcio-testing==1.*\"] + CI_REQUIRED\n+DEV_REQUIRED = [\"mypy-protobuf>=3.1.0\", \"grpcio-testing==1.*\"] + CI_REQUIRED\n \n # Get git repo root directory\n repo_root = str(pathlib.Path(__file__).resolve().parent.parent.parent)\n@@ -244,7 +244,7 @@\n     ],\n     entry_points={\"console_scripts\": [\"feast=feast.cli:cli\"]},\n     use_scm_version=use_scm_version,\n-    setup_requires=[\"setuptools_scm\", \"grpcio\", \"grpcio-tools==1.34.0\", \"mypy-protobuf==1.*\", \"sphinx!=4.0.0\"],\n+    setup_requires=[\"setuptools_scm\", \"grpcio\", \"grpcio-tools==1.34.0\", \"mypy-protobuf==3.1.0\", \"sphinx!=4.0.0\"],\n     package_data={\n         \"\": [\n             \"protos/feast/**/*.proto\",\n", "issue": "Optimize `_populate_result_rows_from_feature_view`\nSigned-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>\r\n\r\n<!--  Thanks for sending a pull request!  Here are some tips for you:\r\n\r\n1. Ensure that your code follows our code conventions: https://github.com/feast-dev/feast/blob/master/CONTRIBUTING.md#code-style--linting\r\n2. Run unit tests and ensure that they are passing: https://github.com/feast-dev/feast/blob/master/CONTRIBUTING.md#unit-tests\r\n3. If your change introduces any API changes, make sure to update the integration tests scripts here: https://github.com/feast-dev/feast/tree/master/sdk/python/tests or https://github.com/feast-dev/feast/tree/master/sdk/go\r\n4. Make sure documentation is updated for your PR!\r\n5. Make sure you have signed the CLA https://cla.developers.google.com/clas\r\n\r\n-->\r\n\r\n**What this PR does / why we need it**:\r\nThis commit optimizes the fetching of features by only fetching\r\nthe features for each unique Entity once and then expands the result\r\nto the shape of input EntityKeys.\r\n\r\nPreviously, if an Entity occurred twice the features would be fetched\r\nfrom the OnlineStore twice. This can be hugely inefficient.\r\n\r\nThe only assumption that this makes is that the OnlineStore will return \r\nthe feature data in the same order as the EntityKeyProtos are provided.\r\n\r\n**Which issue(s) this PR fixes**:\r\n<!--\r\n*Automatically closes linked issue when PR is merged.\r\nUsage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.\r\n-->\r\nFixes #\r\n\r\n**Does this PR introduce a user-facing change?**:\r\n<!--\r\nIf no, just write \"NONE\" in the release-note block below.\r\nIf yes, a release note is required:\r\nEnter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string \"action required\".\r\n\r\nFor more information about release notes, see kubernetes' guide here:\r\nhttp://git.k8s.io/community/contributors/guide/release-notes.md\r\n-->\r\n```release-note\r\nSpeed up `get_online_features` when duplicate Entities are present.\r\n```\r\n\n", "before_files": [{"content": "# Copyright 2019 The Feast Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nimport glob\nimport os\nimport re\nimport shutil\nimport subprocess\nimport pathlib\n\nfrom distutils.cmd import Command\nfrom setuptools import find_packages\n\ntry:\n    from setuptools import setup\n    from setuptools.command.install import install\n    from setuptools.command.develop import develop\n    from setuptools.command.egg_info import egg_info\n    from setuptools.command.sdist import sdist\n    from setuptools.command.build_py import build_py\nexcept ImportError:\n    from distutils.core import setup\n    from distutils.command.install import install\n    from distutils.command.build_py import build_py\n\nNAME = \"feast\"\nDESCRIPTION = \"Python SDK for Feast\"\nURL = \"https://github.com/feast-dev/feast\"\nAUTHOR = \"Feast\"\nREQUIRES_PYTHON = \">=3.7.0\"\n\nREQUIRED = [\n    \"Click==8.*\",\n    \"colorama>=0.3.9\",\n    \"dill==0.3.*\",\n    \"fastavro>=1.1.0\",\n    \"google-api-core>=1.23.0\",\n    \"googleapis-common-protos==1.52.*\",\n    \"grpcio>=1.34.0\",\n    \"grpcio-reflection>=1.34.0\",\n    \"Jinja2>=2.0.0\",\n    \"jsonschema\",\n    \"mmh3\",\n    \"pandas>=1.0.0\",\n    \"pandavro==1.5.*\",\n    \"protobuf>=3.10\",\n    \"proto-plus<1.19.7\",\n    \"pyarrow>=4.0.0\",\n    \"pydantic>=1.0.0\",\n    \"PyYAML>=5.4.*\",\n    \"tabulate==0.8.*\",\n    \"tenacity>=7.*\",\n    \"toml==0.10.*\",\n    \"tqdm==4.*\",\n    \"fastapi>=0.68.0\",\n    \"uvicorn[standard]>=0.14.0\",\n    \"proto-plus<1.19.7\",\n    \"tensorflow-metadata>=1.0.0,<2.0.0\",\n]\n\nGCP_REQUIRED = [\n    \"google-cloud-bigquery>=2.28.1\",\n    \"google-cloud-bigquery-storage >= 2.0.0\",\n    \"google-cloud-datastore>=2.1.*\",\n    \"google-cloud-storage>=1.34.*,<1.41\",\n    \"google-cloud-core>=1.4.0,<2.0.0\",\n]\n\nREDIS_REQUIRED = [\n    \"redis>=4.1.0\",\n    \"hiredis>=2.0.0\",\n]\n\nAWS_REQUIRED = [\n    \"boto3>=1.17.0\",\n    \"docker>=5.0.2\",\n]\n\nCI_REQUIRED = (\n    [\n        \"cryptography==3.3.2\",\n        \"flake8\",\n        \"black==19.10b0\",\n        \"isort>=5\",\n        \"grpcio-tools==1.34.0\",\n        \"grpcio-testing==1.34.0\",\n        \"minio==7.1.0\",\n        \"mock==2.0.0\",\n        \"moto\",\n        \"mypy==0.931\",\n        \"mypy-protobuf==3.1.0\",\n        \"avro==1.10.0\",\n        \"gcsfs\",\n        \"urllib3>=1.25.4\",\n        \"pytest>=6.0.0\",\n        \"pytest-cov\",\n        \"pytest-xdist\",\n        \"pytest-benchmark>=3.4.1\",\n        \"pytest-lazy-fixture==0.6.3\",\n        \"pytest-timeout==1.4.2\",\n        \"pytest-ordering==0.6.*\",\n        \"pytest-mock==1.10.4\",\n        \"Sphinx!=4.0.0,<4.4.0\",\n        \"sphinx-rtd-theme\",\n        \"testcontainers==3.4.2\",\n        \"adlfs==0.5.9\",\n        \"firebase-admin==4.5.2\",\n        \"pre-commit\",\n        \"assertpy==1.1\",\n        \"pip-tools\",\n        \"types-protobuf\",\n        \"types-python-dateutil\",\n        \"types-pytz\",\n        \"types-PyYAML\",\n        \"types-redis\",\n        \"types-requests\",\n        \"types-setuptools\",\n        \"types-tabulate\",\n    ]\n    + GCP_REQUIRED\n    + REDIS_REQUIRED\n    + AWS_REQUIRED\n)\n\nDEV_REQUIRED = [\"mypy-protobuf>=1.*\", \"grpcio-testing==1.*\"] + CI_REQUIRED\n\n# Get git repo root directory\nrepo_root = str(pathlib.Path(__file__).resolve().parent.parent.parent)\n\n# README file from Feast repo root directory\nREADME_FILE = os.path.join(repo_root, \"README.md\")\nwith open(README_FILE, \"r\", encoding=\"utf8\") as f:\n    LONG_DESCRIPTION = f.read()\n\n# Add Support for parsing tags that have a prefix containing '/' (ie 'sdk/go') to setuptools_scm.\n# Regex modified from default tag regex in:\n# https://github.com/pypa/setuptools_scm/blob/2a1b46d38fb2b8aeac09853e660bcd0d7c1bc7be/src/setuptools_scm/config.py#L9\nTAG_REGEX = re.compile(\n    r\"^(?:[\\/\\w-]+)?(?P<version>[vV]?\\d+(?:\\.\\d+){0,2}[^\\+]*)(?:\\+.*)?$\"\n)\n\n# Only set use_scm_version if git executable exists (setting this variable causes pip to use git under the hood)\nif shutil.which(\"git\"):\n    use_scm_version = {\"root\": \"../..\", \"relative_to\": __file__, \"tag_regex\": TAG_REGEX}\nelse:\n    use_scm_version = None\n\n\nclass BuildProtoCommand(Command):\n    description = \"Builds the proto files into python files.\"\n\n    def initialize_options(self):\n        self.protoc = [\"python\", \"-m\", \"grpc_tools.protoc\"]  # find_executable(\"protoc\")\n        self.proto_folder = os.path.join(repo_root, \"protos\")\n        self.this_package = os.path.join(os.path.dirname(__file__) or os.getcwd(), 'feast/protos')\n        self.sub_folders = [\"core\", \"serving\", \"types\", \"storage\"]\n\n    def finalize_options(self):\n        pass\n\n    def _generate_protos(self, path):\n        proto_files = glob.glob(os.path.join(self.proto_folder, path))\n\n        subprocess.check_call(self.protoc + [\n            '-I', self.proto_folder,\n            '--python_out', self.this_package,\n            '--grpc_python_out', self.this_package,\n            '--mypy_out', self.this_package] + proto_files)\n\n    def run(self):\n        for sub_folder in self.sub_folders:\n            self._generate_protos(f'feast/{sub_folder}/*.proto')\n\n        from pathlib import Path\n\n        for path in Path('feast/protos').rglob('*.py'):\n            for folder in self.sub_folders:\n                # Read in the file\n                with open(path, 'r') as file:\n                    filedata = file.read()\n\n                # Replace the target string\n                filedata = filedata.replace(f'from feast.{folder}', f'from feast.protos.feast.{folder}')\n\n                # Write the file out again\n                with open(path, 'w') as file:\n                    file.write(filedata)\n\n\nclass BuildCommand(build_py):\n    \"\"\"Custom build command.\"\"\"\n\n    def run(self):\n        self.run_command('build_proto')\n        build_py.run(self)\n\n\nclass DevelopCommand(develop):\n    \"\"\"Custom develop command.\"\"\"\n\n    def run(self):\n        self.run_command('build_proto')\n        develop.run(self)\n\n\nsetup(\n    name=NAME,\n    author=AUTHOR,\n    description=DESCRIPTION,\n    long_description=LONG_DESCRIPTION,\n    long_description_content_type=\"text/markdown\",\n    python_requires=REQUIRES_PYTHON,\n    url=URL,\n    packages=find_packages(exclude=(\"tests\",)),\n    install_requires=REQUIRED,\n    # https://stackoverflow.com/questions/28509965/setuptools-development-requirements\n    # Install dev requirements with: pip install -e .[dev]\n    extras_require={\n        \"dev\": DEV_REQUIRED,\n        \"ci\": CI_REQUIRED,\n        \"gcp\": GCP_REQUIRED,\n        \"aws\": AWS_REQUIRED,\n        \"redis\": REDIS_REQUIRED,\n    },\n    include_package_data=True,\n    license=\"Apache\",\n    classifiers=[\n        # Trove classifiers\n        # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.7\",\n    ],\n    entry_points={\"console_scripts\": [\"feast=feast.cli:cli\"]},\n    use_scm_version=use_scm_version,\n    setup_requires=[\"setuptools_scm\", \"grpcio\", \"grpcio-tools==1.34.0\", \"mypy-protobuf==1.*\", \"sphinx!=4.0.0\"],\n    package_data={\n        \"\": [\n            \"protos/feast/**/*.proto\",\n            \"protos/feast/third_party/grpc/health/v1/*.proto\",\n            \"feast/protos/feast/**/*.py\",\n        ],\n    },\n    cmdclass={\n        \"build_proto\": BuildProtoCommand,\n        \"build_py\": BuildCommand,\n        \"develop\": DevelopCommand,\n    },\n)\n", "path": "sdk/python/setup.py"}], "after_files": [{"content": "# Copyright 2019 The Feast Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nimport glob\nimport os\nimport re\nimport shutil\nimport subprocess\nimport pathlib\n\nfrom distutils.cmd import Command\nfrom setuptools import find_packages\n\ntry:\n    from setuptools import setup\n    from setuptools.command.install import install\n    from setuptools.command.develop import develop\n    from setuptools.command.egg_info import egg_info\n    from setuptools.command.sdist import sdist\n    from setuptools.command.build_py import build_py\nexcept ImportError:\n    from distutils.core import setup\n    from distutils.command.install import install\n    from distutils.command.build_py import build_py\n\nNAME = \"feast\"\nDESCRIPTION = \"Python SDK for Feast\"\nURL = \"https://github.com/feast-dev/feast\"\nAUTHOR = \"Feast\"\nREQUIRES_PYTHON = \">=3.7.0\"\n\nREQUIRED = [\n    \"Click==8.*\",\n    \"colorama>=0.3.9\",\n    \"dill==0.3.*\",\n    \"fastavro>=1.1.0\",\n    \"google-api-core>=1.23.0\",\n    \"googleapis-common-protos==1.52.*\",\n    \"grpcio>=1.34.0\",\n    \"grpcio-reflection>=1.34.0\",\n    \"Jinja2>=2.0.0\",\n    \"jsonschema\",\n    \"mmh3\",\n    \"pandas>=1.0.0\",\n    \"pandavro==1.5.*\",\n    \"protobuf>=3.10\",\n    \"proto-plus<1.19.7\",\n    \"pyarrow>=4.0.0\",\n    \"pydantic>=1.0.0\",\n    \"PyYAML>=5.4.*\",\n    \"tabulate==0.8.*\",\n    \"tenacity>=7.*\",\n    \"toml==0.10.*\",\n    \"tqdm==4.*\",\n    \"fastapi>=0.68.0\",\n    \"uvicorn[standard]>=0.14.0\",\n    \"proto-plus<1.19.7\",\n    \"tensorflow-metadata>=1.0.0,<2.0.0\",\n]\n\nGCP_REQUIRED = [\n    \"google-cloud-bigquery>=2.28.1\",\n    \"google-cloud-bigquery-storage >= 2.0.0\",\n    \"google-cloud-datastore>=2.1.*\",\n    \"google-cloud-storage>=1.34.*,<1.41\",\n    \"google-cloud-core>=1.4.0,<2.0.0\",\n]\n\nREDIS_REQUIRED = [\n    \"redis>=4.1.0\",\n    \"hiredis>=2.0.0\",\n]\n\nAWS_REQUIRED = [\n    \"boto3>=1.17.0\",\n    \"docker>=5.0.2\",\n]\n\nCI_REQUIRED = (\n    [\n        \"cryptography==3.3.2\",\n        \"flake8\",\n        \"black==19.10b0\",\n        \"isort>=5\",\n        \"grpcio-tools==1.34.0\",\n        \"grpcio-testing==1.34.0\",\n        \"minio==7.1.0\",\n        \"mock==2.0.0\",\n        \"moto\",\n        \"mypy==0.931\",\n        \"mypy-protobuf==3.1.0\",\n        \"avro==1.10.0\",\n        \"gcsfs\",\n        \"urllib3>=1.25.4\",\n        \"pytest>=6.0.0\",\n        \"pytest-cov\",\n        \"pytest-xdist\",\n        \"pytest-benchmark>=3.4.1\",\n        \"pytest-lazy-fixture==0.6.3\",\n        \"pytest-timeout==1.4.2\",\n        \"pytest-ordering==0.6.*\",\n        \"pytest-mock==1.10.4\",\n        \"Sphinx!=4.0.0,<4.4.0\",\n        \"sphinx-rtd-theme\",\n        \"testcontainers==3.4.2\",\n        \"adlfs==0.5.9\",\n        \"firebase-admin==4.5.2\",\n        \"pre-commit\",\n        \"assertpy==1.1\",\n        \"pip-tools\",\n        \"types-protobuf\",\n        \"types-python-dateutil\",\n        \"types-pytz\",\n        \"types-PyYAML\",\n        \"types-redis\",\n        \"types-requests\",\n        \"types-setuptools\",\n        \"types-tabulate\",\n    ]\n    + GCP_REQUIRED\n    + REDIS_REQUIRED\n    + AWS_REQUIRED\n)\n\nDEV_REQUIRED = [\"mypy-protobuf>=3.1.0\", \"grpcio-testing==1.*\"] + CI_REQUIRED\n\n# Get git repo root directory\nrepo_root = str(pathlib.Path(__file__).resolve().parent.parent.parent)\n\n# README file from Feast repo root directory\nREADME_FILE = os.path.join(repo_root, \"README.md\")\nwith open(README_FILE, \"r\", encoding=\"utf8\") as f:\n    LONG_DESCRIPTION = f.read()\n\n# Add Support for parsing tags that have a prefix containing '/' (ie 'sdk/go') to setuptools_scm.\n# Regex modified from default tag regex in:\n# https://github.com/pypa/setuptools_scm/blob/2a1b46d38fb2b8aeac09853e660bcd0d7c1bc7be/src/setuptools_scm/config.py#L9\nTAG_REGEX = re.compile(\n    r\"^(?:[\\/\\w-]+)?(?P<version>[vV]?\\d+(?:\\.\\d+){0,2}[^\\+]*)(?:\\+.*)?$\"\n)\n\n# Only set use_scm_version if git executable exists (setting this variable causes pip to use git under the hood)\nif shutil.which(\"git\"):\n    use_scm_version = {\"root\": \"../..\", \"relative_to\": __file__, \"tag_regex\": TAG_REGEX}\nelse:\n    use_scm_version = None\n\n\nclass BuildProtoCommand(Command):\n    description = \"Builds the proto files into python files.\"\n\n    def initialize_options(self):\n        self.protoc = [\"python\", \"-m\", \"grpc_tools.protoc\"]  # find_executable(\"protoc\")\n        self.proto_folder = os.path.join(repo_root, \"protos\")\n        self.this_package = os.path.join(os.path.dirname(__file__) or os.getcwd(), 'feast/protos')\n        self.sub_folders = [\"core\", \"serving\", \"types\", \"storage\"]\n\n    def finalize_options(self):\n        pass\n\n    def _generate_protos(self, path):\n        proto_files = glob.glob(os.path.join(self.proto_folder, path))\n\n        subprocess.check_call(self.protoc + [\n            '-I', self.proto_folder,\n            '--python_out', self.this_package,\n            '--grpc_python_out', self.this_package,\n            '--mypy_out', self.this_package] + proto_files)\n\n    def run(self):\n        for sub_folder in self.sub_folders:\n            self._generate_protos(f'feast/{sub_folder}/*.proto')\n\n        from pathlib import Path\n\n        for path in Path('feast/protos').rglob('*.py'):\n            for folder in self.sub_folders:\n                # Read in the file\n                with open(path, 'r') as file:\n                    filedata = file.read()\n\n                # Replace the target string\n                filedata = filedata.replace(f'from feast.{folder}', f'from feast.protos.feast.{folder}')\n\n                # Write the file out again\n                with open(path, 'w') as file:\n                    file.write(filedata)\n\n\nclass BuildCommand(build_py):\n    \"\"\"Custom build command.\"\"\"\n\n    def run(self):\n        self.run_command('build_proto')\n        build_py.run(self)\n\n\nclass DevelopCommand(develop):\n    \"\"\"Custom develop command.\"\"\"\n\n    def run(self):\n        self.run_command('build_proto')\n        develop.run(self)\n\n\nsetup(\n    name=NAME,\n    author=AUTHOR,\n    description=DESCRIPTION,\n    long_description=LONG_DESCRIPTION,\n    long_description_content_type=\"text/markdown\",\n    python_requires=REQUIRES_PYTHON,\n    url=URL,\n    packages=find_packages(exclude=(\"tests\",)),\n    install_requires=REQUIRED,\n    # https://stackoverflow.com/questions/28509965/setuptools-development-requirements\n    # Install dev requirements with: pip install -e .[dev]\n    extras_require={\n        \"dev\": DEV_REQUIRED,\n        \"ci\": CI_REQUIRED,\n        \"gcp\": GCP_REQUIRED,\n        \"aws\": AWS_REQUIRED,\n        \"redis\": REDIS_REQUIRED,\n    },\n    include_package_data=True,\n    license=\"Apache\",\n    classifiers=[\n        # Trove classifiers\n        # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Programming Language :: Python\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.7\",\n    ],\n    entry_points={\"console_scripts\": [\"feast=feast.cli:cli\"]},\n    use_scm_version=use_scm_version,\n    setup_requires=[\"setuptools_scm\", \"grpcio\", \"grpcio-tools==1.34.0\", \"mypy-protobuf==3.1.0\", \"sphinx!=4.0.0\"],\n    package_data={\n        \"\": [\n            \"protos/feast/**/*.proto\",\n            \"protos/feast/third_party/grpc/health/v1/*.proto\",\n            \"feast/protos/feast/**/*.py\",\n        ],\n    },\n    cmdclass={\n        \"build_proto\": BuildProtoCommand,\n        \"build_py\": BuildCommand,\n        \"develop\": DevelopCommand,\n    },\n)\n", "path": "sdk/python/setup.py"}]}