Skip to content

Commit afb3b0e

Browse files
authored
ci: publish to testpypi and auto-version based on GIT (#95)
* ci: publish to testpypi and auto-version based on GIT Signed-off-by: tarilabs <matteo.mortari@gmail.com> * chore: linting Signed-off-by: tarilabs <matteo.mortari@gmail.com> --------- Signed-off-by: tarilabs <matteo.mortari@gmail.com>
1 parent 510fe09 commit afb3b0e

File tree

5 files changed

+59
-5
lines changed

5 files changed

+59
-5
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
1921

2022
- name: Set up Python
2123
uses: actions/setup-python@v5
@@ -28,6 +30,8 @@ jobs:
2830
pip install build
2931
3032
- name: Build package
33+
env:
34+
SETUPTOOLS_SCM_OVERRIDES_FOR_EVAL_HUB_SDK: 'local_scheme = "no-local-version"'
3135
run: |
3236
python3 -m build
3337
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish to TestPyPI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
testpypi-publish:
9+
name: upload dev build to TestPyPI
10+
runs-on: ubuntu-latest
11+
environment:
12+
name: testpypi
13+
url: https://test.pypi.org/p/eval-hub-sdk
14+
permissions:
15+
id-token: write
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.12'
26+
27+
- name: Install dependencies
28+
run: |
29+
python3 -m pip install --upgrade pip
30+
pip install build
31+
32+
- name: Build package
33+
env:
34+
SETUPTOOLS_SCM_OVERRIDES_FOR_EVAL_HUB_SDK: 'local_scheme = "no-local-version"'
35+
run: |
36+
python3 -m build
37+
38+
- name: Publish package
39+
uses: pypa/gh-action-pypi-publish@release/v1
40+
with:
41+
repository-url: https://test.pypi.org/legacy/

pyproject.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
2-
requires = ["setuptools>=61.0", "wheel"]
2+
requires = ["setuptools>=61.0", "wheel", "setuptools_scm>=8"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "eval-hub-sdk"
7-
version = "0.1.4"
7+
dynamic = ["version"]
88
description = "Python SDK for EvalHub: common models, REST API client, and framework adapter SDK"
99
authors = [
1010
{name = "Rui Vieira", email = "rui@redhat.com"},
@@ -91,6 +91,11 @@ Documentation = "https://github.com/eval-hub/eval-hub-sdk"
9191
where = ["src"]
9292
include = ["evalhub*"]
9393

94+
[tool.setuptools_scm]
95+
version_scheme = "guess-next-dev"
96+
local_scheme = "node-and-date"
97+
tag_regex = "^v(?P<version>.*)$"
98+
9499
[tool.ruff]
95100
target-version = "py311" # needed for LMEval compatibility
96101
line-length = 88

src/evalhub/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
"""
2525

2626
# Always available - core models
27+
from importlib.metadata import PackageNotFoundError, version
28+
2729
from .models import (
2830
BenchmarkConfig,
2931
BenchmarkInfo,
@@ -46,7 +48,10 @@
4648
OCICoordinates,
4749
)
4850

49-
__version__ = "0.1.4"
51+
try:
52+
__version__ = version("eval-hub-sdk")
53+
except PackageNotFoundError:
54+
__version__ = "unknown"
5055

5156
# Base exports - always available
5257
__all__ = [

uv.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)