From ff9a6a256daa914ad9406781ccacc6abce83d67e Mon Sep 17 00:00:00 2001 From: bernatsampera Date: Sat, 8 Aug 2026 17:51:17 +0200 Subject: [PATCH] Add release script and bump version to 0.4.3 Belated commit: 0.4.3 was published to PyPI on 2026-08-04 with this state (scripts/release.py automates the version bump and build). Co-Authored-By: Claude Fable 5 --- pyproject.toml | 2 +- scripts/release.py | 67 ++++++++++++++++++++++++++++++++++++++++++++++ uv.lock | 2 +- 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 scripts/release.py diff --git a/pyproject.toml b/pyproject.toml index 487e212..757de45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcontext-ai" -version = "0.4.2" +version = "0.4.3" description = "The framework for building stateful agents. Your agent is a folder of state, served over MCP, used from any runtime." readme = "README.md" license = { text = "MIT" } diff --git a/scripts/release.py b/scripts/release.py new file mode 100644 index 0000000..c6bfdc8 --- /dev/null +++ b/scripts/release.py @@ -0,0 +1,67 @@ +"""Bump version, clean old artifacts, build web + package. + +Run from the gcontext/ directory: + uv run python scripts/release.py + +Produces wheel + sdist in dist/. Does NOT publish; the agent handles +that through the pypi connection. +""" + +import re +import shutil +import subprocess +import sys +from pathlib import Path + +REPO = Path(__file__).resolve().parent.parent # gcontext/ +PYPROJECT = REPO / "pyproject.toml" +DIST = REPO / "dist" + + +def bump_version(new: str) -> str: + text = PYPROJECT.read_text() + match = re.search(r'^version\s*=\s*"([^"]+)"', text, re.MULTILINE) + if not match: + sys.exit("could not find version in pyproject.toml") + old = match.group(1) + if old == new: + sys.exit(f"version is already {new}") + updated = text.replace(f'version = "{old}"', f'version = "{new}"') + PYPROJECT.write_text(updated) + print(f"version: {old} -> {new}") + return old + + +def clean_dist(): + if DIST.exists(): + shutil.rmtree(DIST) + print("cleaned dist/") + + +def build(): + print("building web + package...") + result = subprocess.run(["make", "build"], cwd=REPO, capture_output=True, text=True) + if result.returncode != 0: + print(result.stdout) + print(result.stderr, file=sys.stderr) + sys.exit(f"build failed (exit {result.returncode})") + artifacts = sorted(DIST.glob("gcontext_ai-*")) + for a in artifacts: + print(f" {a.name}") + if len(artifacts) != 2: + sys.exit(f"expected 2 artifacts, got {len(artifacts)}") + print("build ok") + + +def main(): + if len(sys.argv) != 2: + sys.exit("usage: uv run python scripts/release.py ") + new_version = sys.argv[1] + bump_version(new_version) + clean_dist() + build() + print(f"\nready to publish {new_version}") + + +if __name__ == "__main__": + main() diff --git a/uv.lock b/uv.lock index 0a893b8..c9a892e 100644 --- a/uv.lock +++ b/uv.lock @@ -423,7 +423,7 @@ server = [ [[package]] name = "gcontext-ai" -version = "0.4.2" +version = "0.4.3" source = { editable = "." } dependencies = [ { name = "fastmcp" },