[openstack-dev] [Nova][Deployers] Optional, platform specific, dependancies in requirements.txt

Clark Boylan cboylan at sapwetik.org
Wed Apr 11 22:20:55 UTC 2018


On Wed, Apr 11, 2018, at 3:09 PM, Michael Still wrote:
> Hi,
> 
> https://review.openstack.org/#/c/523387 proposes adding a z/VM specific
> dependancy to nova's requirements.txt. When I objected the counter argument
> is that we have examples of windows specific dependancies (os-win) and
> powervm specific dependancies in that file already.
> 
> I think perhaps all three are a mistake and should be removed.
> 
> My recollection is that for drivers like ironic which may not be deployed
> by everyone, we have the dependancy documented, and then loaded at runtime
> by the driver itself instead of adding it to requirements.txt. This is to
> stop pip for auto-installing the dependancy for anyone who wants to run
> nova. I had assumed this was at the request of the deployer community.
> 
> So what do we do with z/VM? Do we clean this up? Or do we now allow
> dependancies that are only useful to a very small number of deployments
> into requirements.txt?
> 
> Michael

I think there are two somewhat related issues here. The first is being able to have platform specific dependencies so that nova can run on say python2 and python3 or linux and windows using the same requirements list. To address this you should use environment markers [0] to specify when a specific environment needs additional or different packages to function and those should probably all just go into requirements.txt.

The second issue is enabling optional functionality that a default install shouldn't reasonably have to worry about (and is install platform independent). For this you can use setuptools extras[1]. For an example of how this is used along with setup.cfg and PBR you can look at swiftclient. Then users that know they want the extra features will execute something like `pip install python-swiftclient[keystone]`.

[0] https://www.python.org/dev/peps/pep-0496/
[1] http://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies
[2] https://git.openstack.org/cgit/openstack/python-swiftclient/tree/setup.cfg#n35

Hope this helps,
Clark



More information about the OpenStack-dev mailing list