Skip to content

Commit 460a8e9

Browse files
committed
Add publish on release action can change to uv buld (#106)
1 parent 6c72299 commit 460a8e9

File tree

5 files changed

+45
-16
lines changed

5 files changed

+45
-16
lines changed

.github/workflows/publish.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
tests:
9+
uses: ./.github/workflows/test.yml
10+
11+
release:
12+
runs-on: ubuntu-latest
13+
needs: tests
14+
if: needs.tests.result == 'success'
15+
permissions:
16+
id-token: write
17+
18+
steps:
19+
- name: Check out repo
20+
uses: actions/checkout@v4
21+
22+
- name: Setup uv
23+
uses: astral-sh/setup-uv@v6
24+
25+
- name: Build package with uv
26+
run: uv build
27+
28+
- name: Publish package distributions to PyPI with uv
29+
run: uv publish -t ${{ secrets.PYPI_TOKEN }}

.github/workflows/test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ name: Tests
22

33
on:
44
push:
5-
paths: ["**/*.py", .github/workflows/test.yml]
5+
paths: ["**/*.py", ".github/workflows/test.yml"]
66
branches: [main]
77
pull_request:
8-
paths: ["**/*.py", .github/workflows/test.yml]
8+
paths: ["**/*.py", ".github/workflows/test.yml"]
99
branches: [main]
10+
release:
11+
types: [published]
12+
workflow_dispatch:
13+
workflow_call:
1014

1115
concurrency:
1216
# Cancel only on same PR number

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)
66
[![GitHub Repo Size](https://img.shields.io/github/repo-size/comprhys/aviary?label=Repo+Size)](https://github.com/comprhys/aviary/graphs/contributors)
7+
[![PyPI](https://img.shields.io/pypi/v/aviary-models?logo=pypi&logoColor=white)](https://pypi.org/project/aviary-models)
78
[![GitHub last commit](https://img.shields.io/github/last-commit/comprhys/aviary?label=Last+Commit)](https://github.com/comprhys/aviary/commits)
89
[![Tests](https://github.com/CompRhys/aviary/actions/workflows/test.yml/badge.svg)](https://github.com/CompRhys/aviary/actions/workflows/test.yml)
910
[![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
1819
Users can install `aviary` from source with
1920

2021
```sh
21-
pip install -U git+https://github.com/CompRhys/aviary
22+
pip install aviary-models
2223
```
2324

2425
or for an editable source install from a local clone:

aviary/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import importlib.metadata
22
from os.path import abspath, dirname
33

4-
__version__ = importlib.metadata.version("aviary")
4+
__version__ = importlib.metadata.version("aviary-models")
55
PKG_DIR = dirname(abspath(__file__))
66
ROOT = dirname(PKG_DIR)

pyproject.toml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
[build-system]
2-
requires = ["hatchling"]
3-
build-backend = "hatchling.build"
4-
51
[project]
6-
name = "aviary"
2+
name = "aviary-models"
73
version = "1.2.0"
84
description = "A collection of machine learning models for materials discovery"
95
authors = [{ name = "Rhys Goodall", email = "[email protected]" }]
@@ -52,14 +48,13 @@ Repo = "https://github.com/CompRhys/aviary"
5248
test = ["matminer", "moyopy>=0.3.3", "pytest", "pytest-cov"]
5349
moyopy = ["moyopy>=0.3.3"]
5450

55-
[tool.hatch.build.targets.wheel]
56-
packages = ["aviary"]
51+
[build-system]
52+
requires = ["uv_build>=0.7.5"]
53+
build-backend = "uv_build"
5754

58-
[tool.hatch.build]
59-
include = [
60-
"aviary/**/*.py",
61-
"aviary/**/*.json",
62-
]
55+
[tool.uv.build-backend]
56+
module-name = "aviary"
57+
module-root = ""
6358

6459
[tool.pytest.ini_options]
6560
testpaths = ["tests"]

0 commit comments

Comments
 (0)