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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
- name: Setup dependencies with mise
run: mise install

- name: Install pytest
run: pip install pytest

- name: Run ruff linter
run: mise run lint

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.3
0.1.4
5 changes: 1 addition & 4 deletions lbranch/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
"""Version information for lbranch."""

from pathlib import Path

_version_file = Path(__file__).parent.parent / 'VERSION'
__version__ = _version_file.read_text().strip()
__version__ = '0.1.4'
4 changes: 2 additions & 2 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ format = "ruff format ."
# Ideal for CI pipelines to verify consistent formatting
format-check = "ruff format --check ."

# Test: Run the unittest suite
test = "python -m unittest test/test_lbranch.py"
# Test: Run the test suite with pytest
test = "python -m pytest"
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "lbranch"
version = "0.1.3"
version = "0.1.4"
description = "A Git utility that shows recently checked-out branches in chronological order and lets you quickly switch between them."
readme = "README.md"
requires-python = ">=3.7"
Expand Down Expand Up @@ -62,3 +62,8 @@ exclude = [
# Use single quotes for consistency
quote-style = "single"
line-ending = "auto"

[tool.pytest.ini_options]
# Suppress pytest-asyncio warning since we don't use async
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
39 changes: 39 additions & 0 deletions test/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""Test version consistency across files."""

from pathlib import Path

from lbranch.version import __version__


def test_version_consistency():
"""Verify version is consistent between VERSION file and version.py."""
# Read VERSION file
version_file = Path(__file__).parent.parent / 'VERSION'
file_version = version_file.read_text().strip()

# Compare with hardcoded version
assert __version__ == file_version, (
f"Version mismatch: version.py has '{__version__}' "
f"but VERSION file has '{file_version}'"
)


def test_pyproject_version_consistency():
"""Verify version is consistent between pyproject.toml and version.py."""
# Read pyproject.toml
pyproject_file = Path(__file__).parent.parent / 'pyproject.toml'
pyproject_content = pyproject_file.read_text()

# Extract version from pyproject.toml
import re

match = re.search(r'^version = "(.+)"', pyproject_content, re.MULTILINE)
assert match, 'Could not find version in pyproject.toml'

pyproject_version = match.group(1)

# Compare with hardcoded version
assert __version__ == pyproject_version, (
f"Version mismatch: version.py has '{__version__}' "
f"but pyproject.toml has '{pyproject_version}'"
)
17 changes: 14 additions & 3 deletions update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ if [ -f pyproject.toml ]; then
echo "✓ Updated pyproject.toml to $NEW_VERSION"
fi

echo "✓ Version updated to $NEW_VERSION in all files"
echo ""
echo "Python files now read version from VERSION file automatically."
# Update lbranch/version.py
if [ -f lbranch/version.py ]; then
# Use sed to update the version line
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS requires backup extension
sed -i '' "s/__version__ = '.*'/__version__ = '$NEW_VERSION'/" lbranch/version.py
else
# Linux
sed -i "s/__version__ = '.*'/__version__ = '$NEW_VERSION'/" lbranch/version.py
fi
echo "✓ Updated lbranch/version.py to $NEW_VERSION"
fi

echo "✓ Version updated to $NEW_VERSION in all files"