mitodl / open-discussions

BSD 3-Clause "New" or "Revised" License
10 stars 2 forks source link

Switch poetry over to using virtualenvs #4303

Closed rhysyngsun closed 2 months ago

rhysyngsun commented 2 months ago

What are the relevant tickets?

N/A

What's this PR do?

This PR switches poetry over to installing project dependencies via virtualenv, which avoids a build error that was happening:

Stacktrace ``` 9.668 ChefBuildError 9.668 9.668 Backend subprocess exited when trying to invoke get_requires_for_build_wheel 9.668 9.668 Traceback (most recent call last): 9.668 File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in 9.668 main() 9.668 File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main 9.668 json_out['return_val'] = hook(**hook_input['kwargs']) 9.668 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9.668 File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel 9.668 backend = _build_backend() 9.668 ^^^^^^^^^^^^^^^^ 9.668 File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 74, in _build_backend 9.668 ep = os.environ['PEP517_BUILD_BACKEND'] 9.668 ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ 9.668 File "", line 679, in __getitem__ 9.668 KeyError: 'PEP517_BUILD_BACKEND' 9.668 9.668 9.668 at /usr/local/lib/python3.11/site-packages/poetry/installation/chef.py:147 in _prepare 9.673 143│ 9.673 144│ error = ChefBuildError("\n\n".join(message_parts)) 9.673 145│ 9.673 146│ if error is not None: 9.673 → 147│ raise error from None 9.673 148│ 9.673 149│ return path 9.673 150│ 9.673 151│ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path: 9.674 9.674 Note: This error originates from the build backend, and is likely not a problem with poetry but with docopt (0.6.2) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "docopt (==0.6.2)"'. 9.674 9.865 9.865 ChefBuildError 9.865 9.866 Backend subprocess exited when trying to invoke get_requires_for_build_wheel 9.866 9.866 Traceback (most recent call last): 9.866 File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in 9.866 main() 9.866 File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main 9.866 json_out['return_val'] = hook(**hook_input['kwargs']) 9.866 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9.866 File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel 9.866 backend = _build_backend() 9.866 ^^^^^^^^^^^^^^^^ 9.866 File "/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 74, in _build_backend 9.866 ep = os.environ['PEP517_BUILD_BACKEND'] 9.866 ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ 9.866 File "", line 679, in __getitem__ 9.866 KeyError: 'PEP517_BUILD_BACKEND' 9.866 9.866 9.866 at /usr/local/lib/python3.11/site-packages/poetry/installation/chef.py:147 in _prepare 9.872 143│ 9.872 144│ error = ChefBuildError("\n\n".join(message_parts)) 9.872 145│ 9.872 146│ if error is not None: 9.872 → 147│ raise error from None 9.872 148│ 9.872 149│ return path 9.872 150│ 9.872 151│ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path: 9.872 9.872 Note: This error originates from the build backend, and is likely not a problem with poetry but with pyrepl (0.9.0) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "pyrepl (==0.9.0)"'. 9.872 ------ failed to solve: process "/bin/sh -c poetry install" did not complete successfully: exit code: 1 ```

How should this be manually tested?

Running docker compose build should pass for you