diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..6c7d6a3 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,74 @@ +name: Publish PyPI + +on: push + +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + package: [skala, microsoft-skala] + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + + - name: Replace pyproject.toml + if: ${{ matrix.package == 'microsoft-skala' }} + run: | + VERSION=$(python3 -c "from tomllib import load; print(load(open('pyproject.toml', 'rb'))['project']['version'])") + rm -r src/skala + mkdir -p src/microsoft_skala + echo "from skala import *" > src/microsoft_skala/__init__.py + touch src/microsoft_skala/py.typed + sed -e "s/@VERSION@/$VERSION/g" .github/workflows/pypi/microsoft-skala.toml > pyproject.toml + cat pyproject.toml + + - name: Build a binary wheel and a source tarball + run: python3 -m build + + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.package }}-pkg + path: dist/ + + publish-to-pypi: + name: Publish to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + package: [skala, microsoft-skala] + environment: + name: pypi + url: https://pypi.org/p/${{ matrix.package }} + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: ${{ matrix.package }}-pkg + path: dist/ + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/pypi/microsoft-skala.toml b/.github/workflows/pypi/microsoft-skala.toml new file mode 100644 index 0000000..dbffc04 --- /dev/null +++ b/.github/workflows/pypi/microsoft-skala.toml @@ -0,0 +1,23 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "microsoft-skala" +version = "@VERSION@" +description = "Skala Exchange Correlation Functional" +authors = [] +license-files = ["LICENSE.txt"] +readme = "README.md" +keywords = [] +classifiers = [ + "Programming Language :: Python :: 3", + "Development Status :: 5 - Production/Stable", +] +requires-python = ">=3.10" +dependencies = [ + "skala==@VERSION@", +] +urls.repository = "https://github.com/microsoft/skala" +urls.documentation = "https://microsoft.github.io/skala" +urls.homepage = "https://aka.ms/dft" diff --git a/README.md b/README.md index 24375f4..c6fc976 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Documentation](https://img.shields.io/badge/docs-microsoft.github.io%2Fskala-blue?logo=read-the-docs&logoColor=white)](https://microsoft.github.io/skala) [![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) -[![PyPI](https://img.shields.io/pypi/v/microsoft-skala?logo=pypi&logoColor=white)](https://pypi.org/project/microsoft-skala/) +[![PyPI](https://img.shields.io/pypi/v/skala?logo=pypi&logoColor=white)](https://pypi.org/project/skala/) [![Paper](https://img.shields.io/badge/arXiv-2506.14665-b31b1b?logo=arxiv&logoColor=white)](https://arxiv.org/abs/2506.14665) 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). This repository contains three main components: -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). +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). 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. 3. An example of using Skala in C++ CPU applications through LibTorch, see [`examples/cpp/cpp_integration`](examples/cpp/cpp_integration). @@ -27,7 +27,7 @@ Install using Pip: ```bash pip install torch --index-url https://download.pytorch.org/whl/cpu # unless you already have GPU Pytorch for something else -pip install microsoft-skala +pip install skala ``` Run an SCF calculation with Skala for a hydrogen molecule: @@ -52,7 +52,7 @@ Install using Pip: cu_version=128 #or 126 or 130 depending on your CUDA version pip install torch cupy --extra-index-url "https://download.pytorch.org/whl/cu${cu_version}" 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" -pip install microsoft-skala +pip install skala ``` Run an SCF calculation with Skala for a hydrogen molecule on GPU: diff --git a/pyproject.toml b/pyproject.toml index fa35f32..57af002 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] -name = "microsoft-skala" +name = "skala" version = "1.1.1" description = "Skala Exchange Correlation Functional" authors = [] @@ -41,6 +41,8 @@ optional-dependencies.doc = [ ] urls.repository = "https://github.com/microsoft/skala" +urls.documentation = "https://microsoft.github.io/skala" +urls.homepage = "https://aka.ms/dft" [tool.ruff] target-version = "py311"