Implementation:MaterializeInc Materialize Mark Release Complete Main
| Knowledge Sources | misc/python/materialize/release/mark_release_complete.py (lines 21-45), misc/python/materialize/release/util.py, misc/python/materialize/git.py |
|---|---|
| Domains | Release Engineering, Documentation Metadata, Python, Git |
| Last Updated | 2026-02-08 |
Overview
Concrete release finalization tool provided by the mark_release_complete module, which updates documentation frontmatter and pushes the change to main.
Description
The main() function in mark_release_complete.py marks a minor release series as complete by modifying the YAML frontmatter of the release's documentation file. The function performs the following steps:
- Parse arguments: Accepts
release_version(the version string, e.g.,0.79) andpatch(the patch number, e.g.,0) as positional arguments. - Resolve the git remote: Calls
git.get_remote()to determine the correct remote name for the Materialize repository. - Load the documentation file: Uses
doc_file_path(release_version)frommaterialize.release.utilto resolve the pathdoc/user/content/releases/{version}.md, then loads it withfrontmatter.load(). - Update frontmatter metadata:
- Sets
released = True. - Sets
patch = int(args.patch). - Removes the
rckey if present.
- Sets
- Write the file back: Uses
frontmatter.dump()withsort_keys=Falseto preserve key ordering, and appends a trailing newline. - Stage, commit, and push: Calls
git.add_file(),git.commit_all_changed()with message"release: mark {version} as released", and pushes to the remote's main branch.
Usage
Use this implementation reference when marking a Materialize release as complete after all testing and validation steps have passed. This is typically the final step in the release lifecycle.
Code Reference
Source Location
misc/python/materialize/release/mark_release_complete.py, lines 21-45.
Supporting utility: misc/python/materialize/release/util.py, doc_file_path().
Signature
def main():
parser = argparse.ArgumentParser()
parser.add_argument("release_version")
parser.add_argument("patch")
args = parser.parse_args()
remote = git.get_remote()
print(f"Marking {args.release_version} as released in the docs...")
release_version_doc_file = doc_file_path(args.release_version)
metadata = frontmatter.load(release_version_doc_file)
metadata["released"] = True
metadata["patch"] = int(args.patch)
if "rc" in metadata:
del metadata["rc"]
with open(release_version_doc_file, "wb") as f:
frontmatter.dump(metadata, f, sort_keys=False)
f.write(b"\n")
git.add_file(str(release_version_doc_file))
git.commit_all_changed(f"release: mark {args.release_version} as released")
print(f"Pushing to {remote}...")
spawn.runv(["git", "push", remote, "main"])
Import
from materialize.release.mark_release_complete import main
Supporting imports used internally:
import frontmatter
from materialize import git, spawn
from materialize.release.util import doc_file_path
I/O Contract
Inputs
| Parameter | Type | Required | Description |
|---|---|---|---|
release_version |
str (positional) |
Yes | The release version identifier (e.g., 0.79)
|
patch |
str (positional, converted to int) |
Yes | The patch number for this release (e.g., 0)
|
Outputs
| Output | Type | Description |
|---|---|---|
| Modified documentation file | File | doc/user/content/releases/{version}.md with updated frontmatter (released: true, patch: N, rc removed)
|
| Git commit | Side effect | A commit with message "release: mark {version} as released"
|
| Git push | Side effect | The commit is pushed to the main branch on the resolved remote
|
Usage Examples
Marking a release as complete from the command line:
python -m materialize.release.mark_release_complete 0.79 0
Expected output:
Marking 0.79 as released in the docs...
Pushing to origin...
Programmatic invocation:
import sys
sys.argv = ["mark_release_complete", "0.79", "0"]
from materialize.release.mark_release_complete import main
main()
Frontmatter before marking complete:
---
title: "v0.79"
date: 2024-01-15
rc: 2
released: false
---
Release notes for v0.79...
Frontmatter after marking complete:
---
title: "v0.79"
date: 2024-01-15
released: true
patch: 0
---
Release notes for v0.79...
The doc_file_path utility resolves the documentation file:
from materialize.release.util import doc_file_path
path = doc_file_path("0.79")
# Returns: MZ_ROOT / "doc" / "user" / "content" / "releases" / "0.79.md"