Skip to content

Update stubs for Houdini to pull from houpythonportion as a source of truth. #38

@isohedronpipeline

Description

@isohedronpipeline

At the moment, the stubs are generated by inspecting hou by itself, then patching in missing classes, functions, etc with hou_cleanup_config.py.

This leaves open a lot of room for error/missing parts, as well as being extremely fragile for functions that have an argument added, removed, or changed.

The source of truth should be the houpythonportion package, which provides the additional class and function definitions.

Unfortunately, this is complicated to use for the folllowing reasons:

  1. functions are added via a monkeypatching operation, which means we cannot just from houpythonportion.data import data into hou:
def _addMethod(cls):
    """This decorator converts the function into an unbound method and adds
    it to the specified class.
    """
    import types
    def decorator(func):
        # Python 3 got rid of the concept of an unbound method.
        # A function in a class is now just a function.
        unbound_method = func
    
        setattr(cls, func.__name__, unbound_method)
        return unbound_method
    return decorator
  1. The argspecs for some functions are changed when they are added, stripping off self in some cases.
  2. AFAIK none of the functions in houpythonportion have any typing information or documentation, making automatic stub generation for these functions very difficult.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions