I am trying to use setup-python action with a monorepo, but because pyproject.toml is not found at the root, the action fails to activate the right version of Python.
Run actions/setup-python@v4
Version 3.10.0 was not found in the local cache
Version 3.10.0 is available for downloading
Download from "https://github.com/actions/python-versions/releases/download/3.10.0-117927/python-3.10.0-linux-20.04-x64.tar.gz"
Extract downloaded archive
/usr/bin/tar xz --warning=no-unknown-keyword -C /home/runner/work/_temp/8cd8a45c-988b-46ca-89a9-ace52fc1c49d -f /home/runner/work/_temp/a061c229-0095-4087-a188-e56c51dce536
Execute installation script
Check if Python hostedtoolcache folder exist...
Create Python 3.10.0 folder
Copy Python binaries to hostedtoolcache folder
Create additional symlinks (Required for the UsePythonVersion Azure Pipelines task and the setup-python GitHub Action)
Upgrading pip...
Looking in links: /tmp/tmp6iiiom0p
Requirement already satisfied: setuptools in /opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages (57.4.0)
Requirement already satisfied: pip in /opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/site-packages (21.2.3)
Collecting pip
Downloading pip-22.2.2-py3-none-any.whl (2.0 MB)
Installing collected packages: pip
Successfully installed pip-22.2.2
Create complete file
Successfully set up CPython (3.10.0)
/opt/pipx_bin/poetry config --list
cache-dir = "/home/runner/.cache/pypoetry"
experimental.new-installer = true
installer.parallel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.path = "{cache-dir}/virtualenvs" # /home/runner/.cache/pypoetry/virtualenvs
/opt/pipx_bin/poetry env use /opt/hostedtoolcache/Python/3.10.0/x64/bin/python
RuntimeError
Poetry could not find a pyproject.toml file in /home/runner/work/my_proj/my_proj or its parents
at /opt/pipx/venvs/poetry/lib/python3.8/site-packages/poetry/core/factory.py:369 in locate
365│ if poetry_file.exists():
366│ return poetry_file
367│
368│ else:
→ 369│ raise RuntimeError(
370│ "Poetry could not find a pyproject.toml file in {} or its parents".format(
371│ cwd
372│ )
373│ )
Warning:
poetry cache is not found
As a consequence, the following steps fail. How should I work around this?