bazaar-compute-node 0.3.0rc15__tar.gz → 0.3.0rc17__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,15 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bazaar-compute-node
3
- Version: 0.3.0rc15
4
- Summary: The Bazaar Compute Node Application
3
+ Version: 0.3.0rc17
4
+ Summary: The Bazaar Compute Node Application, installed as bazaar-compute[node]
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
7
- Requires-Dist: bazaar-core~=0.3.0rc1
8
- Requires-Dist: bazaar-contrib-config~=0.3.0rc1
9
- Requires-Dist: bazaar-contrib-config-versions~=0.3.0rc1
10
- Requires-Dist: bazaar-contrib-manager~=0.3.0rc1
11
- Requires-Dist: bazaar-contrib-invoke~=0.3.0rc1
12
- Requires-Dist: click>=8.1.0
7
+ Requires-Dist: bazaar-compute[node]==0.3.0rc17
13
8
  Requires-Python: >=3.15
14
9
  Project-URL: Repository, https://github.com/yuchanns/bazaar-compute-node
15
10
  Description-Content-Type: text/markdown
@@ -0,0 +1,29 @@
1
+ [project]
2
+ name = "bazaar-compute-node"
3
+ version = "0.3.0rc17"
4
+ description = "The Bazaar Compute Node Application, installed as bazaar-compute[node]"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.15"
9
+ dependencies = ["bazaar-compute[node]==0.3.0rc17"]
10
+
11
+ [project.urls]
12
+ Repository = "https://github.com/yuchanns/bazaar-compute-node"
13
+
14
+ [project.scripts]
15
+ bcn = "bazaar_compute_node.cli:main"
16
+
17
+ [build-system]
18
+ requires = ["uv_build>=0.13.0,<0.14.0"]
19
+ build-backend = "uv_build"
20
+
21
+ [tool.uv.build-backend]
22
+ module-name = []
23
+ module-root = ""
24
+
25
+ [tool.bcn.ci]
26
+ skip = true
27
+
28
+ [tool.pyright]
29
+ include = []
@@ -0,0 +1,30 @@
1
+ [project]
2
+ name = "bazaar-compute-node"
3
+ version = "0.3.0rc17"
4
+ description = "The Bazaar Compute Node Application, installed as bazaar-compute[node]"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.15"
9
+ dependencies = ["bazaar-compute[node]==0.3.0rc17"]
10
+
11
+ [project.urls]
12
+ Repository = "https://github.com/yuchanns/bazaar-compute-node"
13
+
14
+ [project.scripts]
15
+ # uv tool links only the executables of the package it installs.
16
+ bcn = "bazaar_compute_node.cli:main"
17
+
18
+ [build-system]
19
+ requires = ["uv_build>=0.13.0,<0.14.0"]
20
+ build-backend = "uv_build"
21
+
22
+ [tool.uv.build-backend]
23
+ module-name = []
24
+ module-root = ""
25
+
26
+ [tool.bcn.ci]
27
+ skip = true
28
+
29
+ [tool.pyright]
30
+ include = []
@@ -1,43 +0,0 @@
1
- [project]
2
- name = "bazaar-compute-node"
3
- version = "0.3.0rc15"
4
- description = "The Bazaar Compute Node Application"
5
- readme = "README.md"
6
- license = "Apache-2.0"
7
- license-files = ["LICENSE"]
8
- requires-python = ">=3.15"
9
- dependencies = [
10
- "bazaar-core~=0.3.0rc1",
11
- "bazaar-contrib-config~=0.3.0rc1",
12
- "bazaar-contrib-config-versions~=0.3.0rc1",
13
- "bazaar-contrib-manager~=0.3.0rc1",
14
- "bazaar-contrib-invoke~=0.3.0rc1",
15
- "click>=8.1.0",
16
- ]
17
-
18
- [project.urls]
19
- Repository = "https://github.com/yuchanns/bazaar-compute-node"
20
-
21
- [project.scripts]
22
- bcn = "bazaar_compute_node.cli:main"
23
-
24
- [build-system]
25
- requires = ["uv_build>=0.13.0,<0.14.0"]
26
- build-backend = "uv_build"
27
-
28
- [tool.pytest.ini_options]
29
- testpaths = ["tests"]
30
- addopts = "-p no:anyio"
31
- asyncio_mode = "auto"
32
- asyncio_default_fixture_loop_scope = "function"
33
-
34
- [tool.pyright]
35
- extends = "../pyrightconfig.json"
36
- include = [
37
- "src",
38
- "tests",
39
- ]
40
- extraPaths = ["tests/fixtures/contribs/src"]
41
-
42
- [tool.ruff]
43
- extend = "../pyproject.toml"
@@ -1,40 +0,0 @@
1
- [project]
2
- name = "bazaar-compute-node"
3
- version = "0.3.0rc15"
4
- description = "The Bazaar Compute Node Application"
5
- readme = "README.md"
6
- license = "Apache-2.0"
7
- license-files = ["LICENSE"]
8
- requires-python = ">=3.15"
9
- dependencies = [
10
- "bazaar-core~=0.3.0rc1",
11
- "bazaar-contrib-config~=0.3.0rc1",
12
- "bazaar-contrib-config-versions~=0.3.0rc1",
13
- "bazaar-contrib-manager~=0.3.0rc1",
14
- "bazaar-contrib-invoke~=0.3.0rc1",
15
- "click>=8.1.0",
16
- ]
17
-
18
- [project.urls]
19
- Repository = "https://github.com/yuchanns/bazaar-compute-node"
20
-
21
- [project.scripts]
22
- bcn = "bazaar_compute_node.cli:main"
23
-
24
- [build-system]
25
- requires = ["uv_build>=0.13.0,<0.14.0"]
26
- build-backend = "uv_build"
27
-
28
- [tool.pytest.ini_options]
29
- testpaths = ["tests"]
30
- addopts = "-p no:anyio"
31
- asyncio_mode = "auto"
32
- asyncio_default_fixture_loop_scope = "function"
33
-
34
- [tool.pyright]
35
- extends = "../pyrightconfig.json"
36
- include = ["src", "tests"]
37
- extraPaths = ["tests/fixtures/contribs/src"]
38
-
39
- [tool.ruff]
40
- extend = "../pyproject.toml"
@@ -1,24 +0,0 @@
1
- """Application entry into the shared contrib composition framework."""
2
-
3
- from __future__ import annotations
4
-
5
- from contextlib import asynccontextmanager
6
- lazy from collections.abc import AsyncIterator, Awaitable, Callable
7
-
8
- lazy from bazaar_core import Composition, ContribEntry, ContribHub
9
-
10
- __all__ = ["run"]
11
-
12
-
13
- @asynccontextmanager
14
- async def run(
15
- bootstrap: Composition,
16
- load: ContribEntry,
17
- *,
18
- prepare: Callable[[ContribHub], Awaitable[None]] | None = None,
19
- ) -> AsyncIterator[ContribHub]:
20
- """Run a caller's bootstrap and loader in one concrete instance graph."""
21
- async with ContribHub().run(bootstrap, load) as hub:
22
- if prepare is not None:
23
- await prepare(hub)
24
- yield hub
@@ -1,3 +0,0 @@
1
- from .cli import main
2
-
3
- main()
@@ -1,213 +0,0 @@
1
- """Node bootstrap inputs, packaged combinations, and concrete input graphs."""
2
-
3
- from __future__ import annotations
4
-
5
- from contextlib import asynccontextmanager
6
- lazy import asyncio
7
- lazy import importlib
8
- lazy import tomllib
9
- lazy from collections.abc import AsyncIterator, Callable, Mapping, Sequence
10
- lazy from importlib.resources import files
11
-
12
- lazy from bazaar_contrib_config import (
13
- CONFIG_PREPARE,
14
- CONFIG_PREPARED,
15
- CONFIG_STORE,
16
- CONFIGURATION,
17
- ConfigDocument,
18
- ConfigFormatError,
19
- Configuration,
20
- ConfigurationEnvironment,
21
- ContribPackage,
22
- EnabledContrib,
23
- configuration,
24
- )
25
- lazy from bazaar_contrib_config_versions import VERSIONS
26
- lazy from bazaar_contrib_manager import CONTRIB_MANAGER, ContribManager
27
- lazy from bazaar_core import (
28
- Composition,
29
- Context,
30
- Contrib,
31
- ContribEntry,
32
- ContribHub,
33
- ContribSpec,
34
- discover,
35
- load,
36
- )
37
-
38
- lazy from . import run
39
-
40
-
41
- def build(document: ConfigDocument) -> Composition:
42
- """Load enabled contrib declarations without interpreting their business input."""
43
- return load(
44
- [
45
- ContribSpec(
46
- contrib=entry.entry,
47
- config=entry.config,
48
- location=f"contribs[{index}].enabled[{position}]",
49
- )
50
- for index, package in enumerate(document.contribs)
51
- if package.applies
52
- for position, entry in enumerate(package.enabled)
53
- ]
54
- )
55
-
56
-
57
- def bootstrap(
58
- *,
59
- configer: str = "config-filesystem",
60
- configer_options: Sequence[str] = (),
61
- start: Callable[[ConfigDocument], Composition] | None = None,
62
- defaults: Mapping[str, object] | None = None,
63
- ) -> tuple[Composition, ContribEntry]:
64
- resource = files(__package__)
65
- definitions = load(
66
- [
67
- ContribSpec(
68
- contrib=configer,
69
- config={"options": configer_options} if configer_options else {},
70
- location="--configer/--configer-options/--config",
71
- required_offers=[CONFIG_STORE],
72
- ),
73
- *VERSIONS,
74
- ]
75
- )
76
- if definitions.diagnostics:
77
- raise ConfigFormatError(
78
- "; ".join(
79
- f"{record.name}: {record.state}" for record in definitions.diagnostics
80
- )
81
- )
82
- entries = []
83
- for entry in definitions.entries:
84
- config = entry.definition.validate_config(entry.config, context=definitions)
85
- entries.append(
86
- EnabledContrib(
87
- entry=entry.name,
88
- config=config.model_dump(mode="json") if config is not None else {},
89
- )
90
- )
91
- if defaults is None:
92
- defaults = tomllib.loads(resource.joinpath("defaults.toml").read_text())
93
- return (
94
- definitions,
95
- ContribEntry(
96
- name="node-configuration",
97
- definition=configuration(
98
- defaults,
99
- build,
100
- environment=ConfigurationEnvironment(
101
- hub="bazaar_core:ContribHub",
102
- entries=tuple(entries),
103
- ),
104
- start=start,
105
- ),
106
- location="defaults.toml",
107
- ),
108
- )
109
-
110
-
111
- @asynccontextmanager
112
- async def node(
113
- *,
114
- configer: str = "config-filesystem",
115
- configer_options: Sequence[str] = (),
116
- start: Callable[[ConfigDocument], Composition] | None = None,
117
- ) -> AsyncIterator[ContribHub]:
118
- """Prepare configured dependencies before selecting business definitions."""
119
-
120
- if configer == "config-filesystem" and not any(
121
- source.name == configer for source in await asyncio.to_thread(discover)
122
- ):
123
- managers: list[ContribManager] = []
124
-
125
- @asynccontextmanager
126
- async def observe_manager(ctx: Context):
127
- managers.append(ctx.accept(CONTRIB_MANAGER))
128
- yield
129
-
130
- document = ConfigDocument(
131
- contribs=(
132
- ContribPackage(package="bazaar-contrib-config-filesystem~=0.3.0rc1"),
133
- ContribPackage(
134
- enabled=(
135
- EnabledContrib(entry="commands"),
136
- EnabledContrib(entry="contrib-manager"),
137
- )
138
- ),
139
- )
140
- )
141
- entries, loader = await asyncio.to_thread(
142
- bootstrap,
143
- configer="config-memory",
144
- defaults=document.model_dump(mode="json"),
145
- )
146
- async with (
147
- run(entries, loader) as hub,
148
- hub.enable(
149
- Composition(
150
- entries=[
151
- ContribEntry(
152
- name="bootstrap-manager",
153
- definition=Contrib(
154
- accepts=[CONTRIB_MANAGER], lifespan=observe_manager
155
- ),
156
- )
157
- ]
158
- )
159
- ),
160
- ):
161
- Configuration.check(hub)
162
- result = await managers[0].bootstrap()
163
- if result.error:
164
- raise ConfigFormatError(result.error)
165
- await asyncio.to_thread(importlib.invalidate_caches)
166
-
167
- configurations: list[Configuration] = []
168
- preparers: list[str] = []
169
- prepared = asyncio.Semaphore(0)
170
-
171
- @asynccontextmanager
172
- async def dependencies(ctx: Context):
173
- configurations.append(ctx.accept(CONFIGURATION))
174
- yield
175
-
176
- def initial(document: ConfigDocument) -> Composition:
177
- composition = build(document)
178
- preparers.extend(
179
- entry.name
180
- for entry in composition.entries
181
- if CONFIG_PREPARE in entry.definition.listen
182
- )
183
- entry = ContribEntry(
184
- name="node-dependencies",
185
- definition=Contrib(
186
- accepts=[CONFIGURATION],
187
- lifespan=dependencies,
188
- listen={CONFIG_PREPARED: lambda ctx, _: prepared.release()},
189
- ),
190
- )
191
- return composition.model_copy(
192
- update={
193
- "entries": (*composition.entries, entry),
194
- "roots": (entry.name, *preparers),
195
- }
196
- )
197
-
198
- entries, loader = await asyncio.to_thread(
199
- bootstrap,
200
- configer=configer,
201
- configer_options=configer_options,
202
- start=initial,
203
- )
204
-
205
- async def prepare(hub: ContribHub) -> None:
206
- Configuration.check(hub)
207
- await hub.announce(CONFIG_PREPARE, None)
208
- for _ in preparers:
209
- await prepared.acquire()
210
- await configurations[0].select(start)
211
-
212
- async with run(entries, loader, prepare=prepare) as hub:
213
- yield hub
@@ -1,160 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from contextlib import asynccontextmanager
4
- lazy import asyncio
5
- lazy from collections.abc import Sequence
6
-
7
- import click
8
- from bazaar_contrib_config import ConfigDocument, Configuration
9
- from bazaar_contrib_invoke import COMMANDS, CommandCatalog, Commands
10
- from bazaar_core import Composition, Context, Contrib, ContribEntry
11
-
12
- lazy from .boot import build, node
13
-
14
-
15
- async def dispatch(
16
- args: Sequence[str],
17
- *,
18
- prog_name: str | None,
19
- configer: str,
20
- configer_options: tuple[str, ...],
21
- ) -> None:
22
- failures: list[click.ClickException | click.exceptions.Exit | click.Abort] = []
23
- roots: list[str] = []
24
- selected: list[Commands] = []
25
-
26
- def start(document: ConfigDocument) -> Composition:
27
- catalog = CommandCatalog(
28
- contribs=(
29
- *(
30
- entry.entry
31
- for package in document.contribs
32
- if package.applies
33
- for entry in package.enabled
34
- ),
35
- ),
36
- help=main.help,
37
- params=main.params,
38
- )
39
- try:
40
- entry = catalog.select(args, prog_name=prog_name)
41
- if entry is not None:
42
- roots.append(entry.contrib)
43
- except (click.ClickException, click.exceptions.Exit, click.Abort) as error:
44
- failures.append(error)
45
- return build(document).model_copy(update={"roots": tuple(roots)})
46
-
47
- @asynccontextmanager
48
- async def observe(ctx: Context):
49
- commands = ctx.accept(COMMANDS)
50
- commands.help = main.help
51
- commands.params.extend(main.params)
52
- selected.append(commands)
53
- yield
54
-
55
- async with node(
56
- start=start, configer=configer, configer_options=configer_options
57
- ) as hub:
58
- Configuration.check(hub.validate(Composition()))
59
- if roots:
60
- async with hub.enable(
61
- Composition(
62
- entries=[
63
- ContribEntry(
64
- name="command-dispatch",
65
- definition=Contrib(accepts=[COMMANDS], lifespan=observe),
66
- )
67
- ]
68
- )
69
- ):
70
- try:
71
- await selected[0].dispatch(args, prog_name=prog_name)
72
- except (
73
- click.ClickException,
74
- click.exceptions.Exit,
75
- click.Abort,
76
- ) as error:
77
- failures.append(error)
78
- if failures:
79
- raise failures[0]
80
-
81
-
82
- NODE_OPTIONS = {
83
- "--configer": "configer",
84
- "--configer-options": "configer_options",
85
- "--config": "configer_options",
86
- }
87
-
88
-
89
- @click.command(
90
- add_help_option=False,
91
- context_settings={
92
- "allow_extra_args": True,
93
- "ignore_unknown_options": True,
94
- "allow_interspersed_args": False,
95
- },
96
- )
97
- @click.version_option(package_name="bazaar-compute-node")
98
- @click.option(
99
- "--configer",
100
- default="config-filesystem",
101
- show_default=True,
102
- help="Configuration contrib to use.",
103
- )
104
- @click.option(
105
- "--configer-options",
106
- multiple=True,
107
- metavar="OPTION",
108
- help="Option passed to the configuration contrib; may be repeated.",
109
- )
110
- @click.option(
111
- "--config",
112
- "configer_options",
113
- multiple=True,
114
- metavar="OPTION",
115
- help="Legacy alias for --configer-options.",
116
- )
117
- @click.pass_context
118
- def main(ctx: click.Context, configer: str, configer_options: tuple[str, ...]) -> None:
119
- """Run Bazaar Compute Node."""
120
- # 0.2 also took node options after the command; those replace earlier ones.
121
- args: list[str] = []
122
- after: dict[str, list[str]] = {}
123
- remaining = iter(ctx.args)
124
- for arg in remaining:
125
- name, equals, value = arg.partition("=")
126
- if name not in NODE_OPTIONS:
127
- args.append(arg)
128
- continue
129
- if not equals:
130
- value = next(remaining, None)
131
- if value is None:
132
- raise click.BadParameter("requires a value", param_hint=name)
133
- after.setdefault(NODE_OPTIONS[name], []).append(value)
134
- if "configer" in after:
135
- configer = after["configer"][-1]
136
- if "configer_options" in after:
137
- configer_options = tuple(after["configer_options"])
138
- try:
139
- asyncio.run(
140
- dispatch(
141
- args,
142
- prog_name=ctx.info_name,
143
- configer=configer,
144
- configer_options=configer_options,
145
- )
146
- )
147
- except click.exceptions.Exit as error:
148
- ctx.exit(error.exit_code)
149
- except click.ClickException, click.Abort:
150
- raise
151
- except Exception as error:
152
- pending: list[BaseException] = [error]
153
- errors: list[str] = []
154
- while pending:
155
- error = pending.pop()
156
- if isinstance(error, BaseExceptionGroup):
157
- pending.extend(error.exceptions)
158
- else:
159
- errors.append(str(error))
160
- raise click.ClickException("; ".join(errors)) from error
@@ -1,126 +0,0 @@
1
- version = "5"
2
- contrib_indexes = [
3
- "resource://bazaar_contrib_manager/catalog.json",
4
- "resource://bazaar_contrib_manager/open_bazaar_index.json",
5
- ]
6
-
7
- [[contribs]]
8
- package = "bazaar-contrib-config-filesystem~=0.3.0rc1"
9
- enabled = []
10
-
11
- [[contribs]]
12
- package = "bazaar-contrib-agent~=0.3.0rc1"
13
- [[contribs.enabled]]
14
- entry = "agent"
15
- [contribs.enabled.config]
16
- agents = []
17
- [[contribs.enabled]]
18
- entry = "agent-execution"
19
- [[contribs.enabled]]
20
- entry = "agent-activity"
21
-
22
- [[contribs]]
23
- package = "bazaar-contrib-agent-command~=0.3.0rc1"
24
- [[contribs.enabled]]
25
- entry = "agent-command"
26
-
27
- [[contribs]]
28
- package = "bazaar-contrib-audit~=0.3.0rc1"
29
- [[contribs.enabled]]
30
- entry = "audit"
31
-
32
- [[contribs]]
33
- package = "bazaar-contrib-channel~=0.3.0rc1"
34
- [[contribs.enabled]]
35
- entry = "channel-builders"
36
-
37
- [[contribs]]
38
- package = "bazaar-contrib-harness~=0.3.0rc1"
39
- [[contribs.enabled]]
40
- entry = "harness-builders"
41
-
42
- [[contribs]]
43
- package = "bazaar-contrib-invoke~=0.3.0rc1"
44
- [[contribs.enabled]]
45
- entry = "commands"
46
-
47
- [[contribs]]
48
- package = "bazaar-contrib-node-management~=0.3.0rc1"
49
- [[contribs.enabled]]
50
- entry = "node-management"
51
- [[contribs.enabled]]
52
- entry = "node-health"
53
-
54
- [[contribs]]
55
- package = "bazaar-contrib-status~=0.3.0rc1"
56
- [[contribs.enabled]]
57
- entry = "status"
58
-
59
- [[contribs]]
60
- package = "bazaar-contrib-manager~=0.3.0rc1"
61
- [[contribs.enabled]]
62
- entry = "contrib-manager"
63
-
64
- [[contribs]]
65
- package = "bazaar-contrib-logging~=0.3.0rc1"
66
- [[contribs.enabled]]
67
- entry = "logging"
68
-
69
- [[contribs]]
70
- package = "bazaar-contrib-sidecar~=0.3.0rc1"
71
- [[contribs.enabled]]
72
- entry = "sidecar"
73
-
74
- [[contribs]]
75
- package = "bazaar-contrib-sidecar-unix~=0.3.0rc1; sys_platform != 'win32'"
76
- [[contribs.enabled]]
77
- entry = "sidecar-unix"
78
-
79
- [[contribs]]
80
- package = "bazaar-contrib-sidecar-windows~=0.3.0rc1; sys_platform == 'win32'"
81
- [[contribs.enabled]]
82
- entry = "sidecar-windows"
83
-
84
- [[contribs]]
85
- package = "bazaar-contrib-storage~=0.3.0rc1"
86
- [[contribs.enabled]]
87
- entry = "storage"
88
- [[contribs.enabled]]
89
- entry = "database"
90
- [contribs.enabled.config]
91
- backend = "sqlite"
92
-
93
- [[contribs]]
94
- package = "bazaar-contrib-sqlite~=0.3.0rc1"
95
- [[contribs.enabled]]
96
- entry = "sqlite"
97
-
98
- [[contribs]]
99
- package = "bazaar-contrib-schema~=0.3.0rc1"
100
- [[contribs.enabled]]
101
- entry = "schema"
102
-
103
- [[contribs]]
104
- package = "bazaar-contrib-legacy-node-migrations~=0.3.0rc1"
105
- [[contribs.enabled]]
106
- entry = "legacy-node-migrations"
107
-
108
- [[contribs]]
109
- package = "bazaar-contrib-messages-node~=0.3.0rc1"
110
- [[contribs.enabled]]
111
- entry = "messages-node"
112
-
113
- [[contribs]]
114
- package = "bazaar-contrib-collaboration~=0.3.0rc1"
115
- [[contribs.enabled]]
116
- entry = "collaboration"
117
-
118
- [[contribs]]
119
- package = "bazaar-contrib-reminder~=0.3.0rc1"
120
- [[contribs.enabled]]
121
- entry = "reminder"
122
-
123
- [[contribs]]
124
- package = "bazaar-contrib-timer-wheel~=0.3.0rc1"
125
- [[contribs.enabled]]
126
- entry = "timer-wheel"