File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 - main
77 paths :
88 - ' codeflash/version.py'
9- - ' codeflash-benchmark/codeflash_benchmark/__init__ .py'
9+ - ' codeflash-benchmark/codeflash_benchmark/version .py'
1010
1111jobs :
1212 detect-changes :
2828 else
2929 echo "codeflash=false" >> $GITHUB_OUTPUT
3030 fi
31- if git diff --name-only HEAD~1 HEAD | grep -q '^codeflash-benchmark/codeflash_benchmark/__init__ .py$'; then
31+ if git diff --name-only HEAD~1 HEAD | grep -q '^codeflash-benchmark/codeflash_benchmark/version .py$'; then
3232 echo "benchmark=true" >> $GITHUB_OUTPUT
3333 else
3434 echo "benchmark=false" >> $GITHUB_OUTPUT
@@ -121,23 +121,14 @@ jobs:
121121 with :
122122 fetch-depth : 0
123123
124- - name : Extract version from __init__ .py
124+ - name : Extract version from version .py
125125 id : extract_version
126126 run : |
127- VERSION=$(grep -oP '__version__ = "\K[^"]+' codeflash-benchmark/codeflash_benchmark/__init__ .py)
127+ VERSION=$(grep -oP '__version__ = "\K[^"]+' codeflash-benchmark/codeflash_benchmark/version .py)
128128 echo "version=$VERSION" >> $GITHUB_OUTPUT
129129 echo "tag=benchmark-v$VERSION" >> $GITHUB_OUTPUT
130130 echo "Extracted version: $VERSION"
131131
132- - name : Verify version matches pyproject.toml
133- run : |
134- INIT_VERSION=${{ steps.extract_version.outputs.version }}
135- TOML_VERSION=$(grep -oP '^version = "\K[^"]+' codeflash-benchmark/pyproject.toml)
136- if [ "$INIT_VERSION" != "$TOML_VERSION" ]; then
137- echo "::error::Version mismatch: __init__.py=$INIT_VERSION, pyproject.toml=$TOML_VERSION"
138- exit 1
139- fi
140-
141132 - name : Check if tag already exists
142133 id : check_tag
143134 run : |
Original file line number Diff line number Diff line change 11"""CodeFlash Benchmark - Pytest benchmarking plugin for codeflash.ai."""
22
3- __version__ = "0.2.0"
3+ from codeflash_benchmark . version import __version__ as __version__
Original file line number Diff line number Diff line change 1+ # These version placeholders will be replaced by uv-dynamic-versioning during build.
2+ __version__ = "0.3.0"
Original file line number Diff line number Diff line change 11[project ]
22name = " codeflash-benchmark"
3- version = " 0.3.0 "
3+ dynamic = [ " version " ]
44description = " Pytest benchmarking plugin for codeflash.ai - automatic code performance optimization"
55authors = [{ name = " CodeFlash Inc." , email = " contact@codeflash.ai" }]
66requires-python = " >=3.9"
@@ -25,8 +25,19 @@ Repository = "https://github.com/codeflash-ai/codeflash-benchmark"
2525codeflash-benchmark = " codeflash_benchmark.plugin"
2626
2727[build-system ]
28- requires = [" setuptools>=45 " , " wheel " ]
29- build-backend = " setuptools.build_meta "
28+ requires = [" hatchling " , " uv-dynamic-versioning " ]
29+ build-backend = " hatchling.build "
3030
31- [tool .setuptools ]
32- packages = [" codeflash_benchmark" ]
31+ [tool .hatch .version ]
32+ source = " uv-dynamic-versioning"
33+
34+ [tool .uv-dynamic-versioning ]
35+ enable = true
36+ style = " pep440"
37+ vcs = " git"
38+
39+ [tool .hatch .build .hooks .version ]
40+ path = " codeflash_benchmark/version.py"
41+ template = """ # These version placeholders will be replaced by uv-dynamic-versioning during build.
42+ __version__ = "{version}"
43+ """
You can’t perform that action at this time.
0 commit comments