Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions scripts/prepare_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
VERSION_HEADING_PATTERN = re.compile(r"(?m)^## (\d+\.\d+\.\d+)(?: \([^)]+\))?$")
RELEASE_NOTES_HEADER = "# Release Notes\n\n"
LATEST_CHANGES_HEADER = "## Latest Changes"
AGENT_SKILLS_NOTE = """> SQLModel includes an official skill that helps coding agents use new features and recommended patterns for your installed version. Install it with `uvx library-skills` in your project. See [Develop with AI](https://sqlmodel.tiangolo.com/ai-development/).
"""
BumpType = Literal["major", "minor", "patch"]

app = typer.Typer()
Expand Down Expand Up @@ -197,12 +199,10 @@ def release_notes(
],
) -> None:
version = get_current_version(version_file.read_text(), version_file)
typer.echo(
get_release_notes_body(
release_notes_file.read_text(), version, release_notes_file
),
nl=False,
body = get_release_notes_body(
release_notes_file.read_text(), version, release_notes_file
)
typer.echo(f"{AGENT_SKILLS_NOTE}\n{body}", nl=False)


if __name__ == "__main__":
Expand Down
29 changes: 23 additions & 6 deletions tests/test_prepare_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,23 +265,33 @@ def test_cli_prints_current_version(tmp_path: Path) -> None:
assert result.output == "0.0.39\n"


def test_cli_prints_release_notes(tmp_path: Path) -> None:
def test_cli_prints_release_notes_with_agent_skills_note(tmp_path: Path) -> None:
version_file = tmp_path / "sqlmodel" / "__init__.py"
version_file.parent.mkdir()
version_file.write_text('__version__ = "0.0.39"\n')
version_content = '__version__ = "0.0.39"\n'
version_file.write_text(version_content)
release_notes_file = tmp_path / "release-notes.md"
release_notes_file.write_text(
"""# Release Notes
notes_content = """# Release Notes

## Latest Changes

### Fixes

* Unreleased fix.

## 0.0.39 (2026-05-30)

### Fixes

* Fix something.

## 0.0.38 (2026-05-23)

### Fixes

* Previous fix.
"""
)
release_notes_file.write_text(notes_content)

result = runner.invoke(
app,
Expand All @@ -295,4 +305,11 @@ def test_cli_prints_release_notes(tmp_path: Path) -> None:
)

assert result.exit_code == 0, result.output
assert result.output == "### Fixes\n\n* Fix something.\n"
note, separator, body = result.output.partition("\n\n")
assert note.startswith("> SQLModel includes an official skill")
assert note.count("`uvx library-skills`") == 1
assert "[Develop with AI](https://sqlmodel.tiangolo.com/ai-development/)" in note
assert separator
assert body == "### Fixes\n\n* Fix something.\n"
assert release_notes_file.read_text() == notes_content
assert version_file.read_text() == version_content
Loading