libcloud icon indicating copy to clipboard operation
libcloud copied to clipboard

[Proposal] Add `Optional` (default `None`) to Node classes

Open ccrvlh opened this issue 3 years ago • 3 comments

Proposal

Some classes have attributes that are not required for building a Node. For example, we don't need the NodeSize.bandwidth argument to create a new node. Only the id is necessary. But we still have to instanciate the NodeSize class with bandwidth=None since it's a required argument. It could be possible to add a default None value to each optional argument to make things simpler when using Sizes/Images/Locations.

ccrvlh avatar Apr 09 '22 22:04 ccrvlh

Yeah, making some of those arguments optional seems reasonable to me.

Adding None default value should be fine, we just can't move the method arguments around (change the method signature) since that would be backward incompatible / breaking change.

Kami avatar May 10 '22 22:05 Kami

Makes sense. I haven't use many drivers yet (mostly EC2, DO and GCP), maybe start with those. Also I noticed the tests (docker) still include Python 3.5, which was deprecated it seems, I imagine it's ok to drop those? Tox complains about the 3.5, cant remember exactly why.

ccrvlh avatar May 11 '22 22:05 ccrvlh

@Kami sorry the delay. I made the changes here: https://github.com/apache/libcloud/compare/trunk...lowercase00:libcloud:optional_args It seems that 3.5 wasn't working anymore, I removed just to run the tests. Can reverse the changes on the dockerfile and just keep the "optional" arguments.

ccrvlh avatar Aug 08 '22 06:08 ccrvlh