Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy issues as of 2.8.0 #1413

Closed
dpeschman opened this issue Jan 17, 2020 · 3 comments · Fixed by #1414 or #1429
Closed

mypy issues as of 2.8.0 #1413

dpeschman opened this issue Jan 17, 2020 · 3 comments · Fixed by #1414 or #1429

Comments

@dpeschman
Copy link
Contributor

Summary

Just wanted to feed back to you all a couple issues we had running mypy on our custom drivers after upgrading to libcloud 2.8.0.

Detailed Information

  • The type of NodeDriver.type is Provider, but our custom drivers assign a string to this field which cause a mypy error. Perhaps it should be Union[Provider, str]?
  • NodeSize, NodeLocation, and NodeImage have driver typed to be Type[NodeDriver] in their constructors, but this does not match Node, StorageVolume, and others which have it typed as NodeDriver. We have subclasses of some of these and use self.driver as an instance of a driver, just like the Node class, and not as a driver class.
@dpeschman
Copy link
Contributor Author

Forgot one more - what do you think about adding **kwargs back to create_node?

@Kami
Copy link
Member

Kami commented Jan 20, 2020

@dpeschman Thanks for reporting this issue, we will have a look.

As far as adding **kwargs goes - I don't think it should be part of the standard API. The whole point behind the standard API is so you know up front which arguments are available and supported.

Drivers can still use it, but even there explicitly declaring supported arguments is preferred and there are usually very few valid cases for using **kwargs (recent improvements related to that - #1389).


EDIT: On a related noted - do you have a specific / valid use case for **kwargs in mind?

@dpeschman
Copy link
Contributor Author

Our use case is that our custom drivers take additional/other parameters to create_node that aren't in the base API. But I see your point about using explicit keyword args and will update our drivers to do that and continue to ignore the mypy/lint arg mismatch in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants