robotcode-plugin 0.91.0__tar.gz → 0.92.0__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.3
2
2
  Name: robotcode-plugin
3
- Version: 0.91.0
3
+ Version: 0.92.0
4
4
  Summary: Some classes for RobotCode plugin management
5
5
  Project-URL: Donate, https://opencollective.com/robotcode
6
6
  Project-URL: Documentation, https://github.com/robotcodedev/robotcode#readme
@@ -0,0 +1 @@
1
+ __version__ = "0.92.0"
@@ -0,0 +1,40 @@
1
+ from typing import List, Optional, cast
2
+
3
+ import click
4
+ import pluggy
5
+ from typing_extensions import Self
6
+
7
+ from . import specs
8
+
9
+
10
+ class PluginManager:
11
+ _instance: Optional["Self"] = None
12
+
13
+ @classmethod
14
+ def instance(cls) -> "Self":
15
+ if cls._instance is None:
16
+ cls._instance = cls()
17
+ return cast("Self", cls._instance)
18
+
19
+ def __init__(self) -> None:
20
+ self._plugin_manager = pluggy.PluginManager("robotcode")
21
+ self._plugin_manager.add_hookspecs(specs)
22
+ self._plugin_manager.load_setuptools_entrypoints("robotcode")
23
+
24
+ @property
25
+ def cli_commands(self) -> List[click.Command]:
26
+ result: List[click.Command] = []
27
+ for l in self._plugin_manager.hook.register_cli_commands():
28
+ result.extend(cast(List[click.Command], l))
29
+ return result
30
+
31
+ @property
32
+ def tool_config_classes(
33
+ self,
34
+ ) -> List[specs.ToolConfig]:
35
+ result: List[specs.ToolConfig] = []
36
+
37
+ for l in self._plugin_manager.hook.register_tool_config_classes():
38
+ result.extend(cast(List[specs.ToolConfig], l))
39
+
40
+ return result
@@ -0,0 +1,22 @@
1
+ from typing import Any, Callable, List, NamedTuple, Type, TypeVar, cast
2
+
3
+ import click
4
+ import pluggy
5
+
6
+ F = TypeVar("F", bound=Callable[..., Any])
7
+ hookspec = cast(Callable[[F], F], pluggy.HookspecMarker("robotcode"))
8
+
9
+
10
+ @hookspec
11
+ def register_cli_commands() -> List[click.Command]: # type: ignore
12
+ """Register new command for the commandline."""
13
+
14
+
15
+ class ToolConfig(NamedTuple):
16
+ tool_name: str
17
+ config_class: Type[Any]
18
+
19
+
20
+ @hookspec
21
+ def register_tool_config_classes() -> List[ToolConfig]: # type: ignore
22
+ """Registers a class that gives information about a tool configuration."""
@@ -1 +0,0 @@
1
- __version__ = "0.91.0"
@@ -1,29 +0,0 @@
1
- from typing import List, Tuple, Type, cast
2
-
3
- import click
4
- import pluggy
5
-
6
- from . import specs
7
-
8
-
9
- class PluginManager:
10
- def __init__(self) -> None:
11
- self._plugin_manager = pluggy.PluginManager("robotcode")
12
- self._plugin_manager.add_hookspecs(specs)
13
- self._plugin_manager.load_setuptools_entrypoints("robotcode")
14
-
15
- @property
16
- def cli_commands(self) -> List[List[click.Command]]:
17
- return cast(
18
- List[List[click.Command]],
19
- self._plugin_manager.hook.register_cli_commands(),
20
- )
21
-
22
- @property
23
- def config_classes(
24
- self,
25
- ) -> List[List[Tuple[str, Type[specs.TConfigClass]]]]:
26
- return cast(
27
- List[List[Tuple[str, Type[specs.TConfigClass]]]],
28
- self._plugin_manager.hook.register_config_classes(),
29
- )
@@ -1,20 +0,0 @@
1
- from typing import Any, Callable, List, Tuple, Type, TypeVar, cast
2
-
3
- import click
4
- import pluggy
5
-
6
- F = TypeVar("F", bound=Callable[..., Any])
7
- hookspec = cast(Callable[[F], F], pluggy.HookspecMarker("robotcode"))
8
-
9
-
10
- @hookspec
11
- def register_cli_commands() -> List[click.Command]: # type: ignore
12
- """Register new command for the commandline."""
13
-
14
-
15
- TConfigClass = TypeVar("TConfigClass")
16
-
17
-
18
- @hookspec
19
- def register_config_classes() -> List[Tuple[str, Type[TConfigClass]]]: # type: ignore
20
- """Registers a class that gives information about a configuration."""