backend.ai-plugin 25.11.0__tar.gz → 25.19.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.

Potentially problematic release.


This version of backend.ai-plugin might be problematic. Click here for more details.

Files changed (20) hide show
  1. {backend_ai_plugin-25.11.0/backend.ai_plugin.egg-info → backend_ai_plugin-25.19.1}/PKG-INFO +4 -2
  2. backend_ai_plugin-25.19.1/ai/backend/plugin/VERSION +1 -0
  3. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/ai/backend/plugin/cli.py +19 -17
  4. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/ai/backend/plugin/entrypoint.py +75 -13
  5. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1/backend.ai_plugin.egg-info}/PKG-INFO +4 -2
  6. backend_ai_plugin-25.19.1/backend.ai_plugin.egg-info/requires.txt +7 -0
  7. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/setup.py +5 -2
  8. backend_ai_plugin-25.11.0/ai/backend/plugin/VERSION +0 -1
  9. backend_ai_plugin-25.11.0/backend.ai_plugin.egg-info/requires.txt +0 -5
  10. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/MANIFEST.in +0 -0
  11. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/ai/backend/plugin/__init__.py +0 -0
  12. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/ai/backend/plugin/py.typed +0 -0
  13. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/backend.ai_plugin.egg-info/SOURCES.txt +0 -0
  14. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/backend.ai_plugin.egg-info/dependency_links.txt +0 -0
  15. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/backend.ai_plugin.egg-info/entry_points.txt +0 -0
  16. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/backend.ai_plugin.egg-info/namespace_packages.txt +0 -0
  17. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/backend.ai_plugin.egg-info/not-zip-safe +0 -0
  18. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/backend.ai_plugin.egg-info/top_level.txt +0 -0
  19. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/backend_shim.py +0 -0
  20. {backend_ai_plugin-25.11.0 → backend_ai_plugin-25.19.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: backend.ai-plugin
3
- Version: 25.11.0
3
+ Version: 25.19.1
4
4
  Summary: Backend.AI Plugin Subsystem
5
5
  Home-page: https://github.com/lablup/backend.ai
6
6
  Author: Lablup Inc. and contributors
@@ -20,10 +20,12 @@ Classifier: Programming Language :: Python :: 3.13
20
20
  Classifier: License :: OSI Approved :: MIT License
21
21
  Requires-Python: >=3.13,<3.14
22
22
  Description-Content-Type: text/markdown
23
- Requires-Dist: backend.ai-logging==25.11.0
23
+ Requires-Dist: backend.ai-common==25.19.1
24
+ Requires-Dist: backend.ai-logging==25.19.1
24
25
  Requires-Dist: click~=8.1.7
25
26
  Requires-Dist: colorama>=0.4.6
26
27
  Requires-Dist: tabulate~=0.8.9
28
+ Requires-Dist: types-colorama
27
29
  Requires-Dist: types-tabulate
28
30
  Dynamic: author
29
31
  Dynamic: classifier
@@ -0,0 +1 @@
1
+ 25.19.1
@@ -5,24 +5,22 @@ import itertools
5
5
  import json
6
6
  import logging
7
7
  from collections import defaultdict
8
- from typing import Any, Self
8
+ from typing import TYPE_CHECKING, Self
9
9
 
10
10
  import click
11
11
  import colorama
12
12
  import tabulate
13
13
  from colorama import Fore, Style
14
14
 
15
- from ai.backend.logging import AbstractLogger, LocalLogger, LogLevel
16
-
17
- from .entrypoint import (
18
- prepare_wheelhouse,
19
- scan_entrypoint_from_buildscript,
20
- scan_entrypoint_from_package_metadata,
21
- scan_entrypoint_from_plugin_checkouts,
22
- )
15
+ if TYPE_CHECKING:
16
+ from ai.backend.logging import AbstractLogger
17
+ from ai.backend.logging.types import LogLevel
23
18
 
24
19
  log = logging.getLogger(__spec__.name)
25
20
 
21
+ # LogLevel values for click.Choice - avoid importing ai.backend.logging at module level
22
+ _LOG_LEVELS = ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "TRACE", "NOTSET"]
23
+
26
24
 
27
25
  class FormatOptions(enum.StrEnum):
28
26
  CONSOLE = "console"
@@ -36,14 +34,9 @@ class CLIContext:
36
34
  self.log_level = log_level
37
35
 
38
36
  def __enter__(self) -> Self:
39
- log_config: dict[str, Any] = {}
40
- if self.log_level != LogLevel.NOTSET:
41
- log_config["level"] = self.log_level
42
- log_config["pkg-ns"] = {
43
- "": LogLevel.WARNING,
44
- "ai.backend": self.log_level,
45
- }
46
- self._logger = LocalLogger(log_config)
37
+ from ai.backend.logging import LocalLogger
38
+
39
+ self._logger = LocalLogger(log_level=self.log_level)
47
40
  self._logger.__enter__()
