python-poetry / python-poetry/poetry

Unhelpful errors for projects in root directory

Open
#7,185 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • Poetry version: 1.3.1
  • Python version: 3.11
  • OS version and name: ubuntu
  • pyproject.toml: see below
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

Repro: running docker build . with this Dockerfile shows an unhelpful "tuple index out of range" error:

FROM python:3.11

RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH=/root/.local/bin:$PATH
RUN poetry --version
RUN poetry init
RUN poetry install

Seems to happen when packages is not specified in pyproject.toml and poetry tries to automatically add an Include that has a glob pattern ., which is an invalid glob:

>>> list(Path("/").glob("."))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/pathlib.py", line 1139, in glob
    selector = _make_selector(tuple(pattern_parts), self._flavour)
  File "/usr/local/lib/python3.8/pathlib.py", line 463, in _make_selector
    pat = pattern_parts[0]
IndexError: tuple index out of range

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running docker build . with the Dockerfile shown and inspect the generated pyproject.toml. Trace the automatic Include handling when packages is omitted and the resulting Path.glob(".") failure. Done means root-directory projects avoid the invalid glob or report a useful error, with a regression test for this reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.