Skip to content

Poetry 2.0 requires a "project.name" config even if "package-mode" is set #9988

@franknarf8

Description

@franknarf8

Description

I would expect the project.name config to be optional when the tool.poetry.package-mode is false.

[project]
requires-python = ">=3.10,<3.13"
name = "stuff"

[tool.poetry]
package-mode = false

Workarounds

Not specifying anything in the [project] section

Poetry Installation Method

pipx

Operating System

macos

Poetry Version

2.0.0

Example pyproject.toml

[project]
requires-python = ">=3.10,<3.13"

[tool.poetry]
package-mode = false

Poetry Runtime Logs

(non-package-mode-py3.12) ➜  AUR-aurora git:(feature/pyproject-toml) ✗ poetry@2 -vvv check 

  Stack trace:

  11  ~/.local/pipx/venvs/poetry@2/lib/python3.12/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

  10  ~/.local/pipx/venvs/poetry@2/lib/python3.12/site-packages/poetry/console/application.py:236 in _run
       234│ 
       235│         with directory(self._working_directory):
     → 236│             exit_code: int = super()._run(io)
       237│ 
       238│         return exit_code

   9  ~/.local/pipx/venvs/poetry@2/lib/python3.12/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│ 

   8  ~/.local/pipx/venvs/poetry@2/lib/python3.12/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

   7  ~/.local/pipx/venvs/poetry@2/lib/python3.12/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

   6  ~/.local/pipx/venvs/poetry@2/lib/python3.12/site-packages/cleo/commands/base_command.py:117 in run
       115│         io.input.validate()
       116│ 
     → 117│         return self.execute(io) or 0
       118│ 
       119│     def merge_application_definition(self, merge_args: bool = True) -> None:

   5  ~/.local/pipx/venvs/poetry@2/lib/python3.12/site-packages/cleo/commands/command.py:61 in execute
        59│ 
        60│         try:
     →  61│             return self.handle()
        62│         except KeyboardInterrupt:
        63│             return 1

   4  ~/.local/pipx/venvs/poetry@2/lib/python3.12/site-packages/poetry/console/commands/check.py:132 in handle
       130│ 
       131│         # Load poetry config and display errors, if any
     → 132│         poetry_file = self.poetry.file.path
       133│         toml_data = PyProjectTOML(poetry_file).data
       134│         check_result = Factory.validate(toml_data, strict=True)

   3  ~/.local/pipx/venvs/poetry@2/lib/python3.12/site-packages/poetry/console/commands/command.py:24 in poetry
        22│     def poetry(self) -> Poetry:
        23│         if self._poetry is None:
     →  24│             return self.get_application().poetry
        25│ 
        26│         return self._poetry

   2  ~/.local/pipx/venvs/poetry@2/lib/python3.12/site-packages/poetry/console/application.py:181 in poetry
       179│             return self._poetry
       180│ 
     → 181│         self._poetry = Factory().create_poetry(
       182│             cwd=self._project_directory,
       183│             io=self._io,

   1  ~/.local/pipx/venvs/poetry@2/lib/python3.12/site-packages/poetry/factory.py:60 in create_poetry
        58│             io = NullIO()
        59│ 
     →  60│         base_poetry = super().create_poetry(cwd=cwd, with_groups=with_groups)
        61│ 
        62│         if version_str := base_poetry.local_config.get("requires-poetry"):

  RuntimeError

  The Poetry configuration is invalid:
    - project must contain ['name'] properties
  

  at ~/.local/pipx/venvs/poetry@2/lib/python3.12/site-packages/poetry/core/factory.py:58 in create_poetry
       54│             message = ""
       55│             for error in check_result["errors"]:
       56│                 message += f"  - {error}\n"
       57│ 
    →  58│             raise RuntimeError("The Poetry configuration is invalid:\n" + message)
       59│ 
       60│         for warning in check_result["warnings"]:
       61│             logger.warning(warning)

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions