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

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

Closed
3 tasks done
max-wittig opened this issue Jan 26, 2022 · 1 comment · Fixed by #5612
Closed
3 tasks done

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

max-wittig opened this issue Jan 26, 2022 · 1 comment · Fixed by #5612
Labels
kind/bug Something isn't working as expected

Comments

@max-wittig
Copy link

max-wittig commented Jan 26, 2022

  • 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())
@max-wittig max-wittig added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 26, 2022
@mkniewallner mkniewallner removed the status/triage This issue needs to be triaged label Jun 11, 2022
Copy link

github-actions bot commented Mar 1, 2024

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 Mar 1, 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants