Skip to content

name field required for package-mode false after migrating to [project] #10031

@johnthagen

Description

@johnthagen

Description

I migrated this pyproject.toml file:

[tool.poetry]
package-mode = false

[tool.poetry.dependencies]
python = ">=3.10"
mkdocs = "*"

To the new equivalent [project] section:

[project]
requires-python = ">=3.10"
dependencies = [
    "mkdocs",
]

[tool.poetry]
package-mode = false

But are presented with an error trying to lock or sync the dependencies (poetry check also fails):

$ poetry sync

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

With package-mode = false, I would expect all package/wheel metadata to still remain optional.

Workarounds

Adding a boilerplate name section back

[project]
name = "a"
requires-python = ">=3.10"
dependencies = [
    "mkdocs",
]

[tool.poetry]
package-mode = false

Poetry Installation Method

pipx

Operating System

Windows 10

Poetry Version

Poetry (version 2.0.1)

Poetry Configuration

cache-dir = "C:\\Users\\User\\AppData\\Local\\pypoetry\\Cache"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}\\virtualenvs"  # C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false

Python Sysconfig

sysconfig.log
Platform: "win-amd64"
Python version: "3.10"
Current installation scheme: "nt"

Paths: 
      data = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10"
      include = "C:\Program Files\Python310\Include"
      platinclude = "C:\Program Files\Python310\Include"
      platlib = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10\Lib\site-packages"
      platstdlib = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10\Lib"
      purelib = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10\Lib\site-packages"
      scripts = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10\Scripts"
      stdlib = "C:\Program Files\Python310\Lib"

Variables: 
      BINDIR = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10\Scripts"
      BINLIBDEST = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10\Lib"
      EXE = ".exe"
      EXT_SUFFIX = ".cp310-win_amd64.pyd"
      INCLUDEPY = "C:\Program Files\Python310\Include"
      LIBDEST = "C:\Program Files\Python310\Lib"
      SO = ".cp310-win_amd64.pyd"
      TZPATH = ""
      VERSION = "310"
      abiflags = ""
      base = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10"    
      exec_prefix = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10"
      installed_base = "C:\Program Files\Python310"
      installed_platbase = "C:\Program Files\Python310"
      platbase = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10"
      platlibdir = "lib"
      prefix = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10"  
      projectbase = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10\Scripts"
      py_version = "3.10.11"
      py_version_nodot = "310"
      py_version_nodot_plat = "310"
      py_version_short = "3.10"
      srcdir = "C:\Users\User\AppData\Local\pypoetry\Cache\virtualenvs\poetry-test-CSqu6s7h-py3.10\Scripts"
      userbase = "C:\Users\User\AppData\Roaming\Python"

Poetry Runtime Logs

poetry-runtime.log
poetry check -vvv

Stack trace:

11  ~\.local\pipx\venvs\poetry\Lib\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\Lib\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\Lib\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\Lib\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\Lib\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\Lib\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\Lib\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\Lib\site-packages\poetry\console\commands\check.py:137 in handle      
     135│ 
     136│         # Load poetry config and display errors, if any
   → 137│         poetry_file = self.poetry.file.path
     138│         toml_data = PyProjectTOML(poetry_file).data
     139│         check_result = Factory.validate(toml_data, strict=True)

 3  ~\.local\pipx\venvs\poetry\Lib\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\Lib\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\Lib\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\Lib\site-packages\poetry\core\factory.py:59 in create_poetry
     55│             message = ""
     56│             for error in check_result["errors"]:
     57│                 message += f"  - {error}\n"
     58│
  →  59│             raise RuntimeError("The Poetry configuration is invalid:\n" + message)
     60│
     61│         for warning in check_result["warnings"]:
     62│             logger.warning(warning)
     63│

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