cmem-cmemc 25.5.0rc1__py3-none-any.whl → 26.1.0rc1__py3-none-any.whl

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.
Files changed (42) hide show
  1. cmem_cmemc/cli.py +11 -6
  2. cmem_cmemc/command.py +1 -1
  3. cmem_cmemc/command_group.py +59 -31
  4. cmem_cmemc/commands/acl.py +403 -26
  5. cmem_cmemc/commands/admin.py +10 -10
  6. cmem_cmemc/commands/client.py +12 -5
  7. cmem_cmemc/commands/config.py +106 -12
  8. cmem_cmemc/commands/dataset.py +163 -172
  9. cmem_cmemc/commands/file.py +509 -0
  10. cmem_cmemc/commands/graph.py +200 -72
  11. cmem_cmemc/commands/graph_imports.py +12 -5
  12. cmem_cmemc/commands/graph_insights.py +157 -53
  13. cmem_cmemc/commands/metrics.py +15 -9
  14. cmem_cmemc/commands/migration.py +12 -4
  15. cmem_cmemc/commands/package.py +548 -0
  16. cmem_cmemc/commands/project.py +157 -22
  17. cmem_cmemc/commands/python.py +9 -5
  18. cmem_cmemc/commands/query.py +119 -25
  19. cmem_cmemc/commands/scheduler.py +6 -4
  20. cmem_cmemc/commands/store.py +2 -1
  21. cmem_cmemc/commands/user.py +124 -24
  22. cmem_cmemc/commands/validation.py +15 -10
  23. cmem_cmemc/commands/variable.py +264 -61
  24. cmem_cmemc/commands/vocabulary.py +31 -17
  25. cmem_cmemc/commands/workflow.py +21 -11
  26. cmem_cmemc/completion.py +126 -109
  27. cmem_cmemc/context.py +40 -10
  28. cmem_cmemc/exceptions.py +8 -2
  29. cmem_cmemc/manual_helper/graph.py +2 -2
  30. cmem_cmemc/manual_helper/multi_page.py +5 -7
  31. cmem_cmemc/object_list.py +234 -7
  32. cmem_cmemc/placeholder.py +2 -2
  33. cmem_cmemc/string_processor.py +153 -4
  34. cmem_cmemc/title_helper.py +50 -0
  35. cmem_cmemc/utils.py +9 -8
  36. {cmem_cmemc-25.5.0rc1.dist-info → cmem_cmemc-26.1.0rc1.dist-info}/METADATA +7 -6
  37. cmem_cmemc-26.1.0rc1.dist-info/RECORD +62 -0
  38. {cmem_cmemc-25.5.0rc1.dist-info → cmem_cmemc-26.1.0rc1.dist-info}/WHEEL +1 -1
  39. cmem_cmemc/commands/resource.py +0 -220
  40. cmem_cmemc-25.5.0rc1.dist-info/RECORD +0 -61
  41. {cmem_cmemc-25.5.0rc1.dist-info → cmem_cmemc-26.1.0rc1.dist-info}/entry_points.txt +0 -0
  42. {cmem_cmemc-25.5.0rc1.dist-info → cmem_cmemc-26.1.0rc1.dist-info}/licenses/LICENSE +0 -0
cmem_cmemc/cli.py CHANGED
@@ -7,6 +7,8 @@ from importlib.resources import open_text
7
7
  from os import environ as env
8
8
 
9
9
  import click
10
+ from cmem_client.exceptions import BaseError as ClientBaseError
11
+ from eccenca_marketplace_client.exceptions import BaseError as MarketplaceClientBaseError
10
12
 
11
13
  from cmem_cmemc import completion
12
14
  from cmem_cmemc.command_group import CmemcGroup