48
41
  return self
49
42
 
@@ -63,6 +56,8 @@ def main(
63
56
  debug: bool,
64
57
  ) -> None:
65
58
  """The root entrypoint for unified CLI of the plugin subsystem"""
59
+ from ai.backend.logging.types import LogLevel
60
+
66
61
  log_level = LogLevel.DEBUG if debug else LogLevel.NOTSET
67
62
  ctx.obj = ctx.with_resource(CLIContext(log_level))
68
63
 
@@ -80,6 +75,13 @@ def scan(
80
75
  group_name: str,
81
76
  format: FormatOptions,
82
77
  ) -> None:
78
+ from .entrypoint import (
79
+ prepare_wheelhouse,
80
+ scan_entrypoint_from_buildscript,
81
+ scan_entrypoint_from_package_metadata,
82
+ scan_entrypoint_from_plugin_checkouts,
83
+ )
84
+
83
85
  sources: dict[str, set[str]] = defaultdict(set)
84
86
  rows = []
85
87
 
@@ -78,27 +78,81 @@ _default_glob_excluded_patterns = [
78
78
  "ai/backend/runner",
79
79
  "ai/backend/kernel",
80
80
  "wheelhouse",
81
+ "tools",
81
82
  ]
82
83
 
84
+ _optimized_glob_search_patterns = {
85
+ # These patterns only apply to scanning BUILD files in dev setups and pex distributions.
86
+ # They do not affect standard package entrypoint searches.
87
+ # NOTE: most entrypoint declaration in BUILD files are in the package's top-level only!
88
+ "backendai_cli_v10": ["ai/backend/*", "ai/backend/appproxy/*"],
89
+ "backendai_network_manager_v1": ["ai/backend/*"],
90
+ "backendai_event_dispatcher_v20": ["ai/backend/*", "ai/backend/appproxy/*"],
91
+ "backendai_stats_monitor_v20": ["ai/backend/*", "ai/backend/appproxy/*"],
92
+ "backendai_error_monitor_v20": ["ai/backend/*", "ai/backend/appproxy/*"],
93
+ "backendai_hook_v20": ["ai/backend/*"],
94
+ "backendai_webapp_v20": ["ai/backend/*"],
95
+ "backendai_scheduler_v10": ["ai/backend/manager"],
96
+ "backendai_agentselector_v10": ["ai/backend/manager"],
97
+ }
83
98
 
84
- def _glob(base_path: Path, filename: str, excluded_patterns: Iterable[str]) -> Iterator[Path]:
85
- q: collections.deque[Path] = collections.deque()
86
- q.append(base_path)
99
+
100
+ def _glob(
101
+ base_path: Path,
102
+ filename: str,
103
+ excluded_patterns: Iterable[str],
104
+ match_patterns: Iterable[str] | None = None,
105
+ ) -> Iterator[Path]:
106
+ q: collections.deque[tuple[Path, bool]] = collections.deque()
107
+ assert base_path.is_dir()
108
+ q.append((base_path, False))
87
109
  while q:
88
- search_path = q.pop()
89
- assert search_path.is_dir()
110
+ search_path, suffix_match = q.pop()
111
+
112
+ # Check if current directory matches any pattern and we should yield files from it
113
+ current_matches = False
114
+ if match_patterns is not None:
115
+ current_matches = any(search_path.match(pattern) for pattern in match_patterns)
116
+
90
117
  for item in search_path.iterdir():
91
118
  if item.is_dir():
92
- if search_path.name == "__pycache__":
119
+ if item.name == "__pycache__":
93
120
  continue
94
- if search_path.name.startswith("."):
121
+ if item.name.startswith("."):
95
122
  continue
96
- if any(search_path.match(pattern) for pattern in excluded_patterns):
123
+ if any(item.match(pattern) for pattern in excluded_patterns):
97
124
  continue
98
- q.append(item)
125
+
126
+ # Determine if we should queue this directory
127
+ should_queue = False
128
+ new_suffix_match = False
129
+
130
+ if match_patterns is None:
131
+ # No patterns specified - queue all non-excluded directories
132
+ should_queue = True
133
+ new_suffix_match = False
134
+ elif not suffix_match:
135
+ # Haven't found a matching directory yet - check if this one matches
136
+ if any(item.match(pattern) for pattern in match_patterns):
137
+ should_queue = True
138
+ new_suffix_match = True
139
+ else:
140
+ # Keep searching - queue without suffix match
141
+ should_queue = True
142
+ new_suffix_match = False
143
+ else:
144
+ # Already found a matching directory - only queue if this also matches
145
+ if any(item.match(pattern) for pattern in match_patterns):
146
+ should_queue = True
147
+ new_suffix_match = True
148
+
149
+ if should_queue:
150
+ q.append((item, new_suffix_match))
99
151
  else:
100
152
  if item.name == filename:
