diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a59b63be..a52b439c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ See the corresponding [memory](.serena/memories/adding_new_language_support_guid You can install a virtual environment with the required as follows -1. Create a new virtual environment: `uv venv` +1. Create a new virtual environment: `uv venv -p 3.13` 2. Activate the environment: * On Linux/Unix/macOS or Windows with Git Bash: `source .venv/bin/activate` * On Windows outside of Git Bash: `.venv\Scripts\activate.bat` (in cmd/ps) or `source .venv/Scripts/activate` (in git-bash) diff --git a/README-dev.md b/README-dev.md new file mode 100644 index 00000000..958e4893 --- /dev/null +++ b/README-dev.md @@ -0,0 +1,19 @@ +# Developer Instructions + +## Python Environment & Development Tools + +See [the contributing guide](CONTRIBUTING.md) for instructions on setting up your development environment +and tools for formatting and type checking. + +## Release Process + +1. Ensure clean git status +2. Set version for release, e.g. + + python scripts/bump_version.py --patch + python scripts/bump_version.py --minor + + This also creates the git tag. +3. Push to GitHub, triggering the release process. + + git push --tags \ No newline at end of file diff --git a/scripts/bump_version.py b/scripts/bump_version.py index ec4de118..9a54e70b 100644 --- a/scripts/bump_version.py +++ b/scripts/bump_version.py @@ -1,6 +1,7 @@ from __future__ import annotations import logging +import os import re from pathlib import Path from typing import Literal @@ -8,6 +9,7 @@ from typing import Literal import click from serena.constants import REPO_ROOT +from serena.util.git import get_git_status log = logging.getLogger(__name__) @@ -27,6 +29,10 @@ _UNRELEASED_HEADER = "# Unreleased (main)\n" @click.option("--version", "-v", "target_version", metavar="X.Y.Z", help="Set an explicit version instead of bumping.") @click.option("--dry-run", is_flag=True, help="Show what would change without writing any files.") def bump_version(major: bool, minor: bool, patch: bool, target_version: str | None, dry_run: bool) -> None: + git_status = get_git_status() + if not git_status.is_clean: + raise click.ClickException("Working directory is not clean. Please commit or stash your changes first.") + log.info("bump_version called: major=%s, minor=%s, patch=%s, target_version=%s", major, minor, patch, target_version) version_part = resolve_version_selection(major=major, minor=minor, patch=patch, target_version=target_version) log.info("Resolved version_part=%s", version_part) @@ -39,6 +45,9 @@ def bump_version(major: bool, minor: bool, patch: bool, target_version: str | No click.echo(f"Dry run complete. Version would be bumped to {new_version}") else: click.echo(f"Bumped version to {new_version}") + os.system("git add -u") + os.system(f'git commit -m "Release v{new_version}"') + os.system(f"git tag v{new_version}") def find_repo_root() -> Path: