Nice to see this work!
One thing that would be nice would be able to get access to the `Proxy` instance in classmethods, so that `cls` will be that instance instead of the `__origin__` class. Why? This allows `MyCustomType[int].create(...)` to have different runtime behavior than `MyCustomType[str].create(...)`.
Currently, to do this, I have to monkeypatch `_GenericAlias.__getattr__`:
``` def generic_getattr(self, attr): """ Allows classmethods to get generic types by checking if we are getting a descriptor type and if we are, we pass in the generic type as the class instead of the origin type.
Modified from https://github.com/python/cpython/blob/aa73841a8fdded4a462d045d1eb03899cbeec... """ if "__origin__" in self.__dict__ and attr not in ( "__wrapped__", "__union_params__", ): # If the attribute is a descriptor, pass in the generic class try: descr = self.__origin__.__getattribute__(self.__origin__, attr) except Exception: return
if hasattr(descr, "__get__"): return descr.__get__(None, self) # Otherwise, just resolve it normally return getattr(self.__origin__, attr) raise AttributeError(attr)
typing._GenericAlias.__getattr__ = generic_getattr # type: ignore ```