[Python] Python poetry - how to install optional dependencies?

Discussão em 'Python' iniciado por Stack, Fevereiro 27, 2025.

  1. Stack

    Stack Membro Participativo

    Python's poetry dependency manager allows specifying optional dependencies via command:

    $ poetry add --optional redis


    Which results in this configuration:

    [tool.poetry.dependencies]
    python = "^3.8"
    redis = {version="^3.4.1", optional=true}


    However how do you actually install them? Docs seem to hint to:

    $ poetry install -E redis


    but that just throws and error:

    Installing dependencies from lock file

    [ValueError]
    Extra [redis] is not specified.

    Continue reading...

Compartilhe esta Página