Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tuple index out of range when tool.poetry.name is "" #8113

Closed
4 tasks done
silverwind opened this issue Jun 18, 2023 · 6 comments
Closed
4 tasks done

tuple index out of range when tool.poetry.name is "" #8113

silverwind opened this issue Jun 18, 2023 · 6 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@silverwind
Copy link

  • Poetry version: 1.5.1
  • Python version: 3.11.4
  • OS version and name: macOS
  • pyproject.toml:
[tool.poetry]
name = ""
version = "0.0.0"
description = ""
authors = []

[tool.poetry.dependencies]
python = "^3.8"
  • 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

Putting a dummy name "" into tool.poetry.name, causes poetry to crash with tuple index out of range inside pathlib.

#1132 is related, I'm trying to find the minimum possible pyproject.toml for projects that are not python projects but still have dependencies via poetry.

Debug output
$ poetry -vvv install
Using virtualenv: /Users/silverwind/Library/Caches/pypoetry/virtualenvs/-dwWqH-Ig-py3.11
Installing dependencies from lock file

Finding the necessary packages for the current system

  Stack trace:

  14  /usr/local/lib/python3.11/site-packages/cleo/application.py:327 in run
       325│
       326│             try:
     → 327│                 exit_code = self._run(io)
       328│             except BrokenPipeError:
       329│                 # If we are piped to another process, it may close early and send a

  13  /usr/local/lib/python3.11/site-packages/poetry/console/application.py:190 in _run
       188│         self._load_plugins(io)
       189│
     → 190│         exit_code: int = super()._run(io)
       191│         return exit_code
       192│

  12  /usr/local/lib/python3.11/site-packages/cleo/application.py:431 in _run
       429│             io.input.interactive(interactive)
       430│
     → 431│         exit_code = self._run_command(command, io)
       432│         self._running_command = None
       433│

  11  /usr/local/lib/python3.11/site-packages/cleo/application.py:473 in _run_command
       471│
       472│         if error is not None:
     → 473│             raise error
       474│
       475│         return terminate_event.exit_code

  10  /usr/local/lib/python3.11/site-packages/cleo/application.py:457 in _run_command
       455│
       456│             if command_event.command_should_run():
     → 457│                 exit_code = command.run(io)
       458│             else:
       459│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

   9  /usr/local/lib/python3.11/site-packages/cleo/commands/base_command.py:119 in run
       117│         io.input.validate()
       118│
     → 119│         status_code = self.execute(io)
       120│
       121│         if status_code is None:

   8  /usr/local/lib/python3.11/site-packages/cleo/commands/command.py:62 in execute
        60│
        61│         try:
     →  62│             return self.handle()
        63│         except KeyboardInterrupt:
        64│             return 1

   7  /usr/local/lib/python3.11/site-packages/poetry/console/commands/install.py:171 in handle
       169│
       170│         try:
     → 171│             builder = EditableBuilder(self.poetry, self.env, self.io)
       172│         except ModuleOrPackageNotFound:
       173│             # This is likely due to the fact that the project is an application

   6  /usr/local/lib/python3.11/site-packages/poetry/masonry/builders/editable.py:47 in __init__
        45│     def __init__(self, poetry: Poetry, env: Env, io: IO) -> None:
        46│         self._poetry: Poetry
     →  47│         super().__init__(poetry)
        48│
        49│         self._env = env

   5  /usr/local/lib/python3.11/site-packages/poetry/core/masonry/builders/builder.py:85 in __init__
        83│             includes.append(include)
        84│
     →  85│         self._module = Module(
        86│             self._package.name,
        87│             self._path.as_posix(),

   4  /usr/local/lib/python3.11/site-packages/poetry/core/masonry/utils/module.py:79 in __init__
        77│
        78│             self._includes.append(
     →  79│                 PackageInclude(
        80│                     self._path,
        81│                     package["include"],

   3  /usr/local/lib/python3.11/site-packages/poetry/core/masonry/utils/package_include.py:28 in __init__
        26│             base = base / source
        27│
     →  28│         super().__init__(base, include, formats=formats)
        29│         self.check_elements()
        30│

   2  /usr/local/lib/python3.11/site-packages/poetry/core/masonry/utils/include.py:31 in __init__
        29│         self._formats = formats
        30│
     →  31│         self._elements: list[Path] = sorted(self._base.glob(str(self._include)))
        32│
        33│     @property

   1  /usr/local/Cellar/[email protected]/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pathlib.py:952 in glob
        950│         if pattern[-1] in (self._flavour.sep, self._flavour.altsep):
        951│             pattern_parts.append('')
     →  952│         selector = _make_selector(tuple(pattern_parts), self._flavour)
        953│         for p in selector.select_from(self):
        954│             yield p

  IndexError

  tuple index out of range

  at /usr/local/Cellar/[email protected]/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pathlib.py:282 in _make_selector
       278│ # Globbing helpers
       279│ #
       280│
       281│ def _make_selector(pattern_parts, flavour):
    →  282│     pat = pattern_parts[0]
       283│     child_parts = pattern_parts[1:]
       284│     if not pat:
       285│         return _TerminatingSelector()
       286│     if pat == '**':
@silverwind silverwind added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 18, 2023
@dimbleby
Copy link
Contributor

duplicate #7185

@silverwind
Copy link
Author

I wouldn't say it's a duplicate as the steps to reproduce are different here. The underlying bug is the same, thought.

@dimbleby
Copy link
Contributor

dimbleby commented Jun 18, 2023

The underlying bug is the same, though.

Quite so - these issues report the same bug. If and when anyone ever fixes them they will have the same fix. Tracking it twice is not helpful.

Feel free to update the other with additional information: but these are indeed duplicates.

@silverwind
Copy link
Author

Will add info to the other.

@silverwind silverwind closed this as not planned Won't fix, can't repro, duplicate, stale Jun 18, 2023
@silverwind
Copy link
Author

I'd argue this PR has better steps to reproduce than #7185 because they didn't include their pyproject.toml in the bug report, so if you like, close the other and keep this one.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants