[tool.poetry]
name = "awesome"
[tool.poetry.dependencies]
# These packages are mandatory and form the core of this package’s distribution.
mandatory = "^1.0"
# A list of all of the optional dependencies, some of which are included in the
# below `extras`. They can be opted into by apps.
psycopg2 = { version = "^2.9", optional = true }
mysqlclient = { version = "^1.3", optional = true }
[tool.poetry.extras]
mysql = ["mysqlclient"]
pgsql = ["psycopg2"]
databases = ["mysqlclient", "psycopg2"]
My question is, what if we don't want to set these dependencies as optional within the repo ?
[tool.poetry]
name = "awesome"
[tool.poetry.dependencies]
# These packages are mandatory and form the core of this package’s distribution.
mandatory = "^1.0"
psycopg2 = "^2.9"
mysqlclient = "^1.3"
[tool.poetry.extras]
mysql = ["mysqlclient"]
pgsql = ["psycopg2"]
databases = ["mysqlclient", "psycopg2"]
Basically, a poetry install inside the repo would install everything, and poetry add awesome would not install pyscopg2 nor mysqlclient unless a -E option is selected.
This makes sense from a developer point of view to treat extra as dev package to perform e.g. tests or docker build
From my experience, this works the way I thought, and extra without mentioning optional still makes packages optional when installing them from outside.
My question, is this behaviour in some way official ? Can I consider this undocumented feature to be stable ? And if so, would it be interesting to mention is in the docs ?
For me, extras and optional are two different things. I know it will be confusing when there is already some confusion between extras and groups, but I feel like this usage of non-optional extras is legitimate and could be officialized in some way.
Issue Kind
Improving documentation
Existing Link
https://python-poetry.org/docs/pyproject/#extras
Description
In the documentation for extra, we can read this :
https://python-poetry.org/docs/pyproject/#extras
My question is, what if we don't want to set these dependencies as optional within the repo ?
Basically, a
poetry install
inside the repo would install everything, andpoetry add awesome
would not install pyscopg2 nor mysqlclient unless a-E
option is selected.This makes sense from a developer point of view to treat extra as dev package to perform e.g. tests or docker build
From my experience, this works the way I thought, and extra without mentioning optional still makes packages optional when installing them from outside.
My question, is this behaviour in some way official ? Can I consider this undocumented feature to be stable ? And if so, would it be interesting to mention is in the docs ?
For me, extras and optional are two different things. I know it will be confusing when there is already some confusion between extras and groups, but I feel like this usage of non-optional extras is legitimate and could be officialized in some way.