@@ -16,6 +18,7 @@ from cmem_cmemc.commands import (
16
18
  dataset,
17
19
  graph,
18
20
  manual,
21
+ package,
19
22
  project,
20
23
  query,
21
24
  vocabulary,
@@ -106,7 +109,7 @@ def cli( # noqa: PLR0913
106
109
 
107
110
  https://eccenca.com/go/cmemc
108
111
 
109
- cmemc is © 2025 eccenca GmbH, licensed under the Apache License 2.0.
112
+ cmemc is © 2026 eccenca GmbH, licensed under the Apache License 2.0.
110
113
  """
111
114
  _ = connection, debug, quiet, config_file, external_http_timeout
112
115
  if " ".join(sys.argv).find("config edit") != -1:
@@ -120,6 +123,7 @@ cli.add_command(admin.admin)
120
123
  cli.add_command(config.config)
121
124
  cli.add_command(dataset.dataset)
122
125
  cli.add_command(graph.graph)
126
+ cli.add_command(package.package_group)
123
127
  cli.add_command(project.project)
124
128
  cli.add_command(query.query)
125
129
  cli.add_command(vocabulary.vocabulary)
@@ -130,9 +134,10 @@ cli.add_command(manual.manual_command)
130
134
  def main() -> None:
131
135
  """Start the command line interface."""
132
136
  try:
133
- cli() # pylint: disable=no-value-for-parameter
134
- except CmemcError as error:
135
- app: ApplicationContext = error.app
136
- app.echo_debug(traceback.format_exc())
137
- app.echo_error(extract_error_message(error))
137
+ cli()
138
+ except (CmemcError, ClientBaseError, MarketplaceClientBaseError) as error:
139
+ if "--debug" in sys.argv or "-d" in sys.argv:
140
+ ApplicationContext.echo_debug_string(traceback.format_exc())
141
+ message = extract_error_message(error).removeprefix("CmemcError: ")
142
+ ApplicationContext.echo_error(message)
138
143
  sys.exit(1)
cmem_cmemc/command.py CHANGED
@@ -53,4 +53,4 @@ class CmemcCommand(HelpColorsCommand):
53
53
  NotImplementedError,
54
54
  KeyError,
55
55
  ) as e:
56
- raise CmemcError(ctx.obj, extract_error_message(e, True)) from e
56
+ raise CmemcError(extract_error_message(e, True)) from e
@@ -1,5 +1,10 @@
1
1
  """cmemc Click Command Group"""
2
2
 
3
+ import shutil
4
+
5
+ from click import Command, Context
6
+ from click.core import _complete_visible_commands
7
+ from click.shell_completion import CompletionItem
3
8
  from click_didyoumean import DYMGroup
4
9
  from click_help_colors import HelpColorsGroup
5
10
 
@@ -24,49 +29,72 @@ class CmemcGroup(HelpColorsGroup, DYMGroup):
24
29
  kwargs.setdefault(
25
30
  "help_options_custom_colors",
26
31
  {
32
+ "acl": self.color_for_command_groups,
33
+ "admin": self.color_for_command_groups,
27
34
  "bootstrap": self.color_for_writing_commands,
28
- "showcase": self.color_for_writing_commands,
29
- "delete": self.color_for_writing_commands,
30
- "password": self.color_for_writing_commands,
31
- "secret": self.color_for_writing_commands,
32
- "upload": self.color_for_writing_commands,
33
- "import": self.color_for_writing_commands,
35
+ "cache": self.color_for_command_groups,
36
+ "cancel": self.color_for_writing_commands,
37
+ "client": self.color_for_command_groups,
38
+ "config": self.color_for_command_groups,
34
39
  "create": self.color_for_writing_commands,
35
- "enable": self.color_for_writing_commands,
40
+ "dataset": self.color_for_command_groups,
41
+ "delete": self.color_for_writing_commands,
36
42
  "disable": self.color_for_writing_commands,
43
+ "enable": self.color_for_writing_commands,
44
+ "eval": self.color_for_writing_commands,
37
45
  "execute": self.color_for_writing_commands,
38
- "replay": self.color_for_writing_commands,
39
- "io": self.color_for_writing_commands,
46
+ "file": self.color_for_command_groups,
47
+ "graph": self.color_for_command_groups,
48
+ "import": self.color_for_writing_commands,
49
+ "imports": self.color_for_command_groups,
50
+ "insights": self.color_for_command_groups,
40
51
  "install": self.color_for_writing_commands,
41
- "uninstall": self.color_for_writing_commands,
42
- "reload": self.color_for_writing_commands,
43
- "update": self.color_for_writing_commands,
44
- "eval": self.color_for_writing_commands,
45
- "cancel": self.color_for_writing_commands,
46
- "admin": self.color_for_command_groups,
47
- "user": self.color_for_command_groups,
48
- "store": self.color_for_command_groups,
52
+ "io": self.color_for_writing_commands,
49
53
  "metrics": self.color_for_command_groups,
50
- "config": self.color_for_command_groups,
51
- "dataset": self.color_for_command_groups,
52
- "graph": self.color_for_command_groups,
54
+ "migrate": self.color_for_writing_commands,
55
+ "migrations": self.color_for_command_groups,
56
+ "password": self.color_for_writing_commands,
57
+ "package": self.color_for_command_groups,
53
58
  "project": self.color_for_command_groups,
59
+ "python": self.color_for_command_groups,
54
60
  "query": self.color_for_command_groups,
61
+ "reload": self.color_for_writing_commands,
62
+ "replay": self.color_for_writing_commands,
63
+ "resource": self.color_for_command_groups,
55
64
  "scheduler": self.color_for_command_groups,
65
+ "secret": self.color_for_writing_commands,
66
+ "showcase": self.color_for_writing_commands,
67
+ "store": self.color_for_command_groups,
68
+ "uninstall": self.color_for_writing_commands,
69
+ "update": self.color_for_writing_commands,
70
+ "upload": self.color_for_writing_commands,
71
+ "user": self.color_for_command_groups,
72
+ "validation": self.color_for_command_groups,
73
+ "variable": self.color_for_command_groups,
56
74
  "vocabulary": self.color_for_command_groups,
57
75
  "workflow": self.color_for_command_groups,
58
76
  "workspace": self.color_for_command_groups,
59
- "python": self.color_for_command_groups,
60
- "cache": self.color_for_command_groups,
61
- "resource": self.color_for_command_groups,
62
- "acl": self.color_for_command_groups,
63
- "client": self.color_for_command_groups,
64
- "variable": self.color_for_command_groups,
65
- "validation": self.color_for_command_groups,
66
- "migrate": self.color_for_writing_commands,
67
- "migrations": self.color_for_command_groups,
68
- "imports": self.color_for_command_groups,
69
- "insights": self.color_for_command_groups,
70
77
  },
71
78
  )
72
79
  super().__init__(*args, **kwargs)
80
+
81
+ def shell_complete(self, ctx: Context, incomplete: str) -> list[CompletionItem]:
82
+ """Override shell completion to use full terminal width for help text.
83
+
84
+ This method extends the default Click Group shell completion by using
85
+ the full terminal width for command descriptions instead of the default
86
+ 45-character limit.
87
+ """
88
+ # Get terminal width, default to a large number if not available
89
+ terminal_width = shutil.get_terminal_size(fallback=(200, 24)).columns
90
+
91
+ # Get completions for subcommands with full-width help text
92
+ results = [
93
+ CompletionItem(name, help=command.get_short_help_str(limit=terminal_width))
94
+ for name, command in _complete_visible_commands(ctx, incomplete)
95
+ ]
96
+
97
+ # Call Command.shell_complete (not Group.shell_complete) to get options, etc.
98
+ # This avoids duplicate subcommand completions from the parent Group class
99
+ results.extend(Command.shell_complete(self, ctx, incomplete))
100
+ return results