1

I have my own pip package, which is called my_package. It's quite large, and I want to split it into a few packages, which I can optionally install if necessary. So my goal is: to have main package called my_package, and some extra packages (for example, my_package[extra1]), which can extend functionality of the main package.

I've done some research, and found out that you can specify [project.optional-dependencies] in pyproject.toml file, and it will install neccessary optional dependencies to your project. And it seems like a good idea: to make an optional functionality as a separate pip package.

But the question is: how to gracefully implement it into the main package? I mean, I want to install this "extra" package by pip install my_package[extra1], and it should lead to automatically added functionality to my project.

Under the hood it just installes a different package, but how to use it by the main package?

Should I check the dependency existance in environment by some way?

Poision88
  • 43
  • 5

0 Answers0