Skip to content

Commit 8485423

Browse files
committed
AP-605: build pypi packages
* builds pypi packages with versioning managed by setuptools_scm
1 parent 14a272b commit 8485423

2 files changed

Lines changed: 64 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build and publish dev release to PyPI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
# types:
8+
# - closed
9+
10+
jobs:
11+
build:
12+
# if: github.event.pull_request.merged == true
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v7
21+
with:
22+
version: "0.10.7"
23+
python-version: "3.14"
24+
enable-cache: true
25+
- name: Sync dependencies
26+
run: uv sync --all-extras --dev
27+
- name: Build Python package
28+
run: |
29+
uv build
30+
31+
- name: Upload package distributions as artifact
32+
uses: actions/upload-artifact@v7
33+
with:
34+
name: python-package-distributions
35+
path: |
36+
dist/
37+
!dist/.gitignore
38+
39+
testpypi-publish:
40+
needs: build
41+
runs-on: ubuntu-latest
42+
environment:
43+
name: testpypi
44+
url: https://test.pypi.org/p/python-tind-client
45+
permissions:
46+
id-token: write
47+
steps:
48+
- uses: actions/checkout@v6
49+
50+
- name: Download built package distributions
51+
uses: actions/download-artifact@v8
52+
with:
53+
name: python-package-distributions
54+
path: dist/
55+
56+
- name: Public package distributions to PyPI
57+
uses: pypa/gh-action-pypi-publish@release/v1
58+
with:
59+
repository-url: https://test.pypi.org/legacy/

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[build-system]
2-
requires = ["setuptools>=80"]
2+
requires = ["setuptools>=80", "setuptools-scm[simple]>=9.2"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "python-tind-client"
7-
version = "0.2.1"
7+
dynamic = ["version"]
88
description = "Python library for interacting with the TIND DA API"
99
readme = "README.md"
10-
license = { file = "LICENSE" }
10+
license-files = ["LICENSE"]
1111
authors = [
1212
{ name = "Jason Raitz", email = "raitz@berkeley.edu" },
1313
{ name = "maría a. matienzo", email = "matienzo@berkeley.edu" },
@@ -63,3 +63,5 @@ style = "sphinx"
6363

6464
[tool.pylint.format]
6565
max-line-length = 100
66+
67+
[tool.setuptools_scm]

0 commit comments

Comments
 (0)