Lazy entry#822
Conversation
… on module-level import, in setuptools this causes an issue as it's before the pip job runs
|
I'm not too opinionated about of and I'm fine with the overall change and "external API". |
| _init_once() | ||
|
|
||
|
|
||
| class DriverType: |
There was a problem hiding this comment.
Good idea to be consistent and inherit from object even if it's just used as an ENUM class.
|
@Kami updated |
| try: | ||
| return DriverTypeFactoryMap[type](provider) | ||
| except KeyError: | ||
| raise DriverTypeNotFoundError() |
There was a problem hiding this comment.
I think it would also be good to include type in the error message.
There was a problem hiding this comment.
And test for it would be nice :)
Besides that, LGTM, 👍
|
Would also be good to be update upgrade notes if want this to be a preferred approach for retrieving a driver down the road :) For that though, it might be worth soliciting feedback and reaching consensus from more people. |
|
Looks good to me. A good follow-on would be to update site docs / examples for this new approach. |
|
Observation from an outsider... If you're defining a provider class as
to:
Just a thought, either way seems much cleaner than the current method. |
|
@JamieCressey that would be better using the Enum base type in Python 3.4+ but once it has been called, its already been converted into the value (string), and there's no difference in values between |
|
I'm pushing this in unless any serious objections? |
|
merging |
Introduce a convenience method to the libcloud module for getting drivers
Description
I find the current mechanism for fetching drivers a little cumbersome, 2 namespaces to import. After using the
requestslibrary I really like the module__init__accessors for common attributes. The most common factory isget_driverand the most common enum is the Provider enum.This code allows for this example:
Status
Checklist (tick everything that applies)