johnzielke opened a new issue, #1383:
URL: https://github.com/apache/hamilton/issues/1383

   **Is your feature request related to a problem? Please describe.**
   With the current graph visualization, a node with a return type of 
dict[str,MySpecialClass] will just have "dict" listed as type.
   The conversion of the type to string seems to happen in 
[get_type_as_string](https://github.com/apache/hamilton/blob/eb6a6cac299f5512b94e57b38ce3d0b253cd71e4/hamilton/htypes.py#L111),
 which is currently implemented as:
   ```python
   def get_type_as_string(type_: Type) -> Optional[str]:
       """Get a string representation of a type.
   
       The logic supports the evolution of the type system between 3.8 and 3.10.
       :param type_: Any Type object. Typically the node type found at 
Node.type.
       :return: string representation of the type. An empty string if 
everything fails.
       """
   
       if _is_annotated_type(type_):
           type_string = get_type_as_string(typing.get_args(type_)[0])
       elif getattr(type_, "__name__", None):
           type_string = type_.__name__
       elif typing_inspect.get_origin(type_):
           base_type = typing_inspect.get_origin(type_)
           type_string = get_type_as_string(base_type)
       elif getattr(type_, "__repr__", None):
           type_string = type_.__repr__()
       else:
           type_string = None
   
       return type_string
   ```
   In the above mentioned example this seems to fall into the second case 
(using__name__), which will discard the type attributes
   
   
   **Describe the solution you'd like**
   What is the reason for not using `str(type_)` here? In this case that would 
return a much more descriptive type description. Is it because of potentially 
too long type names?
   **Describe alternatives you've considered**
   The str() option will return fully qualified names, which might not be 
desired since it would make text too long. A custom version could be 
implemented (for example by regex replacing the module names)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to