Search code examples
pythondevopspython-poetry

Initialize a Python Poetry project without human interaction


I'd love to initialize a poetry-generated project without going through the interactive shell for versions and dependencies etc.

However, a few attempts of fiddling around with the command line options all failed.

Such as

poetry init --name my_proj --description  "my proj" --author john.doe --python 3.9 --dependency "pytest:^6.2.0" --dev-dependency coverage -l MIT

gives me the interactive shell to confirm all the info I provided.

Expectation

I expect that by giving all the dependencies, the command should generate a pyproject.toml automatically without me entering anything.

Where am I wrong?


Solution

  • Just add -n or --no-interaction to your command and you will get what you are asking for.