Skip to content

Why does poetry new not call poetry init to build the pyproject.toml file interactively? #2563

Description

@tsela
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

Hi,

I've recently switched from Pipenv to Poetry and so far this is working fine. It's a bit of an annoyance that VSCode does not recognise Poetry virtualenvs automatically like it does with Pipenv, but it's not Poetry's fault and I have a workaround for that anyway. However, there is something I don't understand about the behaviour of poetry new.

Right now, when I want to create a new project, I need to:

  1. Run poetry new to create the folder structure for the project with the right names for the folder and package;
  2. Delete the automatically created pyproject.toml file in order for the next step to work;
  3. run poetry init to create the pyproject.toml I actually want interactively;
  4. run poetry install --no-root to initialise the virtual environment.

The problem is that the project.toml created by poetry new lacks various fields like the license and description, and it's a bit weird to have to fill them by hand after poetry new when the poetry init command exists and works so well. But I can't just run poetry init after poetry new because it complains about an already existing pyproject.toml.

In fact, while I understand why one would want poetry init as a separate command, I don't understand why poetry new doesn't automatically call poetry init once it created the folder structure, so that one can build the pyproject.toml interactively. I understand why someone would not always want to do that, but poetry provides the --no-interaction option for that. So why isn't the default behaviour of poetry new to call poetry init, so that one can create the folder structure and the wanted pyproject.toml file in one go? I would expect that to be the most common workflow when creating a new project, so I find it weird that it's not supported out of the box and that I have to go through a weird uncomfortable step (having to erase an automatically created file) in order to make it work.

So I guess my feature request would be to make poetry new run poetry init to create the pyproject.toml file, either by default (with the --no-interaction option to bypass it) or using an option (maybe --init) if you really do not want to change the default behaviour. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureFeature requests/implementationsstatus/triageThis issue needs to be triaged

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions