python-poetry / python-poetry/poetry
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.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
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 = "arshitkumar@gmail.com"}
]
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the poetry init entry point and inspect how it currently writes the generated pyproject.toml, especially the [project] metadata and dependency sections. Compare that output with the requested [tool.poetry] layout and define the chosen flag or configuration behavior; done means poetry init can opt into that layout and the result is verified on Linux, macOS, and Windows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100