Skip to content

poetry init should support generating classic [tool.poetry] layout by default (or via flag) | works well on Windows it causes trouble in Linux and MacOS. #10454

@04bhavyaa

Description

@04bhavyaa

Description

Currently, poetry init adopts the PEP 621-style [project] section with inline tables for authors and dependencies by default. While this is standard‑compliant, many teams still prefer the classic [tool.poetry] layout with explicit packages = [...] and separate dependency sections—particularly for Django-style applications with multiple modules. Unfortunately, there’s no flag or config option to switch this behavior in Poetry 2.x, requiring manual edits post‑init on Linux, macOS, and Windows.

Though the default format works well on Windows it causes trouble in Linux and MacOS.

Proposal
Enhance poetry init (and optionally poetry new) by supporting a new flag or configuration, such as

  • --tool-poetry: generate [tool.poetry]-style metadata
  • --package-mode: align metadata generation with package mode expectations
  • Or add a .poetryrc config option (e.g., init.use_tool_poetry = true)

With one of these additions, users can opt into classic layout that includes:

toml

[tool.poetry]
name = "my-app"
version = "0.1.0"
authors = ["Name <email>"]
packages = [{include = "Ai_literacy_bot"}, {include = "app"}]

[tool.poetry.dependencies]
django = ">=5.2.3,<6.0.0"
...

Workarounds

Workaround can be manually edit the default generated pyproject.toml file to opt into classic layout!

Poetry Installation Method

pipx

Operating System

Linux

Poetry Version

2.1.3

Poetry Configuration

cache-dir = "C:\\Users\\bhavy\\AppData\\Local\\pypoetry\\Cache"
data-dir = "C:\\Users\\bhavy\\AppData\\Roaming\\pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = "{data-dir}\\python"  # C:\Users\bhavy\AppData\Roaming\pypoetry\python
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\bhavy\AppData\Local\pypoetry\Cache\virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false

Python Sysconfig

sysconfig.log
Paste the output of 'python -m sysconfig', over this line.

Example pyproject.toml

[project]
name = "ai-literacy-bot"
version = "0.1.0"
description = ""
authors = [
    {name = "Arshit Arora",email = "[email protected]"}
]
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
    "django (>=5.2.3,<6.0.0)",
    "pydantic (>=2.11.7,<3.0.0)",
    "google-generativeai (>=0.8.5,<0.9.0)",
    "python-dotenv (>=1.1.1,<2.0.0)",
    "pydantic-settings (>=2.10.1,<3.0.0)",
    "gunicorn (>=23.0.0,<24.0.0)",
    "colorlog (>=6.9.0,<7.0.0)",
    "gradio (>=4.0.0,<5.0.0)",
    "requests (>=2.31.0,<3.0.0)"
]


[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"

Poetry Runtime Logs

poetry-runtime.log
Paste the output of 'poetry -vvv <command>', over this line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureFeature requests/implementationsstatus/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