Poetry: Support "standard" square bracket syntax for package extras

Created on 12 Sep 2018  路  6Comments  路  Source: python-poetry/poetry

  • [x] I have searched the issues of this repo and believe that this is not a duplicate.

Issue

It would be great if poetry would support the "standard" square bracket syntax to specify package extras (i.e. somepackage[someextra]).

I'm aware of the -E option but it's a departure from what other tools are doing and also it's not immediately clear how to specify multiple different extras for multiple packages.

Most helpful comment

If you try:

poetry add testcontainers[postgresql]

You'll get:

testcontainers = {extras = ["postgresql"], version = "^2.6.0"}

All 6 comments

What is the recommended way of installing extras?

In other words what would be the equivalent of the command pip install dash[testing]?

This is supported in the latest prereleases of the 1.0.0 release and will be globally available when it's officially released.

I'm unable to make use of this feature. The following is my pyproject.toml contents excerpt:

[tool.poetry.dependencies]
python = "^3.7"
...
testcontainers[postgresql] = "2.6.0"

This one throws the following error when issuing poetry install -v --dry-run

[UnexpectedCharError]
Unexpected character: u'p' at line 24 col 15

which is the character p in testcontainers[postgresql].
I would appreciate if someone can point to any workaround. Thanks!

poetry --version
Poetry version 1.0.5

If you try:

poetry add testcontainers[postgresql]

You'll get:

testcontainers = {extras = ["postgresql"], version = "^2.6.0"}

That helped. Appreciate the quick response @clintonroy !

For anyone stumbling on this with the same issue as me:

  • poetry add apache-beam[gcp] errors with zsh: no matches found: apache-beam[gcp]
  • Writing poetry add "apache-beam[gcp]" fixed this
Was this page helpful?
0 / 5 - 0 ratings