makerrepo-cli 0.1.0__tar.gz → 0.1.2__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.
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/PKG-INFO +2 -2
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli/cmds/artifacts/capture_image.py +0 -34
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli/cmds/artifacts/cli.py +11 -11
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli/cmds/cli.py +57 -57
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli/cmds/environment.py +33 -33
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli/cmds/main.py +7 -7
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli.egg-info/PKG-INFO +2 -2
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli.egg-info/requires.txt +1 -1
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/pyproject.toml +2 -2
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/LICENSE +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/README.md +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli/__init__.py +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli/cmds/__init__.py +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli/cmds/aliase.py +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli/cmds/artifacts/__init__.py +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli/cmds/artifacts/main.py +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli/cmds/artifacts/ocp_data_types.py +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli/cmds/artifacts/utils.py +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli.egg-info/SOURCES.txt +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli.egg-info/dependency_links.txt +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli.egg-info/entry_points.txt +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/makerrepo_cli.egg-info/top_level.txt +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/setup.cfg +0 -0
- {makerrepo_cli-0.1.0 → makerrepo_cli-0.1.2}/tests/test_cmd.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: makerrepo-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -9,7 +9,7 @@ Requires-Dist: click>=8.3.1
|
|
|
9
9
|
Requires-Dist: makerrepo>=0.2.0
|
|
10
10
|
Requires-Dist: ocp-vscode>=3.0.1
|
|
11
11
|
Requires-Dist: playwright>=1.58.0
|
|
12
|
-
Requires-Dist: rich>=
|
|
12
|
+
Requires-Dist: rich>=13.0.0
|
|
13
13
|
Dynamic: license-file
|
|
14
14
|
|
|
15
15
|
# makerrepo-cli
|
|
@@ -195,37 +195,3 @@ class CADViewerService:
|
|
|
195
195
|
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
196
196
|
"""Async context manager exit."""
|
|
197
197
|
await self.stop()
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
async def main():
|
|
201
|
-
"""Download model file and take a screenshot."""
|
|
202
|
-
import httpx
|
|
203
|
-
|
|
204
|
-
logger = logging.getLogger(__name__)
|
|
205
|
-
model_url = "https://makerrepo.com/r/fangpenlin/open-models/artifact/master/5081ffa2-d61f-4925-87e3-573ec291b53c/model.json"
|
|
206
|
-
output_path = pathlib.Path("model_screenshot.png")
|
|
207
|
-
|
|
208
|
-
logger.info("Downloading model from %s...", model_url)
|
|
209
|
-
async with httpx.AsyncClient(follow_redirects=True) as client:
|
|
210
|
-
response = await client.get(model_url)
|
|
211
|
-
response.raise_for_status()
|
|
212
|
-
model_data = response.json()
|
|
213
|
-
|
|
214
|
-
logger.info("Model downloaded successfully")
|
|
215
|
-
logger.info("Starting CAD viewer service...")
|
|
216
|
-
|
|
217
|
-
async with CADViewerService(logger=logger) as viewer:
|
|
218
|
-
logger.info("Loading CAD model data...")
|
|
219
|
-
await viewer.load_cad_data(model_data)
|
|
220
|
-
|
|
221
|
-
logger.info("Taking screenshot...")
|
|
222
|
-
screenshot_bytes = await viewer.take_screenshot()
|
|
223
|
-
|
|
224
|
-
# Save screenshot to file
|
|
225
|
-
output_path.write_bytes(screenshot_bytes)
|
|
226
|
-
logger.info("Screenshot saved to %s", output_path.absolute())
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if __name__ == "__main__":
|
|
230
|
-
logging.basicConfig(level=logging.INFO)
|
|
231
|
-
asyncio.run(main())
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
from ..aliase import AliasedGroup
|
|
2
|
-
from ..cli import cli as root_cli
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
@root_cli.group(
|
|
6
|
-
name="artifacts",
|
|
7
|
-
help="Operations for artifacts.",
|
|
8
|
-
cls=AliasedGroup,
|
|
9
|
-
)
|
|
10
|
-
def cli():
|
|
11
|
-
pass
|
|
1
|
+
from ..aliase import AliasedGroup
|
|
2
|
+
from ..cli import cli as root_cli
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@root_cli.group(
|
|
6
|
+
name="artifacts",
|
|
7
|
+
help="Operations for artifacts.",
|
|
8
|
+
cls=AliasedGroup,
|
|
9
|
+
)
|
|
10
|
+
def cli():
|
|
11
|
+
pass
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
import os
|
|
3
|
-
|
|
4
|
-
import click
|
|
5
|
-
from rich.logging import RichHandler
|
|
6
|
-
|
|
7
|
-
from .environment import Environment
|
|
8
|
-
from .environment import LOG_LEVEL_MAP
|
|
9
|
-
from .environment import LogLevel
|
|
10
|
-
from .environment import pass_env
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@click.group(help="Command line tools for MakerRepo")
|
|
14
|
-
@click.option(
|
|
15
|
-
"-l",
|
|
16
|
-
"--log-level",
|
|
17
|
-
type=click.Choice(
|
|
18
|
-
list(map(lambda key: key.value, LOG_LEVEL_MAP.keys())), case_sensitive=False
|
|
19
|
-
),
|
|
20
|
-
default=lambda: os.environ.get("LOG_LEVEL", "INFO"),
|
|
21
|
-
)
|
|
22
|
-
@click.option(
|
|
23
|
-
"--log-format",
|
|
24
|
-
type=str,
|
|
25
|
-
default="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
26
|
-
help="logging format (only used when rich log is disabled)",
|
|
27
|
-
)
|
|
28
|
-
@click.option(
|
|
29
|
-
"--disable-rich-log",
|
|
30
|
-
is_flag=True,
|
|
31
|
-
help="disable rich log handler",
|
|
32
|
-
)
|
|
33
|
-
@click.version_option(prog_name="mr", package_name="mr")
|
|
34
|
-
@pass_env
|
|
35
|
-
def cli(
|
|
36
|
-
env: Environment,
|
|
37
|
-
log_level: str,
|
|
38
|
-
log_format: str,
|
|
39
|
-
disable_rich_log: bool,
|
|
40
|
-
):
|
|
41
|
-
env.log_level = LogLevel(log_level)
|
|
42
|
-
|
|
43
|
-
if disable_rich_log:
|
|
44
|
-
logging.basicConfig(
|
|
45
|
-
level=LOG_LEVEL_MAP[env.log_level],
|
|
46
|
-
format=log_format,
|
|
47
|
-
force=True,
|
|
48
|
-
)
|
|
49
|
-
else:
|
|
50
|
-
FORMAT = "%(message)s"
|
|
51
|
-
logging.basicConfig(
|
|
52
|
-
level=LOG_LEVEL_MAP[env.log_level],
|
|
53
|
-
format=FORMAT,
|
|
54
|
-
datefmt="[%X]",
|
|
55
|
-
handlers=[RichHandler()],
|
|
56
|
-
force=True,
|
|
57
|
-
)
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
import click
|
|
5
|
+
from rich.logging import RichHandler
|
|
6
|
+
|
|
7
|
+
from .environment import Environment
|
|
8
|
+
from .environment import LOG_LEVEL_MAP
|
|
9
|
+
from .environment import LogLevel
|
|
10
|
+
from .environment import pass_env
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@click.group(help="Command line tools for MakerRepo")
|
|
14
|
+
@click.option(
|
|
15
|
+
"-l",
|
|
16
|
+
"--log-level",
|
|
17
|
+
type=click.Choice(
|
|
18
|
+
list(map(lambda key: key.value, LOG_LEVEL_MAP.keys())), case_sensitive=False
|
|
19
|
+
),
|
|
20
|
+
default=lambda: os.environ.get("LOG_LEVEL", "INFO"),
|
|
21
|
+
)
|
|
22
|
+
@click.option(
|
|
23
|
+
"--log-format",
|
|
24
|
+
type=str,
|
|
25
|
+
default="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
26
|
+
help="logging format (only used when rich log is disabled)",
|
|
27
|
+
)
|
|
28
|
+
@click.option(
|
|
29
|
+
"--disable-rich-log",
|
|
30
|
+
is_flag=True,
|
|
31
|
+
help="disable rich log handler",
|
|
32
|
+
)
|
|
33
|
+
@click.version_option(prog_name="mr", package_name="mr")
|
|
34
|
+
@pass_env
|
|
35
|
+
def cli(
|
|
36
|
+
env: Environment,
|
|
37
|
+
log_level: str,
|
|
38
|
+
log_format: str,
|
|
39
|
+
disable_rich_log: bool,
|
|
40
|
+
):
|
|
41
|
+
env.log_level = LogLevel(log_level)
|
|
42
|
+
|
|
43
|
+
if disable_rich_log:
|
|
44
|
+
logging.basicConfig(
|
|
45
|
+
level=LOG_LEVEL_MAP[env.log_level],
|
|
46
|
+
format=log_format,
|
|
47
|
+
force=True,
|
|
48
|
+
)
|
|
49
|
+
else:
|
|
50
|
+
FORMAT = "%(message)s"
|
|
51
|
+
logging.basicConfig(
|
|
52
|
+
level=LOG_LEVEL_MAP[env.log_level],
|
|
53
|
+
format=FORMAT,
|
|
54
|
+
datefmt="[%X]",
|
|
55
|
+
handlers=[RichHandler()],
|
|
56
|
+
force=True,
|
|
57
|
+
)
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import dataclasses
|
|
2
|
-
import enum
|
|
3
|
-
import logging
|
|
4
|
-
|
|
5
|
-
import click
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@enum.unique
|
|
9
|
-
class LogLevel(enum.Enum):
|
|
10
|
-
VERBOSE = "verbose"
|
|
11
|
-
DEBUG = "debug"
|
|
12
|
-
INFO = "info"
|
|
13
|
-
WARNING = "warning"
|
|
14
|
-
ERROR = "error"
|
|
15
|
-
FATAL = "fatal"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
LOG_LEVEL_MAP = {
|
|
19
|
-
LogLevel.DEBUG: logging.DEBUG,
|
|
20
|
-
LogLevel.INFO: logging.INFO,
|
|
21
|
-
LogLevel.WARNING: logging.WARNING,
|
|
22
|
-
LogLevel.ERROR: logging.ERROR,
|
|
23
|
-
LogLevel.FATAL: logging.FATAL,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@dataclasses.dataclass
|
|
28
|
-
class Environment:
|
|
29
|
-
log_level: LogLevel = LogLevel.INFO
|
|
30
|
-
logger: logging.Logger = logging.getLogger("mr")
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
pass_env = click.make_pass_decorator(Environment, ensure=True)
|
|
1
|
+
import dataclasses
|
|
2
|
+
import enum
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@enum.unique
|
|
9
|
+
class LogLevel(enum.Enum):
|
|
10
|
+
VERBOSE = "verbose"
|
|
11
|
+
DEBUG = "debug"
|
|
12
|
+
INFO = "info"
|
|
13
|
+
WARNING = "warning"
|
|
14
|
+
ERROR = "error"
|
|
15
|
+
FATAL = "fatal"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
LOG_LEVEL_MAP = {
|
|
19
|
+
LogLevel.DEBUG: logging.DEBUG,
|
|
20
|
+
LogLevel.INFO: logging.INFO,
|
|
21
|
+
LogLevel.WARNING: logging.WARNING,
|
|
22
|
+
LogLevel.ERROR: logging.ERROR,
|
|
23
|
+
LogLevel.FATAL: logging.FATAL,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclasses.dataclass
|
|
28
|
+
class Environment:
|
|
29
|
+
log_level: LogLevel = LogLevel.INFO
|
|
30
|
+
logger: logging.Logger = logging.getLogger("mr")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
pass_env = click.make_pass_decorator(Environment, ensure=True)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
from .artifacts import main # no qa
|
|
2
|
-
from .cli import cli
|
|
3
|
-
|
|
4
|
-
__ALL__ = [cli]
|
|
5
|
-
|
|
6
|
-
if __name__ == "__main__":
|
|
7
|
-
cli()
|
|
1
|
+
from .artifacts import main # no qa
|
|
2
|
+
from .cli import cli
|
|
3
|
+
|
|
4
|
+
__ALL__ = [cli]
|
|
5
|
+
|
|
6
|
+
if __name__ == "__main__":
|
|
7
|
+
cli()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: makerrepo-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -9,7 +9,7 @@ Requires-Dist: click>=8.3.1
|
|
|
9
9
|
Requires-Dist: makerrepo>=0.2.0
|
|
10
10
|
Requires-Dist: ocp-vscode>=3.0.1
|
|
11
11
|
Requires-Dist: playwright>=1.58.0
|
|
12
|
-
Requires-Dist: rich>=
|
|
12
|
+
Requires-Dist: rich>=13.0.0
|
|
13
13
|
Dynamic: license-file
|
|
14
14
|
|
|
15
15
|
# makerrepo-cli
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "makerrepo-cli"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.2"
|
|
4
4
|
description = "Add your description here"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
@@ -9,7 +9,7 @@ dependencies = [
|
|
|
9
9
|
"makerrepo>=0.2.0",
|
|
10
10
|
"ocp-vscode>=3.0.1",
|
|
11
11
|
"playwright>=1.58.0",
|
|
12
|
-
"rich>=
|
|
12
|
+
"rich>=13.0.0",
|
|
13
13
|
]
|
|
14
14
|
|
|
15
15
|
[project.scripts]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|