Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
tsela opened this issue Jun 16, 2020 · 3 comments
Closed
2 tasks done
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged

Comments

@tsela
Copy link

tsela commented Jun 16, 2020

  • 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?

@tsela tsela added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Jun 16, 2020
@raffraffraff
Copy link

While this is being worked on, how about updating the "Basic usage" page so that new users won't immediately run into an error when they follow the instructions: poetry new myproject ... followed by ... poetry init. Particularly because the error message it throws doesn't show up on the whole internet. (Which is why I'm pasting it here: "A pyproject.toml file with a poetry section already exists")

@finswimmer
Copy link
Member

Resolved by #9088

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants