pysae-cli-tools 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pysae-cli-tools
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Reusable utilities for Pysae Python CLIs (k8s pod dispatch, …).
5
5
  License: MIT
6
6
  Author: Rémi Alvergnat
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pysae-cli-tools"
3
- version = "0.1.2"
3
+ version = "0.1.4"
4
4
  description = "Reusable utilities for Pysae Python CLIs (k8s pod dispatch, …)."
5
5
  authors = ["Rémi Alvergnat <remi.alvergnat@pysae.com>"]
6
6
  readme = "README.md"
@@ -776,7 +776,37 @@ def k8s_support(
776
776
  return decorator
777
777
 
778
778
 
779
- def build_k8s_support(config: K8sConfig) -> Callable[..., Callable[[F], F]]:
779
+ class K8sSupportFactory:
780
+ """Callable returned by :func:`build_k8s_support`.
781
+
782
+ Implemented as a class with a typed ``__call__`` (rather than an inner
783
+ function or :class:`Protocol`) so mypy resolves the ``F`` TypeVar at
784
+ every call site. A plain ``Callable[..., Callable[[F], F]]`` return
785
+ type would erase the decorated function's signature and trip
786
+ ``untyped-decorator`` in strict-mode consumers.
787
+ """
788
+
789
+ def __init__(self, config: K8sConfig) -> None:
790
+ self._config = config
791
+
792
+ def __call__(
793
+ self,
794
+ *,
795
+ cli_module: str | None = None,
796
+ cli_subcommand: Any = _AUTO_SUBCOMMAND,
797
+ pod_name_prefix: str | None = None,
798
+ tty: bool | None = None,
799
+ ) -> Callable[[F], F]:
800
+ return k8s_support(
801
+ config=self._config,
802
+ cli_module=cli_module,
803
+ cli_subcommand=cli_subcommand,
804
+ pod_name_prefix=pod_name_prefix,
805
+ tty=tty,
806
+ )
807
+
808
+
809
+ def build_k8s_support(config: K8sConfig) -> K8sSupportFactory:
780
810
  """Return a :func:`k8s_support` decorator pre-bound to ``config``.
781
811
 
782
812
  Typical setup at the top of a project's ``cli.py``::
@@ -802,19 +832,4 @@ def build_k8s_support(config: K8sConfig) -> Callable[..., Callable[[F], F]]:
802
832
  def my_other_command(...): ...
803
833
  """
804
834
 
805
- def k8s_support_bound(
806
- *,
807
- cli_module: str | None = None,
808
- cli_subcommand: Any = _AUTO_SUBCOMMAND,
809
- pod_name_prefix: str | None = None,
810
- tty: bool | None = None,
811
- ) -> Callable[[F], F]:
812
- return k8s_support(
813
- config=config,
814
- cli_module=cli_module,
815
- cli_subcommand=cli_subcommand,
816
- pod_name_prefix=pod_name_prefix,
817
- tty=tty,
818
- )
819
-
820
- return k8s_support_bound
835
+ return K8sSupportFactory(config)