Skip to content

Commit b2a48a3

Browse files
authored
Add GitHub Actions workflow for PyPI publishing (#21)
1 parent a896b07 commit b2a48a3

4 files changed

Lines changed: 104 additions & 5 deletions

File tree

.github/workflows/pypi.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Publish PyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
package: [skala, microsoft-skala]
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
persist-credentials: false
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.11"
23+
24+
- name: Install pypa/build
25+
run: >-
26+
python3 -m
27+
pip install
28+
build
29+
--user
30+
31+
- name: Replace pyproject.toml
32+
if: ${{ matrix.package == 'microsoft-skala' }}
33+
run: |
34+
VERSION=$(python3 -c "from tomllib import load; print(load(open('pyproject.toml', 'rb'))['project']['version'])")
35+
rm -r src/skala
36+
mkdir -p src/microsoft_skala
37+
echo "from skala import *" > src/microsoft_skala/__init__.py
38+
touch src/microsoft_skala/py.typed
39+
sed -e "s/@VERSION@/$VERSION/g" .github/workflows/pypi/microsoft-skala.toml > pyproject.toml
40+
cat pyproject.toml
41+
42+
- name: Build a binary wheel and a source tarball
43+
run: python3 -m build
44+
45+
- name: Store the distribution packages
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: ${{ matrix.package }}-pkg
49+
path: dist/
50+
51+
publish-to-pypi:
52+
name: Publish to PyPI
53+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
54+
needs:
55+
- build
56+
runs-on: ubuntu-latest
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
package: [skala, microsoft-skala]
61+
environment:
62+
name: pypi
63+
url: https://pypi.org/p/${{ matrix.package }}
64+
permissions:
65+
id-token: write # IMPORTANT: mandatory for trusted publishing
66+
67+
steps:
68+
- name: Download all the dists
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: ${{ matrix.package }}-pkg
72+
path: dist/
73+
- name: Publish distribution to PyPI
74+
uses: pypa/gh-action-pypi-publish@release/v1
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "microsoft-skala"
7+
version = "@VERSION@"
8+
description = "Skala Exchange Correlation Functional"
9+
authors = []
10+
license-files = ["LICENSE.txt"]
11+
readme = "README.md"
12+
keywords = []
13+
classifiers = [
14+
"Programming Language :: Python :: 3",
15+
"Development Status :: 5 - Production/Stable",
16+
]
17+
requires-python = ">=3.10"
18+
dependencies = [
19+
"skala==@VERSION@",
20+
]
21+
urls.repository = "https://github.com/microsoft/skala"
22+
urls.documentation = "https://microsoft.github.io/skala"
23+
urls.homepage = "https://aka.ms/dft"

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Documentation](https://img.shields.io/badge/docs-microsoft.github.io%2Fskala-blue?logo=read-the-docs&logoColor=white)](https://microsoft.github.io/skala)
44
[![Tests](https://img.shields.io/github/actions/workflow/status/microsoft/skala/test.yml?branch=main&logo=github&label=build)](https://github.com/microsoft/skala/actions/workflows/test.yml)
5-
[![PyPI](https://img.shields.io/pypi/v/microsoft-skala?logo=pypi&logoColor=white)](https://pypi.org/project/microsoft-skala/)
5+
[![PyPI](https://img.shields.io/pypi/v/skala?logo=pypi&logoColor=white)](https://pypi.org/project/skala/)
66
[![Paper](https://img.shields.io/badge/arXiv-2506.14665-b31b1b?logo=arxiv&logoColor=white)](https://arxiv.org/abs/2506.14665)
77

88
Skala is a neural network-based exchange-correlation functional for density functional theory (DFT), developed by Microsoft Research AI for Science. It leverages deep learning to predict exchange-correlation energies from electron density features, achieving chemical accuracy for atomization energies and strong performance on broad thermochemistry and kinetics benchmarks, all at a computational cost similar to semi-local DFT.
@@ -15,7 +15,7 @@ Learn more about Skala in our [ArXiv paper](https://arxiv.org/abs/2506.14665).
1515

1616
This repository contains three main components:
1717

18-
1. The Python package `microsoft-skala`, which is also distributed [on PyPI](https://pypi.org/project/microsoft-skala/) and contains a Pytorch implementation of the Skala model, its hookups to quantum chemistry packages [PySCF](https://pyscf.org/) and [ASE](https://ase-lib.org/), and an independent client library for the Skala model served [in Azure AI Foundry](https://ai.azure.com/catalog/models/Skala).
18+
1. The Python package `skala`, which is also distributed [on PyPI](https://pypi.org/project/skala/) and contains a Pytorch implementation of the Skala model, its hookups to quantum chemistry packages [PySCF](https://pyscf.org/) and [ASE](https://ase-lib.org/), and an independent client library for the Skala model served [in Azure AI Foundry](https://ai.azure.com/catalog/models/Skala).
1919
2. A development version of the CPU/GPU C++ library for XC functionals [GauXC](https://github.com/wavefunction91/GauXC/tree/skala) with an add-on supporting Pytorch-based functionals like Skala. GauXC is part of the stack that serves Skala in Azure AI Foundry and can be used to integrate Skala into other third-party DFT codes.
2020
3. An example of using Skala in C++ CPU applications through LibTorch, see [`examples/cpp/cpp_integration`](examples/cpp/cpp_integration).
2121

@@ -27,7 +27,7 @@ Install using Pip:
2727

2828
```bash
2929
pip install torch --index-url https://download.pytorch.org/whl/cpu # unless you already have GPU Pytorch for something else
30-
pip install microsoft-skala
30+
pip install skala
3131
```
3232

3333
Run an SCF calculation with Skala for a hydrogen molecule:
@@ -52,7 +52,7 @@ Install using Pip:
5252
cu_version=128 #or 126 or 130 depending on your CUDA version
5353
pip install torch cupy --extra-index-url "https://download.pytorch.org/whl/cu${cu_version}"
5454
pip install --no-deps "gpu4pyscf-cuda${cu_version:0:2}x>=1.0,<2" "gpu4pyscf-libxc-cuda${cu_version:0:2}x>=0.4,<1"
55-
pip install microsoft-skala
55+
pip install skala
5656
```
5757
Run an SCF calculation with Skala for a hydrogen molecule on GPU:
5858

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["setuptools"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
6-
name = "microsoft-skala"
6+
name = "skala"
77
version = "1.1.1"
88
description = "Skala Exchange Correlation Functional"
99
authors = []
@@ -41,6 +41,8 @@ optional-dependencies.doc = [
4141
]
4242

4343
urls.repository = "https://github.com/microsoft/skala"
44+
urls.documentation = "https://microsoft.github.io/skala"
45+
urls.homepage = "https://aka.ms/dft"
4446

4547
[tool.ruff]
4648
target-version = "py311"

0 commit comments

Comments
 (0)