6

it is possible to install some special sub-package from package?

For example, I want to create package with slack, datadog, sentry plugins (wrappers). But I want to allow user what he wants to install.

Like:

pip install super_plugins --plugins slack, datadog

Can it be done without separating all plugins to different packages?

fuzzy
  • 97
  • 6
Vladimir Chernenko
  • 423
  • 2
  • 6
  • 10
  • You could provide a package with the basics and then provide extensions to download more as needed, similar to `nltk.download()` – cs95 Jul 26 '17 at 10:27

1 Answers1

9

Actually, It is quite simple. This is called Packaging namespace packages. https://packaging.python.org/guides/packaging-namespace-packages/

All you need is to separate all packages to sub - packages and after install it with a namespace.

# for all packages
pip install super_plugins

# for specific
pip install super_plugins.slack super_plugins.datadog
Vladimir Chernenko
  • 423
  • 2
  • 6
  • 10
  • 4
    Is this right? My understanding of namespace packages is that it allows you to have a single package spread across multiple directories, all using the same namespace. Not having optional subpackages within a parent package. Can you give some more details on how you achieved this? – S.B.G Jun 28 '19 at 12:37