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
17 changes: 4 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
paths:
- 'codeflash/version.py'
- 'codeflash-benchmark/codeflash_benchmark/__init__.py'
- 'codeflash-benchmark/codeflash_benchmark/version.py'

jobs:
detect-changes:
Expand All @@ -28,7 +28,7 @@ jobs:
else
echo "codeflash=false" >> $GITHUB_OUTPUT
fi
if git diff --name-only HEAD~1 HEAD | grep -q '^codeflash-benchmark/codeflash_benchmark/__init__.py$'; then
if git diff --name-only HEAD~1 HEAD | grep -q '^codeflash-benchmark/codeflash_benchmark/version.py$'; then
echo "benchmark=true" >> $GITHUB_OUTPUT
else
echo "benchmark=false" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -121,23 +121,14 @@ jobs:
with:
fetch-depth: 0

- name: Extract version from __init__.py
- name: Extract version from version.py
id: extract_version
run: |
VERSION=$(grep -oP '__version__ = "\K[^"]+' codeflash-benchmark/codeflash_benchmark/__init__.py)
VERSION=$(grep -oP '__version__ = "\K[^"]+' codeflash-benchmark/codeflash_benchmark/version.py)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=benchmark-v$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"

- name: Verify version matches pyproject.toml
run: |
INIT_VERSION=${{ steps.extract_version.outputs.version }}
TOML_VERSION=$(grep -oP '^version = "\K[^"]+' codeflash-benchmark/pyproject.toml)
if [ "$INIT_VERSION" != "$TOML_VERSION" ]; then
echo "::error::Version mismatch: __init__.py=$INIT_VERSION, pyproject.toml=$TOML_VERSION"
exit 1
fi

- name: Check if tag already exists
id: check_tag
run: |
Expand Down
2 changes: 1 addition & 1 deletion codeflash-benchmark/codeflash_benchmark/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""CodeFlash Benchmark - Pytest benchmarking plugin for codeflash.ai."""

__version__ = "0.2.0"
from codeflash_benchmark.version import __version__ as __version__
2 changes: 2 additions & 0 deletions codeflash-benchmark/codeflash_benchmark/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# These version placeholders will be replaced by uv-dynamic-versioning during build.
__version__ = "0.3.0"
21 changes: 16 additions & 5 deletions codeflash-benchmark/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "codeflash-benchmark"
version = "0.3.0"
dynamic = ["version"]
description = "Pytest benchmarking plugin for codeflash.ai - automatic code performance optimization"
authors = [{ name = "CodeFlash Inc.", email = "contact@codeflash.ai" }]
requires-python = ">=3.9"
Expand All @@ -25,8 +25,19 @@ Repository = "https://github.com/codeflash-ai/codeflash-benchmark"
codeflash-benchmark = "codeflash_benchmark.plugin"

[build-system]
requires = ["setuptools>=45", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling", "uv-dynamic-versioning"]
build-backend = "hatchling.build"

[tool.setuptools]
packages = ["codeflash_benchmark"]
[tool.hatch.version]
source = "uv-dynamic-versioning"

[tool.uv-dynamic-versioning]
enable = true
style = "pep440"
vcs = "git"

[tool.hatch.build.hooks.version]
path = "codeflash_benchmark/version.py"
template = """# These version placeholders will be replaced by uv-dynamic-versioning during build.
__version__ = "{version}"
"""
Loading