Skip to content

Poetry init -n causes crashes on poetry >= 1.2.0a2 #5103

Closed

Description

@max-wittig
  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: debian:stable docker image (12.1 macOS / Containerd)

  • Poetry version: 1.2.0a2 | latest master (8d9fdad)

  • Link of a Gist with the contents of your pyproject.toml file: no pyproject.toml file

Issue

  1. Run poetry init -n and observe the crash on version >= 1.2.0a2
root@4a73891740bc:/# poetry init -n

  IndexError

  tuple index out of range

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/layouts/layout.py:91 in get_package_include
       87│ 
       88│     def get_package_include(self) -> Optional["InlineTable"]:
       89│         package = inline_table()
       90│ 
    →  91│         include = self._package_path_relative.parts[0]
       92│         package.append("include", include)
       93│ 
       94│         if self.basedir != Path():
       95│             package.append("from", self.basedir.as_posix())
root@4a73891740bc:/# poetry init -n -vvv

  Stack trace:

  9  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:330 in run
      328│ 
      329│             try:
    → 330│                 exit_code = self._run(io)
      331│             except Exception as e:
      332│                 if not self._catch_exceptions:

  8  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/console/application.py:174 in _run
      172│         self._load_plugins(io)
      173│ 
    → 174│         return super()._run(io)
      175│ 
      176│     def _configure_io(self, io: "IO") -> None:

  7  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:425 in _run
      423│                 io.set_input(ArgvInput(argv))
      424│ 
    → 425│         exit_code = self._run_command(command, io)
      426│         self._running_command = None
      427│ 

  6  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:467 in _run_command
      465│ 
      466│         if error is not None:
    → 467│             raise error
      468│ 
      469│         return event.exit_code

  5  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:451 in _run_command
      449│ 
      450│             if event.command_should_run():
    → 451│                 exit_code = command.run(io)
      452│             else:
      453│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  4  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/commands/base_command.py:118 in run
      116│         io.input.validate()
      117│ 
    → 118│         status_code = self.execute(io)
      119│ 
      120│         if status_code is None:

  3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/commands/command.py:85 in execute
       83│ 
       84│         try:
    →  85│             return self.handle()
       86│         except KeyboardInterrupt:
       87│             return 1

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/console/commands/init.py:225 in handle
      223│         )
      224│ 
    → 225│         content = layout_.generate_poetry_content(original=pyproject)
      226│         if self.io.is_interactive():
      227│             self.line("Generated file")

  1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/layouts/layout.py:134 in generate_poetry_content
      132│ 
      133│         poetry_content["readme"] = f"README.{self._readme_format}"
    → 134│         packages = self.get_package_include()
      135│         if packages:
      136│             poetry_content["packages"].append(packages)

  IndexError

  tuple index out of range

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/layouts/layout.py:91 in get_package_include
       87│ 
       88│     def get_package_include(self) -> Optional["InlineTable"]:
       89│         package = inline_table()
       90│ 
    →  91│         include = self._package_path_relative.parts[0]
       92│         package.append("include", include)
       93│ 
       94│         if self.basedir != Path():
       95│             package.append("from", self.basedir.as_posix())

Activity

  1. github-actions commented on Mar 1, 2024

    @github-actions

    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.

  2. locked as resolved and limited conversation to collaborators on Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions