Skip to content

Commit

Permalink
Merge pull request #70 from alchem0x2A/master
Browse files Browse the repository at this point in the history
Add workflow to publish pypi
  • Loading branch information
alchem0x2A authored Nov 16, 2024
2 parents b3689ba + 6ab36b5 commit ee3feeb
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 9 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish PyPI package

on:
# The workflow runs on each push / PR but only allow upload
# PyPI when tagged
release:
types:
- created
workflow_dispatch:

jobs:
publish-pypi:
name: upload release to PyPI
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: pypi
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: "3.10"
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
activate-environment: sparc-api-test
- name: Install dependencies
run: |
pip install -U build
- name: Download data
run: |
# Download the external psp data
python -m sparc.download_data
# Check if psp8 exists
ls sparc/psp/*.psp8
- name: Build wheel
run: |
# Wheels are inside dist/ folder
python -m build
# Check the contents, if psp exists
TMP_DIR=$(mktemp -d)
unzip dist/sparc_x_api-*.whl -d ${TMP_DIR}
find $TMP_DIR/sparc/psp -name "*.psp8"
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
if: github.event.release.draft == false
7 changes: 7 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@

html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
html_context = {
"display_github": True, # Integrate GitHub
"github_user": "sparc-x", # Username
"github_repo": "SPARC-X-API", # Repo name
"github_version": "master", # Version
"conf_py_path": "/doc/", # Path in the checkout to the docs root
}

myst_enable_extensions = [
"html_admonition",
Expand Down
14 changes: 5 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,16 @@

setup(
name="sparc-x-api",
version="1.0.4",
version="1.0.5",
python_requires=">=3.8",
description="Python API for the SPARC DFT Code",
author="Tian Tian, Ben Comer",
author_email="[email protected], [email protected]",
author="Tian Tian, Lucas R Timmerman, Ben Comer",
author_email="[email protected], [email protected], [email protected]",
url="https://github.com/SPARC-X/SPARC-X-API",
packages=find_packages(),
# ASE 3.22 dependency will be deprecated in 1.1.0+ release
# ASE 3.22 dependency will be deprecated in 2.0+ release
install_requires=["ase>=3.22.0", "numpy>=1.23", "packaging>=20.0", "psutil>=5.0.0"],
entry_points={
# TODO: deprecate
"ase.io": [
"sparc = sparc.io",
],
# The ioformats are only compatible with ase>=3.23
"ase.ioformats": [
"sparc = sparc.io:format_sparc",
Expand All @@ -53,6 +49,6 @@
"test": test_requires,
"doc": test_requires + doc_requires,
},
package_data={"sparc": ["psp/*", "sparc_json_api/*.json"]},
package_data={"sparc": ["psp/*.psp8", "sparc_json_api/*.json"]},
include_package_data=True,
)

0 comments on commit ee3feeb

Please sign in to comment.