From f6fac3232d50ae04c713b1761f9870647108c174 Mon Sep 17 00:00:00 2001 From: Rhys Goodall Date: Wed, 6 Aug 2025 22:08:15 -0400 Subject: [PATCH] fea: add publish on release action can change to uv buld --- .github/workflows/publish.yml | 29 +++++++++++++++++++++++++++++ README.md | 3 ++- pyproject.toml | 19 +++++++------------ 3 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..d13bc4e5 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish to PyPI + +on: + release: + types: [published] + +jobs: + tests: + uses: ./.github/workflows/test.yml + + release: + runs-on: ubuntu-latest + needs: tests + if: needs.tests.result == 'success' + permissions: + id-token: write + + steps: + - name: Check out repo + uses: actions/checkout@v4 + + - name: Setup uv + uses: astral-sh/setup-uv@v6 + + - name: Build package with uv + run: uv build + + - name: Publish package distributions to PyPI with uv + run: uv publish -t ${{ secrets.PYPI_TOKEN }} diff --git a/README.md b/README.md index 0106cf72..7f66f74b 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ ![License: MIT](https://img.shields.io/badge/License-MIT-green.svg) [![GitHub Repo Size](https://img.shields.io/github/repo-size/comprhys/aviary?label=Repo+Size)](https://github.com/comprhys/aviary/graphs/contributors) +[![PyPI](https://img.shields.io/pypi/v/aviary-models?logo=pypi&logoColor=white)](https://pypi.org/project/aviary-models) [![GitHub last commit](https://img.shields.io/github/last-commit/comprhys/aviary?label=Last+Commit)](https://github.com/comprhys/aviary/commits) [![Tests](https://github.com/CompRhys/aviary/actions/workflows/test.yml/badge.svg)](https://github.com/CompRhys/aviary/actions/workflows/test.yml) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/CompRhys/aviary/main.svg)](https://results.pre-commit.ci/latest/github/CompRhys/aviary/main) @@ -18,7 +19,7 @@ The aim of `aviary` is to contain multiple models for materials discovery under Users can install `aviary` from source with ```sh -pip install -U git+https://github.com/CompRhys/aviary +pip install aviary-models ``` or for an editable source install from a local clone: diff --git a/pyproject.toml b/pyproject.toml index f2b8bd45..9dcf8a1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,5 @@ -[build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" - [project] -name = "aviary" +name = "aviary-models" version = "1.2.0" description = "A collection of machine learning models for materials discovery" authors = [{ name = "Rhys Goodall", email = "rhys.goodall@outlook.com" }] @@ -52,14 +48,13 @@ Repo = "https://github.com/CompRhys/aviary" test = ["matminer", "moyopy>=0.3.3", "pytest", "pytest-cov"] moyopy = ["moyopy>=0.3.3"] -[tool.hatch.build.targets.wheel] -packages = ["aviary"] +[build-system] +requires = ["uv_build>=0.7.5"] +build-backend = "uv_build" -[tool.hatch.build] -include = [ - "aviary/**/*.py", - "aviary/**/*.json", -] +[tool.uv.build-backend] +module-name = "aviary" +module-root = "" [tool.pytest.ini_options] testpaths = ["tests"]