python-poetry / python-poetry/poetry

`version` field not required in `[project]` table when `package-mode = false`

Open
#10,032 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

Description

This pyproject.toml file is allowed by Poetry 2.0.1:

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

[tool.poetry]
package-mode = false

But should be disallowed according to PEP 621

According to the spec:

The keys which are required but may be specified either statically or listed as dynamic are:

  • version

Since the name field is being required by Poetry, the version field should also be required to exist during check, lock, sync, etc.

Workarounds

Manually verify you have added the version field to be compliant.

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 check -vvv
Loading configuration file C:\Users\User\AppData\Roaming\pypoetry\config.toml
All set!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the configuration from the issue and run poetry check -vvv; compare the current validation behavior with the PEP 621 project-table requirements. Trace how package-mode = false is handled for check, lock, and sync. Done means a missing version is rejected while the existing package-mode behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.