1

I have a unique use case where my python package specifies 3 optional dependencies to setuptools.setup using the extras_require argument. While each of those individual dependencies is kind of optional, it is still required that at least of them be specified during install time. Is there any way to specify this requirement or ensure this behavior from the user side?

I do not want to move any of these optional dependencies into required dependencies since each of the 3 optional packages are each quite heavy and require a specific environment to work. The main package does require only 1 of the optional dependencies at a time and forcing the installation of all 3 feels incorrect and forceful.

Ideally, I want pip install my_package to fail with an error stating to specify one of 3 optional dependencies.

Expected usages are:

pip install my_package[dep_1]        // or
pip install my_package[dep_2]        // or
pip install my_package[dep_2,dep_3]  // etc...
1
  • "s there any way to specify this requirement or ensure this behavior from the user side?" such complex dependency management is not supported by Python packaging, as the use case is very niche. Solutions include e.g. README installation instructions or having. custom installation script. Commented Jul 19, 2024 at 1:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.