snowflakedb / snowflake-ml-python

Apache License 2.0
38 stars 8 forks source link

Method of exporting classes in modules is unfriendly to type hints/language servers #52

Open zyzil opened 10 months ago

zyzil commented 10 months ago

I've been starting to work with the Snowflake ML library and have noticed that I don't get much information about types to assist with docstrings, autocomplete, etc.

I believe the method used by modules to specify their exports may be preventing VS Code's language server from knowing the true types of exported objects and thus prevents showing of members, docstrings, etc.

Here is an example of trying to use snowflake.ml.modeling.pieline.Pipeline in VS Code with the Snowflake ML Pipeline vs scikit-learn's Pipeline:

Snowflake ML

image

Here, I've constructed a pipeline which does work, but doesn't show correct type information. You can see VS Code's language server detects Any for the pipe variables instead of Pipeline.

Scikit-learn

image

Here is the same constructs using scikit-learn, In this example, it properly detects that pipe is a Pipeline. With this, it allows me to auto-complete methods and show docstring information as I'm going.

sfc-gh-sagupta commented 8 months ago

Thank you for this comment and feedback. We are adding this to our feature request list and will prioritize this along with other enhancements.