Search code examples
pythonpython-poetry

Python poetry adding dependency to a group


I am using Poetry of version 1.3.2 (currently the last version), and added group to .toml file as below: [tool.poetry.group.dev.dependencies].

And following official documentation tried to add library to this group using command:
poetry add pytest --group dev.

But always getting error that says: The "--group" option does not exist.

(Using python of version 3.9.15)

I tried to change version of poetry to 1.2.x, but it did not help.


Solution

  • Just type:

    poetry add --group dev 'package_name'
    

    That should work