Coverage for packages/workshop/src/livery/workshop/_release_notes.py: 100%
Measured by coverage.py 7.16.2 on CPython 3.14 while the suites of tests, packages/workshop/tests/test_workshop_without_docs.py, packages/workshop/tests/test_workshop_vocabulary.py, packages/workshop/tests/test_workshop_sync.py, packages/workshop/tests/test_workshop_shells.py, packages/workshop/tests/test_workshop_release_point.py, packages/workshop/tests/test_workshop_release_fresh.py, packages/workshop/tests/test_workshop_release_driver.py, packages/workshop/tests/test_workshop_release.py, packages/workshop/tests/test_workshop_queries.py, packages/workshop/tests/test_workshop_publish.py, packages/workshop/tests/test_workshop_prose.py, packages/workshop/tests/test_workshop_points.py, packages/workshop/tests/test_workshop_new_project.py, packages/workshop/tests/test_workshop_layering.py, packages/workshop/tests/test_workshop_isolated.py, packages/workshop/tests/test_workshop_groups.py, packages/workshop/tests/test_workshop_governance.py, packages/workshop/tests/test_workshop_fragments.py, packages/workshop/tests/test_workshop_fallbacks.py, packages/workshop/tests/test_workshop_e2e.py, packages/workshop/tests/test_workshop_dispatch.py, packages/workshop/tests/test_workshop_dev_release.py, packages/workshop/tests/test_workshop_conformance.py, packages/workshop/tests/test_kind_tools.py, packages/extensions/python/tests/test_release_driver.py, packages/extensions/nanobind/tests/test_kind_publish.py, packages/extensions/nanobind/tests/test_extensions_nanobind.py, packages/extensions/docs/tests/test_task_links.py, packages/extensions/docs/tests/test_llms.py, packages/extensions/docs/tests/test_docs_verbs.py, packages/extensions/docs/tests/test_docs_site.py, packages/extensions/docs/tests/test_docs.py, packages/extensions/conan/tests/test_cross_kind.py, packages/extensions/changelog/tests/test_changelog.py ran.
Keys
- r m x p show or hide the lines of a kind
- j k the next or previous highlighted chunk
- 0 the top of the page
- 1 the first highlighted chunk
- [ ] the previous or next file
- u the index
- ? show or hide this help
1"""Release notes: the one-answer query the release train writes notes through.
3A release stamps a version, and a package's history says what the
4version holds. The train never writes that history itself: it asks
5the provider the listed extensions answer the ``release-notes`` query
6with for the entry the unreleased commits earn, has the provider
7record it, and has it judge the recorded notes before a tag is cut. A
8workspace whose extensions answer nothing releases without notes, and
9the train says so where it would have written them.
11One answer at a time: the query combines by ``nearest``, so two
12listed extensions answering, neither requiring the other, refuse
16from __future__ import annotations
18from typing import TYPE_CHECKING, Protocol
20from livery.workshop._queries import Query, answer
22if TYPE_CHECKING:
23 from pathlib import Path
25 from livery.workshop._packages import Package
28class ReleaseNotes(Protocol):
29 """What a release-notes provider answers."""
31 def entry(self, root: Path, package: Package, version: str = "") -> str:
32 """The notes the commits since *package*'s last release earn.
34 Headed by *version* when one is given, as unreleased otherwise;
35 empty when nothing unreleased touches the package.
39 def record(self, package: Package, version: str, entry: str) -> list[str]:
40 """Write *version*'s *entry* into *package*'s history.
42 An empty *entry* records a placeholder for a person to write.
43 Returns the files changed, each with a note for the reader,
44 empty when the history already holds the version's entry.
48 def verify(self, package: Package, version: str) -> list[str]:
49 """The problems with *version*'s recorded notes; empty when sound."""
53#: The release notes' provider, a workspace-level query the base
54#: declares; the extension that writes the history answers it with a
55#: function called with the workspace root.
56RELEASE_NOTES: Query[ReleaseNotes | None] = Query("release-notes")
59def release_notes(root: Path) -> ReleaseNotes | None:
60 """The provider the extensions listed at *root* answer; None when none answers.
62 The answer is imported when first asked, so a mount imports none
63 of the answering extension's code.
66 QueryError: when two listed extensions answer and neither
67 requires the other, naming both.
69 return answer(root, RELEASE_NOTES)
72#: What the train prints where it would have written notes and has no provider.
73NO_PROVIDER = "no release notes: no listed extension writes them, so none are written"