robotcode-plugin 0.30.0__tar.gz → 0.32.1__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.
- {robotcode_plugin-0.30.0 → robotcode_plugin-0.32.1}/PKG-INFO +1 -1
- {robotcode_plugin-0.30.0 → robotcode_plugin-0.32.1}/pyproject.toml +11 -8
- robotcode_plugin-0.32.1/src/robotcode/plugin/__init__.py +117 -0
- robotcode_plugin-0.32.1/src/robotcode/plugin/__version__.py +1 -0
- robotcode_plugin-0.32.1/src/robotcode/plugin/click_helper.py +23 -0
- robotcode_plugin-0.30.0/robotcode/plugin/__init__.py +0 -22
- robotcode_plugin-0.30.0/robotcode/plugin/__version__.py +0 -1
- {robotcode_plugin-0.30.0 → robotcode_plugin-0.32.1}/.gitignore +0 -0
- {robotcode_plugin-0.30.0 → robotcode_plugin-0.32.1}/LICENSE.txt +0 -0
- {robotcode_plugin-0.30.0 → robotcode_plugin-0.32.1}/README.md +0 -0
- {robotcode_plugin-0.30.0 → robotcode_plugin-0.32.1/src}/robotcode/plugin/manager.py +0 -0
- {robotcode_plugin-0.30.0 → robotcode_plugin-0.32.1/src}/robotcode/plugin/py.typed +0 -0
- {robotcode_plugin-0.30.0 → robotcode_plugin-0.32.1/src}/robotcode/plugin/specs.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: robotcode-plugin
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.32.1
|
|
4
4
|
Summary: Some classes for RobotCode plugin management
|
|
5
5
|
Project-URL: Donate, https://github.com/sponsors/d-biehl
|
|
6
6
|
Project-URL: Documentation, https://github.com/d-biehl/robotcode#readme
|
|
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "robotcode-plugin"
|
|
7
7
|
description = 'Some classes for RobotCode plugin management'
|
|
8
|
-
readme = {"file" = "README.md", "content-type" = "text/markdown"}
|
|
8
|
+
readme = { "file" = "README.md", "content-type" = "text/markdown" }
|
|
9
9
|
requires-python = ">=3.8"
|
|
10
10
|
license = "Apache-2.0"
|
|
11
11
|
keywords = []
|
|
@@ -36,15 +36,18 @@ Issues = "https://github.com/d-biehl/robotcode/issues"
|
|
|
36
36
|
Source = "https://github.com/d-biehl/robotcode"
|
|
37
37
|
|
|
38
38
|
[tool.hatch.version]
|
|
39
|
-
path = "robotcode/plugin/__version__.py"
|
|
39
|
+
path = "src/robotcode/plugin/__version__.py"
|
|
40
40
|
|
|
41
|
-
[tool.hatch.
|
|
42
|
-
|
|
43
|
-
python = "38"
|
|
41
|
+
[tool.hatch.build]
|
|
42
|
+
dev-mode-dirs = ["src"]
|
|
44
43
|
|
|
44
|
+
[tool.hatch.build.targets.wheel]
|
|
45
|
+
only-include = ["src/robotcode"]
|
|
46
|
+
sources = ["src"]
|
|
45
47
|
|
|
46
48
|
[tool.hatch.build.targets.sdist]
|
|
47
|
-
only-include = ["
|
|
49
|
+
only-include = ["src"]
|
|
48
50
|
|
|
49
|
-
[tool.hatch.build
|
|
50
|
-
|
|
51
|
+
[tool.hatch.envs.build]
|
|
52
|
+
detached = true
|
|
53
|
+
python = "38"
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from enum import Enum, unique
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import IO, Any, AnyStr, Callable, Dict, List, Optional, TypeVar, Union, cast
|
|
5
|
+
|
|
6
|
+
import click
|
|
7
|
+
import pluggy
|
|
8
|
+
from robotcode.core.dataclasses import as_json
|
|
9
|
+
|
|
10
|
+
__all__ = ["hookimpl", "CommonConfig", "pass_application"]
|
|
11
|
+
|
|
12
|
+
F = TypeVar("F", bound=Callable[..., Any])
|
|
13
|
+
hookimpl = cast(Callable[[F], F], pluggy.HookimplMarker("robotcode"))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@unique
|
|
17
|
+
class ColoredOutput(str, Enum):
|
|
18
|
+
AUTO = "auto"
|
|
19
|
+
YES = "yes"
|
|
20
|
+
NO = "no"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@unique
|
|
24
|
+
class OutputFormat(str, Enum):
|
|
25
|
+
TOML = "toml"
|
|
26
|
+
JSON = "json"
|
|
27
|
+
FLAT = "flat"
|
|
28
|
+
|
|
29
|
+
def __str__(self) -> str:
|
|
30
|
+
return self.value
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass
|
|
34
|
+
class CommonConfig:
|
|
35
|
+
config_files: Optional[List[Path]] = None
|
|
36
|
+
profiles: Optional[List[str]] = None
|
|
37
|
+
dry: bool = False
|
|
38
|
+
verbose: bool = False
|
|
39
|
+
colored_output: ColoredOutput = ColoredOutput.AUTO
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class Application:
|
|
43
|
+
def __init__(self) -> None:
|
|
44
|
+
self.config = CommonConfig()
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def colored(self) -> bool:
|
|
48
|
+
return self.config.colored_output in [ColoredOutput.AUTO, ColoredOutput.YES]
|
|
49
|
+
|
|
50
|
+
def verbose(
|
|
51
|
+
self,
|
|
52
|
+
message: Union[str, Callable[[], Any], None],
|
|
53
|
+
file: Optional[IO[AnyStr]] = None,
|
|
54
|
+
nl: bool = True,
|
|
55
|
+
err: bool = False,
|
|
56
|
+
) -> None:
|
|
57
|
+
if self.config.verbose:
|
|
58
|
+
click.secho(
|
|
59
|
+
message() if callable(message) else message,
|
|
60
|
+
file=file,
|
|
61
|
+
nl=nl,
|
|
62
|
+
err=err,
|
|
63
|
+
color=self.colored,
|
|
64
|
+
fg="bright_black",
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
def warning(
|
|
68
|
+
self,
|
|
69
|
+
message: Union[str, Callable[[], Any], None],
|
|
70
|
+
file: Optional[IO[AnyStr]] = None,
|
|
71
|
+
nl: bool = True,
|
|
72
|
+
err: bool = False,
|
|
73
|
+
) -> None:
|
|
74
|
+
click.secho(
|
|
75
|
+
f"WARNING: {message() if callable(message) else message}",
|
|
76
|
+
file=file,
|
|
77
|
+
nl=nl,
|
|
78
|
+
err=err,
|
|
79
|
+
color=self.colored,
|
|
80
|
+
fg="bright_yellow",
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
def print_dict(self, config: Dict[str, Any], format: OutputFormat) -> None:
|
|
84
|
+
text = None
|
|
85
|
+
if format == "toml":
|
|
86
|
+
try:
|
|
87
|
+
import tomli_w
|
|
88
|
+
|
|
89
|
+
text = tomli_w.dumps(config)
|
|
90
|
+
except ImportError:
|
|
91
|
+
self.warning("Package 'tomli_w' is required to use TOML output. Using JSON format instead.")
|
|
92
|
+
format = OutputFormat.JSON
|
|
93
|
+
|
|
94
|
+
if text is None:
|
|
95
|
+
text = as_json(config, indent=True)
|
|
96
|
+
|
|
97
|
+
if not text:
|
|
98
|
+
return
|
|
99
|
+
|
|
100
|
+
if self.colored:
|
|
101
|
+
try:
|
|
102
|
+
from rich.console import Console
|
|
103
|
+
from rich.syntax import Syntax
|
|
104
|
+
|
|
105
|
+
Console().print(Syntax(text, format, background_color="default"))
|
|
106
|
+
|
|
107
|
+
return
|
|
108
|
+
except ImportError:
|
|
109
|
+
if self.config.colored_output == ColoredOutput.YES:
|
|
110
|
+
self.warning('Package "rich" is required to use colored output.')
|
|
111
|
+
|
|
112
|
+
click.echo(text)
|
|
113
|
+
|
|
114
|
+
return
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
pass_application = click.make_pass_decorator(Application, ensure=True)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.32.1"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import Any, Callable, Type, Union
|
|
3
|
+
|
|
4
|
+
import click
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class EnumChoice(click.Choice):
|
|
8
|
+
"""A click.Choice that accepts Enum values."""
|
|
9
|
+
|
|
10
|
+
def __init__(self, choices: Type[Enum], case_sensitive: bool = True) -> None:
|
|
11
|
+
super().__init__(choices, case_sensitive) # type: ignore
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
FC = Union[Callable[..., Any], click.Command]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def add_options(*options: FC) -> FC:
|
|
18
|
+
def _add_options(func: FC) -> FC:
|
|
19
|
+
for option in reversed(options):
|
|
20
|
+
func = option(func)
|
|
21
|
+
return func
|
|
22
|
+
|
|
23
|
+
return _add_options
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from typing import Any, Callable, List, Optional, TypeVar, cast
|
|
4
|
-
|
|
5
|
-
import click
|
|
6
|
-
import pluggy
|
|
7
|
-
|
|
8
|
-
__all__ = ["hookimpl", "CommonConfig", "pass_common_config"]
|
|
9
|
-
|
|
10
|
-
F = TypeVar("F", bound=Callable[..., Any])
|
|
11
|
-
hookimpl = cast(Callable[[F], F], pluggy.HookimplMarker("robotcode"))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@dataclass
|
|
15
|
-
class CommonConfig:
|
|
16
|
-
config_file: Optional[Path] = None
|
|
17
|
-
profiles: Optional[List[str]] = None
|
|
18
|
-
dry: bool = False
|
|
19
|
-
verbose: bool = False
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
pass_common_config = click.make_pass_decorator(CommonConfig, ensure=True)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.30.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|