From 0e2c8f743a4041c0494685383a5a396a134c0b08 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Fri, 15 Nov 2024 20:06:58 +0800 Subject: [PATCH 1/6] edit on github link in doc --- doc/conf.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/conf.py b/doc/conf.py index f9ba54f4..1e3685d3 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -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", From 523180571e1ce90b416d7f6a398ca07d8b9a53fc Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sat, 16 Nov 2024 19:01:34 +0800 Subject: [PATCH 2/6] update sparc package data with setup.py --- setup.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index 2ad56b99..5972ee77 100644 --- a/setup.py +++ b/setup.py @@ -28,17 +28,13 @@ version="1.0.4", python_requires=">=3.8", description="Python API for the SPARC DFT Code", - author="Tian Tian, Ben Comer", - author_email="alchem0x2a@gmail.com, ben.comer@gatech.edu", + author="Tian Tian, Lucas R Timmerman, Ben Comer", + author_email="alchem0x2a@gmail.com, ltimmerman3@gatech.edu, ben.comer@gatech.edu", url="https://github.com/SPARC-X/SPARC-X-API", packages=find_packages(), - # ASE 3.22 dependency will be deprecated in 1.1.0+ release - install_requires=["ase>=3.22.0", "numpy>=1.23", "packaging>=20.0", "psutil>=5.0.0"], + # ASE 3.22 dependency will be deprecated in 2.0+ release + install_requires=["ase>=3.23.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", @@ -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, ) From 2104e765d4abd6bd34d8805683505ca318b80028 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sat, 16 Nov 2024 19:18:18 +0800 Subject: [PATCH 3/6] check pypi version --- .github/workflows/publish-pypi.yml | 48 ++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/publish-pypi.yml diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml new file mode 100644 index 00000000..95bdb755 --- /dev/null +++ b/.github/workflows/publish-pypi.yml @@ -0,0 +1,48 @@ +name: Publish PyPI package + +on: + push: + branches: + - master + pull_request: + branches: + - master + 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 + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist/ + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') From 21d715a93f50397094b88b56576dec17856c2f50 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sat, 16 Nov 2024 19:22:55 +0800 Subject: [PATCH 4/6] update pypi workflow --- .github/workflows/publish-pypi.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 95bdb755..7061b5a3 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -1,6 +1,8 @@ name: Publish PyPI package on: + # The workflow runs on each push / PR but only allow upload + # PyPI when tagged push: branches: - master From 4b60e22d785d01a823924fc45537154774f8ae61 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sat, 16 Nov 2024 19:37:31 +0800 Subject: [PATCH 5/6] update workflow --- .github/workflows/publish-pypi.yml | 5 +++++ setup.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 7061b5a3..252eb65e 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -43,6 +43,11 @@ jobs: 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: diff --git a/setup.py b/setup.py index 5972ee77..f492c9d8 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ 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, Lucas R Timmerman, Ben Comer", @@ -33,7 +33,7 @@ url="https://github.com/SPARC-X/SPARC-X-API", packages=find_packages(), # ASE 3.22 dependency will be deprecated in 2.0+ release - install_requires=["ase>=3.23.0", "numpy>=1.23", "packaging>=20.0", "psutil>=5.0.0"], + install_requires=["ase>=3.22.0", "numpy>=1.23", "packaging>=20.0", "psutil>=5.0.0"], entry_points={ # The ioformats are only compatible with ase>=3.23 "ase.ioformats": [ From 6ab36b54b410b6e230eb53c13c7cd3269fa29910 Mon Sep 17 00:00:00 2001 From: "T.Tian" Date: Sat, 16 Nov 2024 19:44:42 +0800 Subject: [PATCH 6/6] update pypi workflow --- .github/workflows/publish-pypi.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 252eb65e..71e3065c 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -3,12 +3,9 @@ name: Publish PyPI package on: # The workflow runs on each push / PR but only allow upload # PyPI when tagged - push: - branches: - - master - pull_request: - branches: - - master + release: + types: + - created workflow_dispatch: jobs: @@ -52,4 +49,4 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: packages-dir: dist/ - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + if: github.event.release.draft == false