101
- yield item
153
+ # Yield file if no patterns or current directory matches
154
+ if match_patterns is None or current_matches:
155
+ yield item
102
156
 
103
157
 
104
158
  def scan_entrypoint_from_buildscript(group_name: str) -> Iterator[EntryPoint]:
@@ -108,11 +162,17 @@ def scan_entrypoint_from_buildscript(group_name: str) -> Iterator[EntryPoint]:
108
162
  log.debug(
109
163
  "scan_entrypoint_from_buildscript(%r): Namespace path: %s", group_name, ai_backend_ns_path
110
164
  )
111
- for buildscript_path in _glob(ai_backend_ns_path, "BUILD", _default_glob_excluded_patterns):
165
+ match_patterns = _optimized_glob_search_patterns.get(group_name, None)
166
+ # First, it is invoked in PEX or temporary test environment generated by Pantsbuild.
167
+ # In the test environment, BUILD files are NOT copied, so the plugin discovery will rely on the
168
+ # followed build-root search below.
169
+ for buildscript_path in _glob(
170
+ ai_backend_ns_path, "BUILD", _default_glob_excluded_patterns, match_patterns
171
+ ):
112
172
  for entrypoint in extract_entrypoints_from_buildscript(group_name, buildscript_path):
113
173
  entrypoints[entrypoint.name] = entrypoint
114
174
  if os.environ.get("SCIE", None) is None:
115
- # Override with the entrypoints found in the current source directories,
175
+ # Override with the entrypoints found in the current build-root directory.
116
176
  try:
117
177
  build_root = find_build_root()
118
178
  except ValueError:
@@ -120,7 +180,9 @@ def scan_entrypoint_from_buildscript(group_name: str) -> Iterator[EntryPoint]:
120
180
  else:
121
181
  src_path = build_root / "src"
122
182
  log.debug("scan_entrypoint_from_buildscript(%r): current src: %s", group_name, src_path)
123
- for buildscript_path in _glob(src_path, "BUILD", _default_glob_excluded_patterns):
183
+ for buildscript_path in _glob(
184
+ src_path, "BUILD", _default_glob_excluded_patterns, match_patterns
185
+ ):
124
186
  for entrypoint in extract_entrypoints_from_buildscript(
125
187
  group_name, buildscript_path
126
188
  ):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: backend.ai-plugin
3
- Version: 25.11.0
3
+ Version: 25.19.1
4
4
  Summary: Backend.AI Plugin Subsystem
5
5
  Home-page: https://github.com/lablup/backend.ai
6
6
  Author: Lablup Inc. and contributors
@@ -20,10 +20,12 @@ Classifier: Programming Language :: Python :: 3.13
20
20
  Classifier: License :: OSI Approved :: MIT License
21
21
  Requires-Python: >=3.13,<3.14
22
22
  Description-Content-Type: text/markdown
23
- Requires-Dist: backend.ai-logging==25.11.0
23
+ Requires-Dist: backend.ai-common==25.19.1
24
+ Requires-Dist: backend.ai-logging==25.19.1
24
25
  Requires-Dist: click~=8.1.7
25
26
  Requires-Dist: colorama>=0.4.6
26
27
  Requires-Dist: tabulate~=0.8.9
28
+ Requires-Dist: types-colorama
27
29
  Requires-Dist: types-tabulate
28
30
  Dynamic: author
29
31
  Dynamic: classifier
@@ -0,0 +1,7 @@
1
+ backend.ai-common==25.19.1
2
+ backend.ai-logging==25.19.1
3
+ click~=8.1.7
4
+ colorama>=0.4.6
5
+ tabulate~=0.8.9
6
+ types-colorama
7
+ types-tabulate
@@ -26,11 +26,14 @@ setup(**{
26
26
  ],
27
27
  },
28
28
  'install_requires': (
29
- """backend.ai-logging==25.11.0
29
+ """backend.ai-common==25.19.1
30
+ """,
31
+ """backend.ai-logging==25.19.1
30
32
  """,
31
33
  'click~=8.1.7',
32
34
  'colorama>=0.4.6',
33
35
  'tabulate~=0.8.9',
36
+ 'types-colorama',
34
37
  'types-tabulate',
35
38
  ),
36
39
  'license': 'MIT',
@@ -61,7 +64,7 @@ Package Structure
61
64
  },
62
65
  'python_requires': '>=3.13,<3.14',
63
66
  'url': 'https://github.com/lablup/backend.ai',
64
- 'version': """25.11.0
67
+ 'version': """25.19.1
65
68
  """,
66
69
  'zip_safe': False,
67
70
  })
@@ -1 +0,0 @@
1
- 25.11.0
@@ -1,5 +0,0 @@
1
- backend.ai-logging==25.11.0
2
- click~=8.1.7
3
- colorama>=0.4.6
4
- tabulate~=0.8.9
5
- types-tabulate