Skip to content

Commit b281456

Browse files
authored
Merge pull request #121 from georgian-io/github-ci-pypi
[CI] Publish to PyPI upon Tag
2 parents 6ad1e26 + 5647551 commit b281456

File tree

4 files changed

+75
-4
lines changed

4 files changed

+75
-4
lines changed

.github/workflows/lint_and_format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Ruff
22
on: pull_request
33
jobs:
44
lint:
5-
name: Lint, Format, and Commit
5+
name: Lint & Format
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v4

.github/workflows/publish_pypi.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: PyPI CD
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
pypi:
7+
name: Build and Upload Release
8+
runs-on: ubuntu-latest
9+
environment:
10+
name: pypi
11+
url: https://pypi.org/p/llm-toolkit
12+
permissions:
13+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
14+
steps:
15+
# ----------------
16+
# Set Up
17+
# ----------------
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- name: Setup Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.11"
26+
- name: Install poetry
27+
uses: snok/install-poetry@v1
28+
with:
29+
version: 1.5.1
30+
virtualenvs-create: true
31+
virtualenvs-in-project: true
32+
installer-parallel: true
33+
# ----------------
34+
# Install Deps
35+
# ----------------
36+
- name: Install Dependencies
37+
run: |
38+
poetry install --no-interaction --no-root
39+
poetry self add "poetry-dynamic-versioning[plugin]"
40+
# ----------------
41+
# Build & Publish
42+
# ----------------
43+
- name: Build
44+
run: poetry build
45+
- name: Publish package distributions to PyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1

llmtune/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2024 Georgian Partners
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
__version__ = "0.0.0"

pyproject.toml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "llm-toolkit"
3-
version = "0.1.0"
3+
version = "0.0.0"
44
description = "LLM Finetuning resource hub + toolkit"
55
authors = ["Benjamin Ye <[email protected]>"]
66
license = "Apache 2.0"
@@ -10,6 +10,16 @@ packages = [{include = "llmtune"}]
1010
[tool.poetry.scripts]
1111
llmtune = "llmtune.cli.toolkit:cli"
1212

13+
[tool.poetry-dynamic-versioning]
14+
enable = true
15+
vcs = "git"
16+
style = "semver"
17+
18+
[tool.poetry-dynamic-versioning.substitution]
19+
folders = [
20+
{ path = "llmtune" }
21+
]
22+
1323
[tool.poetry.dependencies]
1424
python = ">=3.9, <=3.12"
1525
transformers = "~4.37.2"
@@ -49,8 +59,8 @@ shellingham = "^1.5.4"
4959
ruff = "~0.3.5"
5060

5161
[build-system]
52-
requires = ["poetry-core"]
53-
build-backend = "poetry.core.masonry.api"
62+
requires = ["poetry-core", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
63+
build-backend = "poetry_dynamic_versioning.backend"
5464

5565
[tool.ruff]
5666
lint.ignore = ["C901", "E501", "E741", "F402", "F823" ]

0 commit comments

Comments
 (0)