Repository: mit-ll-responsible-ai/hydra-zen

Issue:
Implement Partial generic to be leveraged by instantiate
```python
class partial(Generic[_T]):
    func: Callable[..., _T]
    args: Tuple[Any, ...]
    keywords: Dict[str, Any]
    def __init__(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ...
    def __call__(self, *args: Any, **kwargs: Any) -> _T: ...



Discussion:

Resolving patch:
diff --git a/src/hydra_utils/_hydra_overloads.py b/src/hydra_utils/_hydra_overloads.py
--- a/src/hydra_utils/_hydra_overloads.py
+++ b/src/hydra_utils/_hydra_overloads.py
@@ -20,61 +20,37 @@
 
 from hydra.utils import instantiate as hydra_instantiate
 
-from .typing import Builds, Just, PartialBuilds
+from .typing import Builds, Just, Partial, PartialBuilds
 
 T = TypeVar("T")
 
 
 @overload
-def instantiate(config: Just[T], *args, **kwargs) -> T:  # pragma: no cover
-    ...
-
-
-@overload
-def instantiate(config: Builds[Type[T]], *args, **kwargs) -> T:  # pragma: no cover
-    ...
-
-
-@overload
-def instantiate(
-    config: Builds[Callable[..., T]], *args, **kwargs
-) -> T:  # pragma: no cover
+def instantiate(config: Just[T], *args: Any, **kwargs: Any) -> T:  # pragma: no cover
     ...
 
 
 @overload
 def instantiate(
-    config: PartialBuilds[Type[T]], *args, **kwargs
-) -> Callable[..., T]:  # pragma: no cover
+    config: PartialBuilds[T], *args: Any, **kwargs: Any
+) -> Partial[T]:  # pragma: no cover
     ...
 
 
 @overload
 def instantiate(
-    config: Type[Builds[Type[T]]], *args, **kwargs
+    config: Builds[Type[T]], *args: Any, **kwargs: Any
 ) -> T:  # pragma: no cover
     ...
 
 
 @overload
 def instantiate(
-    config: Type[Builds[Callable[..., T]]], *args, **kwargs
+    config: Builds[Callable[..., T]], *args: Any, **kwargs: Any
 ) -> T:  # pragma: no cover
     ...
 
 
-@overload
-def instantiate(
-    config: Type[PartialBuilds[Type[T]]], *args, **kwargs
-) -> Callable[..., T]:  # pragma: no cover
-    ...
-
-
-@overload
-def instantiate(config: Any, *args, **kwargs) -> Any:  # pragma: no cover
-    ...
-
-
 def instantiate(config: Any, *args, **kwargs) -> Any:
     """Calls `hydra.utils.instantiate(config, *args, **kwargs)`
 
diff --git a/src/hydra_utils/typing.py b/src/hydra_utils/typing.py
--- a/src/hydra_utils/typing.py
+++ b/src/hydra_utils/typing.py
@@ -1,5 +1,5 @@
 from dataclasses import Field, _DataclassParams
-from typing import Dict, Tuple, TypeVar
+from typing import Any, Callable, Dict, Generic, Tuple, TypeVar
 
 from typing_extensions import Literal, Protocol
 
@@ -10,12 +10,27 @@
     "Just",
     "Builds",
     "PartialBuilds",
+    "Partial",
 ]
 
 
 # TODO: Define Instantiable
 
-T = TypeVar("T")
+_T = TypeVar("_T")
+
+
+class Partial(Generic[_T]):
+    func: Callable[..., _T]
+    args: Tuple[Any, ...]
+    keywords: Dict[str, Any]
+
+    def __init__(
+        self, func: Callable[..., _T], *args: Any, **kwargs: Any
+    ) -> None:  # pragma: no cover
+        ...
+
+    def __call__(self, *args: Any, **kwargs: Any) -> _T:  # pragma: no cover
+        ...
 
 
 class _Importable(Protocol):
@@ -43,19 +58,19 @@ def __call__(self, *args, **kwargs) -> "DataClass":  # pragma: no cover
     __module__: str
 
 
-class Instantiable(DataClass, Protocol[T]):  # pragma: no cover
+class Instantiable(DataClass, Protocol[_T]):  # pragma: no cover
     _target_: str
 
 
-class Just(Instantiable, Protocol[T]):
+class Just(Instantiable, Protocol[_T]):
     obj: str  # interpolated string for importing obj
     _target_: str = "hydra_utils.identity"  # TODO: update this
 
 
-class Builds(Instantiable, Protocol[T]):  # pragma: no cover
+class Builds(Instantiable, Protocol[_T]):  # pragma: no cover
     _convert_: Literal["none", "partial", "all"]
     _recursive_: bool
 
 
-class PartialBuilds(Builds, Protocol[T]):
+class PartialBuilds(Builds, Protocol[_T]):
     _partial_target_: str


Test patch: