diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b900047 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: Build dev package distributions + +on: + pull_request: + branches: + - main + types: + - closed + +jobs: + build: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + + # we need to fetch the full repo history to use setuptools_scm + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + version: "0.10.7" + python-version: "3.14" + enable-cache: true + + - name: Sync dependencies + run: uv sync --all-extras --dev + + - name: Build Python package + run: uv build + + - name: Upload package distributions as artifact + uses: actions/upload-artifact@v7 + with: + name: python-package-distributions + path: | + dist/ + !dist/.gitignore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..aaf4894 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: Push Release Tags + +on: + push: + tags: + - '**' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + # we need to fetch the full repo history to use setuptools_scm + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + version: "0.10.7" + python-version: "3.14" + enable-cache: true + + - name: Sync dependencies + run: uv sync --all-extras --dev + + - name: Build Python package + run: uv build + + - name: Upload package distributions as artifact + uses: actions/upload-artifact@v7 + with: + name: python-package-distributions + path: | + dist/ + !dist/.gitignore + + + pypi-publish: + needs: build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/python-tind-client + permissions: + id-token: write + steps: + - uses: actions/checkout@v6 + + - name: Download built package distributions + uses: actions/download-artifact@v8 + with: + name: python-package-distributions + path: dist/ + + - name: Public package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore index 6606ba4..f6ced42 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ dist/ build/ *.egg-info/ *.egg +tind_client/_version.py # Virtual environments .venv/ diff --git a/CHANGELOG.md b/CHANGELOG.md index de77531..847470b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.2] + +### Changed +- build package and publish to pypi, using setuptools_scm for version management + ## [0.2.1] ### Changed diff --git a/pyproject.toml b/pyproject.toml index 4d92ccf..8a8a26d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,13 @@ [build-system] -requires = ["setuptools>=80"] +requires = ["setuptools>=80", "setuptools-scm[simple]>=10.0.5"] build-backend = "setuptools.build_meta" [project] name = "python-tind-client" -version = "0.2.1" +dynamic = ["version"] description = "Python library for interacting with the TIND DA API" readme = "README.md" -license = { file = "LICENSE" } +license-files = ["LICENSE"] authors = [ { name = "Jason Raitz", email = "raitz@berkeley.edu" }, { name = "marĂ­a a. matienzo", email = "matienzo@berkeley.edu" }, @@ -61,5 +61,13 @@ allow-init-docstring = true skip-checking-raises = true style = "sphinx" +[tool.pylint.master] +ignore = ["_version.py"] + [tool.pylint.format] max-line-length = 100 + +# the following is unnecessary, but having anything in this config section +# suppresses a spurious build warning from setuptools_scm. +[tool.setuptools_scm] +version_file = "tind_client/_version.py"