poetry icon indicating copy to clipboard operation
poetry copied to clipboard

docs: document `python` and `platform` dependency shorthands

Open rumitvn opened this issue 5 months ago • 1 comments

Closes #9183

What

Adds a python and platform shorthands subsection to the Using environment markers part of the dependency-specification docs.

Why

The marker docs document the markers property but never document the python and platform shorthand keys available on long-form [tool.poetry.dependencies] entries, nor how they combine with an explicit markers value (the issue's three asks).

The new subsection covers:

  • python → a version constraint on python_version (e.g. python = "^3.9" ⇒ python_version >= "3.9" and python_version < "4.0").
  • platform → an exact match on sys_platform (e.g. platform = "darwin").
  • That they are not deprecated, just shorthands, and that combining them with markers joins all conditions with and (with a worked example).
  • That they are only available in the legacy [tool.poetry.dependencies] table; the PEP 621 [project] table uses inline PEP 508 markers instead.

Scoped to documenting current behavior. Docs-only change.

rumitvn avatar Jun 13 '26 05:06 rumitvn

Thanks for the review @sourcery-ai!

  • platform values: clarified that the value is the raw sys.platform string (commonly darwin, win32, linux) and not a friendly name like macOS, with a link to the CPython sys.platform docs.
  • PEP 621 [project] table: the section already notes these shorthands are legacy-table-only and shows the equivalent inline PEP 508 marker for [project], so readers have the preferred alternative inline.

Pushed in 563a5cb.

rumitvn avatar Jun 14 '26 16:06 rumitvn