basstler-recommender 4.17.0__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.
@@ -0,0 +1,3 @@
1
+ """
2
+ Ranking what to work on next by the owner's priority policy.
3
+ """
@@ -0,0 +1,22 @@
1
+ """
2
+ What basstler-recommender adds to a playbook that opts into it.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from basstler.class_property import classproperty
8
+ from basstler.playbook.command_group import CommandGroup
9
+ from basstler.playbook.component import PlaybookComponent
10
+ from basstler.playbook.contribution import PackageContribution
11
+ from basstler.recommender.recommender_command import recommender_app
12
+
13
+
14
+ class RecommenderContribution(PackageContribution):
15
+ """
16
+ The recommender commands, registered under no entry point: a project's playbook adds
17
+ them.
18
+ """
19
+
20
+ @classproperty
21
+ def playbook_components(cls) -> tuple[PlaybookComponent, ...]:
22
+ return (CommandGroup(recommender_app),)
@@ -0,0 +1,183 @@
1
+ """
2
+ The ways the owner's priority policy can break a rule the ranking relies on.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from abc import ABC
8
+ from dataclasses import dataclass
9
+
10
+ from krrood.exceptions import DataclassException
11
+
12
+ from basstler.plan.work_classification import ItemKind
13
+
14
+ # %% the violations
15
+
16
+
17
+ class PolicyViolation(DataclassException, ValueError, ABC):
18
+ """
19
+ Raised when the policy file breaks a rule its schema alone does not state.
20
+ """
21
+
22
+
23
+ @dataclass
24
+ class IncompleteKindOrder(PolicyViolation):
25
+ """
26
+ Raised when the kind order does not name every item kind exactly once.
27
+ """
28
+
29
+ kind_order: tuple[ItemKind, ...]
30
+ """
31
+ The kind order as the file lists it.
32
+ """
33
+
34
+ def error_message(self) -> str:
35
+ return f"the kind order names {', '.join(self.kind_order)}"
36
+
37
+ def suggest_correction(self) -> str:
38
+ return f"list each of {', '.join(ItemKind)} once, the one ranked first leading"
39
+
40
+
41
+ @dataclass
42
+ class RepeatedName(PolicyViolation):
43
+ """
44
+ Raised when two entries of one list share the name the list tells them apart by.
45
+ """
46
+
47
+ names: tuple[str, ...]
48
+ """
49
+ Every name more than one entry carries.
50
+ """
51
+
52
+ def error_message(self) -> str:
53
+ return f"named more than once: {', '.join(self.names)}"
54
+
55
+ def suggest_correction(self) -> str:
56
+ return "merge the entries sharing a name into one, or rename one of them"
57
+
58
+
59
+ @dataclass
60
+ class SharesOverWhole(PolicyViolation):
61
+ """
62
+ Raised when the weekly targets ask for more than all of a week's points.
63
+ """
64
+
65
+ total_share: float
66
+ """
67
+ What the targets' shares add up to.
68
+ """
69
+
70
+ def error_message(self) -> str:
71
+ return f"the weekly targets' shares add up to {self.total_share}, more than 1"
72
+
73
+ def suggest_correction(self) -> str:
74
+ return "lower the shares until they add up to 1 at most"
75
+
76
+
77
+ @dataclass
78
+ class SizeBucketsOutOfOrder(PolicyViolation):
79
+ """
80
+ Raised when a size bucket other than the last does not end above the one before it.
81
+ """
82
+
83
+ most_changed_lines: tuple[int | None, ...]
84
+ """
85
+ Where each bucket but the last ends, in the file's order; ``None`` for one that
86
+ does not end.
87
+ """
88
+
89
+ def error_message(self) -> str:
90
+ bounds = ", ".join(str(bound) for bound in self.most_changed_lines)
91
+ return f"the size buckets end at {bounds}, not each above the one before"
92
+
93
+ def suggest_correction(self) -> str:
94
+ return (
95
+ "list the buckets smallest first, each but the last with a "
96
+ "most_changed_lines above the one before"
97
+ )
98
+
99
+
100
+ @dataclass
101
+ class SizePointsNotRising(PolicyViolation):
102
+ """
103
+ Raised when a size bucket counts no more points than the one before it.
104
+ """
105
+
106
+ points: tuple[int, ...]
107
+ """
108
+ The points of each bucket, in the file's order.
109
+ """
110
+
111
+ def error_message(self) -> str:
112
+ points = ", ".join(str(bucket_points) for bucket_points in self.points)
113
+ return (
114
+ f"the size buckets count {points} points, not each more than the one before"
115
+ )
116
+
117
+ def suggest_correction(self) -> str:
118
+ return "give each bucket more points than the one before it"
119
+
120
+
121
+ @dataclass
122
+ class SizeWithoutBucket(PolicyViolation):
123
+ """
124
+ Raised when the last size bucket ends, so the largest changes fall in none.
125
+ """
126
+
127
+ largest_bucket_name: str
128
+ """
129
+ The name of the last bucket, which ends.
130
+ """
131
+
132
+ def error_message(self) -> str:
133
+ return f"the last size bucket, {self.largest_bucket_name}, ends"
134
+
135
+ def suggest_correction(self) -> str:
136
+ return f"leave most_changed_lines out of {self.largest_bucket_name}"
137
+
138
+
139
+ @dataclass
140
+ class EmptyWorkMatcher(PolicyViolation):
141
+ """
142
+ Raised when a work matcher names no repository, path, label or keyword, so it
143
+ matches no work.
144
+ """
145
+
146
+ def error_message(self) -> str:
147
+ return "a work matcher names no repository, path pattern, label or keyword"
148
+
149
+ def suggest_correction(self) -> str:
150
+ return (
151
+ "give it a repository, path pattern, label or keyword, or remove its owner"
152
+ )
153
+
154
+
155
+ @dataclass
156
+ class UndeclaredFocusArea(PolicyViolation):
157
+ """
158
+ Raised when a weekly target or a topic names a focus area the project's playbook
159
+ does not declare, so no item can serve it.
160
+ """
161
+
162
+ focus_area_names: tuple[str, ...]
163
+ """
164
+ The area names the policy gives that the playbook does not declare.
165
+ """
166
+
167
+ declared_area_names: tuple[str, ...]
168
+ """
169
+ The names of the areas the playbook declares.
170
+ """
171
+
172
+ def error_message(self) -> str:
173
+ return (
174
+ "the policy names focus areas the playbook does not declare: "
175
+ f"{', '.join(self.focus_area_names)}"
176
+ )
177
+
178
+ def suggest_correction(self) -> str:
179
+ declared = ", ".join(self.declared_area_names) or "none so far"
180
+ return (
181
+ f"name one of the playbook's focus areas ({declared}), or declare the area "
182
+ "in the project's playbook"
183
+ )
@@ -0,0 +1,18 @@
1
+ """
2
+ The files and directories the recommender names.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from basstler.locations import ProjectFile, ProjectLocation
8
+
9
+
10
+ class RecommenderProjectLocation(ProjectFile):
11
+ """
12
+ The recommender's files on the personal-notes branch.
13
+ """
14
+
15
+ PRIORITY_POLICY = ProjectLocation.PLANS / "_priorities.yaml"
16
+ """
17
+ The owner's priority policy, kept beside the hub file on the registry's notes.
18
+ """
@@ -0,0 +1,436 @@
1
+ """
2
+ The owner's priority policy: every rule the ranking of what to work on next follows,
3
+ read from one file on the registry's notes.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from abc import ABC, abstractmethod
9
+ from pathlib import PurePosixPath
10
+ from typing import Annotated, Self
11
+
12
+ import pydantic
13
+ import yaml
14
+ from pydantic import AfterValidator, ConfigDict, Field
15
+
16
+ from basstler.github.repository import GitHubAddress, Repository
17
+ from basstler.github.wire_form import RepositoryFullName
18
+ from basstler.json_model import ValidatedJSONModel
19
+ from basstler.plan.validation_configuration import ValidationConfiguration
20
+ from basstler.plan.work_classification import ItemKind
21
+ from basstler.plan_site.hub import NotesBranch
22
+ from basstler.recommender.exceptions import (
23
+ EmptyWorkMatcher,
24
+ IncompleteKindOrder,
25
+ RepeatedName,
26
+ SharesOverWhole,
27
+ SizeBucketsOutOfOrder,
28
+ SizePointsNotRising,
29
+ SizeWithoutBucket,
30
+ UndeclaredFocusArea,
31
+ )
32
+ from basstler.recommender.locations import RecommenderProjectLocation
33
+
34
+ # %% sections
35
+
36
+
37
+ class PolicySection(ValidatedJSONModel, config=ConfigDict(extra="forbid")):
38
+ """
39
+ A part of the policy file, refusing keys it does not read.
40
+ """
41
+
42
+
43
+ class NamedPolicyEntry(PolicySection, ABC):
44
+ """
45
+ An entry of a policy list whose entries no two share a name.
46
+ """
47
+
48
+ @property
49
+ @abstractmethod
50
+ def distinguishing_name(self) -> str:
51
+ """
52
+ The name no other entry of the list shares.
53
+ """
54
+
55
+ @staticmethod
56
+ def refuse_repeated_names[Entry: NamedPolicyEntry](
57
+ entries: tuple[Entry, ...],
58
+ ) -> tuple[Entry, ...]:
59
+ """
60
+ :param entries: The list's entries as read.
61
+ :raises RepeatedName: If two entries share a name.
62
+ :return: The same entries.
63
+ """
64
+ names = [entry.distinguishing_name for entry in entries]
65
+ repeated = tuple(sorted({name for name in names if names.count(name) > 1}))
66
+ if repeated:
67
+ raise RepeatedName(repeated)
68
+ return entries
69
+
70
+
71
+ class HasFocusAreaName(PolicySection):
72
+ """
73
+ A policy entry belonging to one focus area.
74
+ """
75
+
76
+ focus_area_name: str
77
+ """
78
+ The focus area, by the name ``plan.yaml``'s ``focus`` gives it; the project's
79
+ playbook declares it.
80
+ """
81
+
82
+
83
+ # %% the daily queue
84
+
85
+
86
+ class TaskSourceSlotsOfTheDay(NamedPolicyEntry):
87
+ """
88
+ The slots of the daily queue one task source fills.
89
+ """
90
+
91
+ task_source_name: str
92
+ """
93
+ The name of the task source, as the playbook providing it names it.
94
+ """
95
+
96
+ slot_count: pydantic.PositiveInt
97
+ """
98
+ How many of the day's tasks the source fills.
99
+ """
100
+
101
+ @property
102
+ def distinguishing_name(self) -> str:
103
+ return self.task_source_name
104
+
105
+
106
+ class DailyQueue(PolicySection):
107
+ """
108
+ The shape of one day's queue of tasks and the effort it may hold.
109
+ """
110
+
111
+ maximum_point_budget_for_the_day: pydantic.PositiveInt
112
+ """
113
+ The most size-bucket points the day's tasks may add up to.
114
+ """
115
+
116
+ slots: Annotated[
117
+ tuple[TaskSourceSlotsOfTheDay, ...],
118
+ Field(min_length=1),
119
+ AfterValidator(NamedPolicyEntry.refuse_repeated_names),
120
+ ]
121
+ """
122
+ The slots, a source an entry, in the order the queue lists them.
123
+ """
124
+
125
+
126
+ # %% effort
127
+
128
+
129
+ class WeeklyTarget(NamedPolicyEntry, HasFocusAreaName):
130
+ """
131
+ The least share of a week's points one focus area takes.
132
+ """
133
+
134
+ least_point_share_of_the_week: Annotated[float, Field(gt=0, le=1)]
135
+ """
136
+ The fraction of the week's points spent on the area's items, at least.
137
+ """
138
+
139
+ @property
140
+ def distinguishing_name(self) -> str:
141
+ return self.focus_area_name
142
+
143
+
144
+ class SizeBucket(NamedPolicyEntry):
145
+ """
146
+ A size class of a change, like a T-shirt size, and the points a change of that size
147
+ counts for. A change falls in the first bucket whose :attr:`most_changed_lines` its
148
+ added and deleted lines do not exceed; budgets and targets add up these points.
149
+ """
150
+
151
+ name: str
152
+ """
153
+ The bucket's label, such as ``S`` or ``XL``.
154
+ """
155
+
156
+ points: pydantic.PositiveInt
157
+ """
158
+ What a change in the bucket counts towards a budget or a target.
159
+ """
160
+
161
+ most_changed_lines: pydantic.PositiveInt | None = None
162
+ """
163
+ The most added and deleted lines a change in the bucket has, ``None`` for the
164
+ largest bucket, which has no bound.
165
+ """
166
+
167
+ @property
168
+ def distinguishing_name(self) -> str:
169
+ return self.name
170
+
171
+
172
+ # %% topics
173
+
174
+
175
+ class WorkMatcher(PolicySection):
176
+ """
177
+ What marks a piece of work, such as a pull request, as about a subject: any one of
178
+ its repositories, path patterns, labels or keywords matching it.
179
+ """
180
+
181
+ repositories: tuple[Annotated[Repository, RepositoryFullName()], ...] = ()
182
+ """
183
+ Repositories whose every piece of work matches.
184
+ """
185
+
186
+ path_patterns: tuple[str, ...] = ()
187
+ """
188
+ Glob patterns, as git and ``.gitignore`` write them, of the file paths a matching
189
+ change touches.
190
+ """
191
+
192
+ labels: tuple[str, ...] = ()
193
+ """
194
+ Issue and pull request labels that mark matching work.
195
+ """
196
+
197
+ keywords: tuple[str, ...] = ()
198
+ """
199
+ Words whose presence in a title or description marks matching work.
200
+ """
201
+
202
+ @pydantic.model_validator(mode="after")
203
+ def refuse_matching_nothing(self) -> Self:
204
+ """
205
+ :raises EmptyWorkMatcher: If the matcher names nothing it matches.
206
+ :return: The matcher.
207
+ """
208
+ if self.repositories or self.path_patterns or self.labels or self.keywords:
209
+ return self
210
+ raise EmptyWorkMatcher()
211
+
212
+
213
+ class Topic(NamedPolicyEntry, HasFocusAreaName):
214
+ """
215
+ A subject within a focus area, such as a thesis chapter, and what tells that work no
216
+ plan item describes, such as someone else's pull request, is about it. A plan item's
217
+ own ``focus`` names its area without matching.
218
+ """
219
+
220
+ name: str
221
+ """
222
+ The topic's name, unique among the policy's topics.
223
+ """
224
+
225
+ work_matcher: WorkMatcher
226
+ """
227
+ What marks work as about the topic.
228
+ """
229
+
230
+ @property
231
+ def distinguishing_name(self) -> str:
232
+ return self.name
233
+
234
+
235
+ # %% writing
236
+
237
+
238
+ class WritingProject(PolicySection):
239
+ """
240
+ A long document the owner writes, such as a thesis, and the length it aims for.
241
+ """
242
+
243
+ repository: Annotated[Repository, RepositoryFullName()]
244
+ """
245
+ The repository holding the document's source.
246
+ """
247
+
248
+ target_page_count: pydantic.PositiveInt
249
+ """
250
+ The number of pages the finished document has.
251
+ """
252
+
253
+ bibliography_files: tuple[PurePosixPath, ...] = ()
254
+ """
255
+ The document's BibTeX files, relative to the repository's root.
256
+ """
257
+
258
+
259
+ # %% the policy
260
+
261
+
262
+ class PriorityPolicy(PolicySection):
263
+ """
264
+ Every rule the ranking follows, as the owner configures it.
265
+ """
266
+
267
+ kind_order: tuple[ItemKind, ...]
268
+ """
269
+ Every item kind once, the kind ranked first leading.
270
+ """
271
+
272
+ daily_queue: DailyQueue
273
+ """
274
+ The shape and budget of one day's queue.
275
+ """
276
+
277
+ awaiting_review_limit: pydantic.NonNegativeInt
278
+ """
279
+ The most of the owner's own open pull requests that may wait for review while a new
280
+ item starts.
281
+ """
282
+
283
+ size_buckets: Annotated[
284
+ tuple[SizeBucket, ...],
285
+ Field(min_length=1),
286
+ AfterValidator(NamedPolicyEntry.refuse_repeated_names),
287
+ ]
288
+ """
289
+ The buckets a change's size falls in, smallest first, each counting more points
290
+ than the one before.
291
+ """
292
+
293
+ weekly_targets: Annotated[
294
+ tuple[WeeklyTarget, ...],
295
+ AfterValidator(NamedPolicyEntry.refuse_repeated_names),
296
+ ] = ()
297
+ """
298
+ The shares of each week's points the focus areas take.
299
+ """
300
+
301
+ topics: Annotated[
302
+ tuple[Topic, ...], AfterValidator(NamedPolicyEntry.refuse_repeated_names)
303
+ ] = ()
304
+ """
305
+ The subjects work is grouped by.
306
+ """
307
+
308
+ writing_projects: tuple[WritingProject, ...] = ()
309
+ """
310
+ The long documents whose progress the owner tracks.
311
+ """
312
+
313
+ @pydantic.field_validator("kind_order")
314
+ @classmethod
315
+ def refuse_incomplete_kind_order(
316
+ cls, kind_order: tuple[ItemKind, ...]
317
+ ) -> tuple[ItemKind, ...]:
318
+ """
319
+ :param kind_order: The kind order as read.
320
+ :raises IncompleteKindOrder: If it does not name every kind exactly once.
321
+ :return: The same order.
322
+ """
323
+ if sorted(kind_order) == sorted(ItemKind):
324
+ return kind_order
325
+ raise IncompleteKindOrder(kind_order)
326
+
327
+ @pydantic.field_validator("size_buckets")
328
+ @classmethod
329
+ def refuse_uncovered_sizes(
330
+ cls, size_buckets: tuple[SizeBucket, ...]
331
+ ) -> tuple[SizeBucket, ...]:
332
+ """
333
+ :param size_buckets: The buckets as read.
334
+ :raises SizeWithoutBucket: If the last bucket ends.
335
+ :raises SizeBucketsOutOfOrder: If a bucket does not end above the one before it.
336
+ :return: The same buckets.
337
+ """
338
+ *bounded, largest = size_buckets
339
+ if largest.most_changed_lines is not None:
340
+ raise SizeWithoutBucket(largest.name)
341
+ bounds = tuple(bucket.most_changed_lines for bucket in bounded)
342
+ if None in bounds or list(bounds) != sorted(set(bounds)):
343
+ raise SizeBucketsOutOfOrder(bounds)
344
+ return size_buckets
345
+
346
+ @pydantic.field_validator("size_buckets")
347
+ @classmethod
348
+ def refuse_points_not_rising(
349
+ cls, size_buckets: tuple[SizeBucket, ...]
350
+ ) -> tuple[SizeBucket, ...]:
351
+ """
352
+ :param size_buckets: The buckets as read.
353
+ :raises SizePointsNotRising: If a bucket counts no more points than the one
354
+ before it.
355
+ :return: The same buckets.
356
+ """
357
+ points = tuple(bucket.points for bucket in size_buckets)
358
+ if list(points) == sorted(set(points)):
359
+ return size_buckets
360
+ raise SizePointsNotRising(points)
361
+
362
+ @pydantic.field_validator("weekly_targets")
363
+ @classmethod
364
+ def refuse_shares_over_whole(
365
+ cls, weekly_targets: tuple[WeeklyTarget, ...]
366
+ ) -> tuple[WeeklyTarget, ...]:
367
+ """
368
+ :param weekly_targets: The targets as read.
369
+ :raises SharesOverWhole: If their shares add up to more than one.
370
+ :return: The same targets.
371
+ """
372
+ total = sum(target.least_point_share_of_the_week for target in weekly_targets)
373
+ if total <= 1:
374
+ return weekly_targets
375
+ raise SharesOverWhole(total)
376
+
377
+ @classmethod
378
+ def from_yaml(
379
+ cls, text: str, configuration: ValidationConfiguration
380
+ ) -> PriorityPolicy:
381
+ """
382
+ :param text: The policy file's YAML.
383
+ :param configuration: The validation the project's playbook configures.
384
+ :raises pydantic.ValidationError: If the YAML does not hold a valid policy.
385
+ :raises UndeclaredFocusArea: If a weekly target or a topic names an area the
386
+ playbook does not declare.
387
+ :return: The policy it holds.
388
+ """
389
+ policy = cls.from_json(yaml.safe_load(text) or {})
390
+ area_entries = (*policy.weekly_targets, *policy.topics)
391
+ undeclared = tuple(
392
+ dict.fromkeys(
393
+ entry.focus_area_name
394
+ for entry in area_entries
395
+ if not configuration.accepts_focus(entry.focus_area_name)
396
+ )
397
+ )
398
+ if undeclared:
399
+ raise UndeclaredFocusArea(
400
+ undeclared,
401
+ tuple(area.area_name for area in configuration.focus_areas),
402
+ )
403
+ return policy
404
+
405
+ @classmethod
406
+ def from_registry(
407
+ cls,
408
+ registry: Repository,
409
+ configuration: ValidationConfiguration,
410
+ remote_root: str = GitHubAddress.WEB,
411
+ ) -> PriorityPolicy | None:
412
+ """
413
+ :param registry: The repository whose notes hold the policy.
414
+ :param configuration: The validation the project's playbook configures.
415
+ :param remote_root: Where repositories are fetched from, as
416
+ :meth:`Repository.clone_url_under` takes it.
417
+ :raises RegistryUnreadableError: If the registry's notes branch cannot be
418
+ fetched.
419
+ :raises pydantic.ValidationError: If the file does not hold a valid policy.
420
+ :raises UndeclaredFocusArea: If a weekly target or a topic names an area the
421
+ playbook does not declare.
422
+ :return: The policy, or ``None`` when the registry's notes hold none.
423
+ """
424
+ text = NotesBranch.read_registry_file(
425
+ registry, RecommenderProjectLocation.PRIORITY_POLICY, remote_root
426
+ )
427
+ return None if text is None else cls.from_yaml(text, configuration)
428
+
429
+ def render(self, line_width: int = 92) -> str:
430
+ """
431
+ :param line_width: The column past which long values wrap onto the next line.
432
+ :return: The policy file's YAML.
433
+ """
434
+ return yaml.safe_dump(
435
+ self.to_json(), sort_keys=False, allow_unicode=True, width=line_width
436
+ )
@@ -0,0 +1,85 @@
1
+ """
2
+ The ``basstler recommender`` commands: checking the owner's priority policy.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from pathlib import Path
8
+
9
+ from cyclopts import App
10
+
11
+ from basstler.exit_codes import ExitCode
12
+ from basstler.github.repository import GitHubAddress
13
+ from basstler.github.repository_option import RepositoryOption
14
+ from basstler.plan.validation_configuration import ValidationConfiguration
15
+ from basstler.plan_site.local_commands import ServeSettings
16
+ from basstler.recommender.locations import RecommenderProjectLocation
17
+ from basstler.recommender.priority_policy import PriorityPolicy
18
+ from basstler.standard_streams import StandardStreamHandler
19
+
20
+ logger = StandardStreamHandler.logger_for(__name__)
21
+ """
22
+ This module's logger, which is also what its commands print through.
23
+ """
24
+
25
+
26
+ class RecommenderExitCode(ExitCode):
27
+ """
28
+ What a ``basstler recommender`` command's exit status tells its caller.
29
+ """
30
+
31
+ SUCCESS = 0
32
+ """
33
+ The command did what it was asked.
34
+ """
35
+
36
+ NO_REGISTRY = 1
37
+ """
38
+ No registry was given and the checkout's notes name none.
39
+ """
40
+
41
+ NO_POLICY = 2
42
+ """
43
+ The registry's notes hold no priority policy.
44
+ """
45
+
46
+
47
+ recommender_app = App(
48
+ name="recommender",
49
+ help="Rank what to work on next by the owner's priority policy.",
50
+ )
51
+ """
52
+ The ``recommender`` command group.
53
+ """
54
+
55
+
56
+ @recommender_app.command(name="show-policy")
57
+ def show_policy(
58
+ registry: RepositoryOption = None, remote_root: str = GitHubAddress.WEB.value
59
+ ) -> RecommenderExitCode:
60
+ """
61
+ Print the priority policy the registry's notes hold, once it reads as valid for the
62
+ checkout's playbook.
63
+
64
+ :param registry: The repository whose notes hold the policy, by default the
65
+ registry the checkout's notes name.
66
+ :param remote_root: Where repositories are fetched from: GitHub, or a directory
67
+ standing in for it.
68
+ :raises pydantic.ValidationError: If the policy file breaks a rule of the policy.
69
+ :raises UndeclaredFocusArea: If a weekly target or a topic names an area the checkout's
70
+ playbook does not declare.
71
+ """
72
+ registry = registry or ServeSettings.registry_of_checkout(Path.cwd())
73
+ if registry is None:
74
+ logger.error("Name the registry: this checkout's notes name none.")
75
+ return RecommenderExitCode.NO_REGISTRY
76
+ policy = PriorityPolicy.from_registry(
77
+ registry, ValidationConfiguration.from_project(Path.cwd()), remote_root
78
+ )
79
+ if policy is None:
80
+ logger.error(
81
+ f"{registry}'s notes hold no {RecommenderProjectLocation.PRIORITY_POLICY}."
82
+ )
83
+ return RecommenderExitCode.NO_POLICY
84
+ logger.info(policy.render().rstrip("\n"))
85
+ return RecommenderExitCode.SUCCESS
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.5
2
+ Name: basstler-recommender
3
+ Version: 4.17.0
4
+ Summary: Ranking what to work on next by the owner's priority policy.
5
+ Project-URL: Source, https://github.com/KAOS-repositories/basstler
6
+ Project-URL: Bug Tracker, https://github.com/KAOS-repositories/basstler/issues
7
+ Author-email: Abdelrhman Bassiouny <bido.bassuny@gmail.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Requires-Python: >=3.12
12
+ Requires-Dist: basstler-core==4.17.0
13
+ Requires-Dist: basstler-github==4.17.0
14
+ Requires-Dist: basstler-hub==4.17.0
15
+ Requires-Dist: basstler-plan==4.17.0
16
+ Requires-Dist: cyclopts>=5.3
17
+ Requires-Dist: pydantic>=2.11
18
+ Requires-Dist: pyyaml>=6
@@ -0,0 +1,11 @@
1
+ basstler/recommender/__init__.py,sha256=lPfZB3AAdF58jWKbUzb3XPi2091etS3ypNWuHHTXZf0,69
2
+ basstler/recommender/contribution.py,sha256=0b7KpMomwX1klrMwKXOnbmatYmFPqXTG8DFxzOfvaLY,710
3
+ basstler/recommender/exceptions.py,sha256=B5JigBA6LrUQeecQGVB8i59HDxBE4GBeJB4v735Jsto,4990
4
+ basstler/recommender/locations.py,sha256=drjXfkv5O7wPrPVUBdf99BtFz6CCrwmrnArH1NeA2jQ,442
5
+ basstler/recommender/priority_policy.py,sha256=o3214hJM0tLJM6xsPCWH8KkuZca20WBzY08vXUjsRUU,12899
6
+ basstler/recommender/recommender_command.py,sha256=HQoAjf3yZzBe-Qasv6I8KMpMsJZErJJPoEbW4Ror_yE,2716
7
+ basstler_recommender-4.17.0.dist-info/METADATA,sha256=2QyjvvXHeLJ094Dmr6Ade_kHhQ9WSHC4xq9MvzCwJF4,672
8
+ basstler_recommender-4.17.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
9
+ basstler_recommender-4.17.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
10
+ basstler_recommender-4.17.0.dist-info/licenses/NOTICE,sha256=_YNWB1CHy4qhnPb1UxSSqanVpaZ_56nTW7g_bc-SK1g,920
11
+ basstler_recommender-4.17.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,17 @@
1
+ basstler
2
+ Copyright 2026 Abdelrhman Bassiouny and the basstler contributors
3
+
4
+ basstler (https://github.com/KAOS-repositories/basstler) is licensed under the
5
+ Apache License, Version 2.0 (see LICENSE). Abdelrhman Bassiouny wrote it
6
+ independently of any employer or institution and maintains it in the
7
+ KAOS-repositories organization on GitHub; contributors keep the copyright on
8
+ their contributions.
9
+
10
+ packages/core/src/basstler/{class_property,json_model}.py and
11
+ packages/rules/src/basstler/code_rules/{rule,rule_module,instructions}.py contain
12
+ code adapted from krrood (https://github.com/cram2/cognitive_robot_abstract_machine/tree/main/krrood),
13
+ copyright the krrood authors, which remains licensed under the GNU Lesser
14
+ General Public License, version 3 only (LGPL-3.0-only).
15
+
16
+ basstler-core depends on krrood-core (https://pypi.org/project/krrood-core/),
17
+ which is installed as a package of its own under the LGPL-3.0-only.