2

One could describe a software dependency as being some code or library that is used in a particular package or project which without the required dependency, one would not be able to package the project as a fully functioning program. An 'optional dependency' sounds to a novice software engineer like a contradiction -- e.g. that a project is both dependent on a particular package, but the dependency is also optional and not strictly required.

Eoin Dowling
  • 373
  • 3
  • 15
  • 2
    Usually for optional functionality, e.g. Pelican needs the Markdown dependencies if you want to use Markdown, but doesn't if you want to use RST (https://docs.getpelican.com/en/latest/install.html, https://github.com/getpelican/pelican/blob/1219bcd029a9386fdc2a398b79a72e60fb1fdb08/setup.py#L58-L60). This isn't really a pip-/python-specific issue, see e.g. https://stackoverflow.com/q/40393098/3001761, https://stackoverflow.com/q/20993068/3001761. It might be better for [softwareengineering.se]. – jonrsharpe Apr 12 '21 at 16:34

1 Answers1

1

Optional dependencies are not optional for your project, but when another project depends on your project, these now transitive dependencies are ignored/not resolved. You would do this for features that are not always needed, and to lessen the burden on upstream projects https://blog.gradle.org/optional-dependencies

This is different from a "provided" scope where the dependency is always required, but its up to the environment to make it available. The dependency is not deployed / is not required in your distribution.

caduceus
  • 1,542
  • 2
  • 16
  • 21