How to declare optional dependencies?
Maybe I'm totally overlooking something or misreading the docs, but I can't find a way to say in a requirements.txt file that a dependency is optional and its failure to install is okay. E.g., aiohttp supports using cchardet as an accelerator of chardet ( http://aiohttp.readthedocs.org/en/stable/#library-installation). I would like to be able to specify in my requirements.txt that I would like cchardet to be installed if possible, but it not being available -- which it might be as it doesn't have any Python 3.5 wheels ATM -- is fine and not the end of the world. I'm also happy to push a patch upstream if there is something aiohttp should be setting in their setup.py instead (I thought maybe extras, but those seem to be hard requirements as well).
I don't think you're overlooking anything.
A recent thread:
https://mail.python.org/pipermail/distutils-sig/2015-December/027944.html
My comment there:
https://mail.python.org/pipermail/distutils-sig/2015-December/027946.html
-n
On Fri, Feb 5, 2016 at 10:52 AM, Brett Cannon
Maybe I'm totally overlooking something or misreading the docs, but I can't find a way to say in a requirements.txt file that a dependency is optional and its failure to install is okay. E.g., aiohttp supports using cchardet as an accelerator of chardet (http://aiohttp.readthedocs.org/en/stable/#library-installation). I would like to be able to specify in my requirements.txt that I would like cchardet to be installed if possible, but it not being available -- which it might be as it doesn't have any Python 3.5 wheels ATM -- is fine and not the end of the world.
I'm also happy to push a patch upstream if there is something aiohttp should be setting in their setup.py instead (I thought maybe extras, but those seem to be hard requirements as well).
_______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
-- Nathaniel J. Smith -- https://vorpus.org
On 6 February 2016 at 04:52, Brett Cannon
Maybe I'm totally overlooking something or misreading the docs, but I can't find a way to say in a requirements.txt file that a dependency is optional and its failure to install is okay. E.g., aiohttp supports using cchardet as an accelerator of chardet (http://aiohttp.readthedocs.org/en/stable/#library-installation). I would like to be able to specify in my requirements.txt that I would like cchardet to be installed if possible, but it not being available -- which it might be as it doesn't have any Python 3.5 wheels ATM -- is fine and not the end of the world.
No, we don't have anything comparable to the Recommends/Suggests weak dependency system offered by distro package managers. Being able to specify "install this dependency if it is missing and a pre-built binary is available, otherwise skip it" could be a nice way for software publishers to be able to tweak the install experience of their package though - everyone gets a clean install experience, but the folks with relevant pre-built dependencies available get improved runtime performance. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
participants (3)
-
Brett Cannon
-
Nathaniel Smith
-
Nick Coghlan