From b17bdeb539e9327bf2861842f5f6004bc45406b3 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Thu, 3 Oct 2024 16:30:03 -0400 Subject: [PATCH] Add PyPI release (#106) * Add PyPI release draft * Update pooch version * Disable the PyPI release for testing only * Enable PyPI release * Fix classifier in pyproject.toml * Fix the issue of "Can't have direct dependency" from git source codes * Enable multiple command runs * Add README.md * Fix math equations in README.md --- .github/workflows/pypi_release.yaml | 140 ++++++++++++++++++++++++++++ README.md | 107 +++++++++++++++++++++ pyproject.toml | 22 +++-- 3 files changed, 259 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/pypi_release.yaml create mode 100644 README.md diff --git a/.github/workflows/pypi_release.yaml b/.github/workflows/pypi_release.yaml new file mode 100644 index 0000000..77695eb --- /dev/null +++ b/.github/workflows/pypi_release.yaml @@ -0,0 +1,140 @@ +# This workflow is adapted from: +# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ +# Changes made: +# - Removed emoticons +# - Updated some actions to more recent versions +# - Customized for the qc-AtomDB repository + +name: PyPI Release +on: + push: + tags: + # Trigger on version tags (e.g., v1.0.0) + - "v[0-9].[0-9].[0-9]*" + - "[0-9].[0-9].[0-9]*" + # Trigger on pre-release tags (e.g., v1.0.0-alpha.1) + - "v[0-9].[0-9].[0-9]*-*" + - "[0-9].[0-9].[0-9]*-*" + +env: + # The name of the package to be published to PyPI and TestPyPI. + PYPI_NAME: qc-AtomDB + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install pypa/build + run: | + # install from github + # TODO: change to pypi once the release of qc-grid is made + python -m pip install git+https://github.com/theochem/grid.git@master + python -m pip install build + - name: Build package + run: >- + python -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: Publish Python distribution to PyPI + # only publish to PyPI on tag pushes + if: startsWith(github.ref, 'refs/tags/') + needs: + - build + runs-on: ubuntu-latest + environment: + name: PyPI-Release + url: https://pypi.org/project/${{ env.PYPI_NAME }} + permissions: + id-token: write + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + env: + TWINE_USERNAME: "__token__" + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + + github-release: + name: Sign the Python distribution with Sigstore and upload them to GitHub Release + needs: + - publish-to-pypi + runs-on: ubuntu-latest + + permissions: + contents: write + id-token: write + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v3.0.0 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release create + '${{ github.ref_name }}' + --repo '${{ github.repository }}' + --notes "" + - name: Upload artifact signatures to GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release upload + '${{ github.ref_name }}' dist/** + --repo '${{ github.repository }}' + + publish-to-testpypi: + name: Publish Python distribution to TestPyPI + # if: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'theochem' }} + needs: + - build + runs-on: ubuntu-latest + + environment: + name: TestPyPI + url: https://test.pypi.org/project/${{ env.PYPI_NAME }} + + permissions: + id-token: write + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + env: + TWINE_USERNAME: "__token__" + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} diff --git a/README.md b/README.md new file mode 100644 index 0000000..05bd2d9 --- /dev/null +++ b/README.md @@ -0,0 +1,107 @@ + + +[![This project supports Python 3.9+](https://img.shields.io/badge/Python-3.9+-blue.svg)](https://python.org/downloads) +[![pytest](https://github.com/theochem/AtomDB/actions/workflows/pytest.yaml/badge.svg?branch=master)](https://github.com/theochem/AtomDB/actions/workflows/pytest.yaml) +[![PyPI](https://img.shields.io/pypi/v/qc-AtomDB.svg)](https://pypi.python.org/pypi/qc-AtomDB/) +![License](https://img.shields.io/github/license/theochem/AtomDB) +[![pages-build-deployment](https://github.com/theochem/AtomDB/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/theochem/AtomDB/actions/workflows/pages/pages-build-deployment) + +# AtomDB + +## About + +AtomDB is a versatile, free, and open-source Python library for accessing and managing atomic and +promolecular properties. It serves as an extended database or periodic table of neutral and charged +atomic properties, offering accurate experimental and computational data for various atomic +charge/multiplicity states. AtomDB is a [QC-Devs](https://qcdevs.org/) project. + +## Documentation + +AtomDB's documentation, including installation and usage instructions, as well as API documentation, is available at [atomdb.qcdevs.org](https://atomdb.qcdevs.org/). + +### Functionality + +- **Atomic scalar properties** + + AtomDB provides a wide range of atomic properties for neutral and charged atoms, including: **Atomic number**, **Atomic symbol**, **Atomic mass**, **Atomic radius**, **van der Waals radius**, **Covalent radius**, **Ionization potential**, **Electron affinity**, **Electronegativity**, **Atomic polarizability**. + +- **Point dependent properties** + + AtomDB provides functions to calculate point-dependent properties, such as: + **Electron density** $\rho(r)$, + **Electron density gradient** $\nabla \rho(r)$, + **Electron density Laplacian** $\nabla^2 \rho(r)$, + **Electron density Hessian** $\nabla^2 \rho(r)$ (for these properties, only the radial part is provided), + and **Kinetic energy density** $ked(r)$. + + The computation of contributions per orbital, set of orbitals, or spin to these properties is also supported. + +- **Promolecular properties** + + AtomDB provides the capabilities to create promolecular models, and then estimate molecular properties from the atomic properties. + +- **Dumping and loading** + + AtomDB provides the capability to dump and load atomic properties to and from JSON files. + +For a complete list of available properties, see [this +table](https://atomdb.qcdevs.org/api/index.html#properties). + +## Installation + +We recommend using Python 3.9 or later. The `qc-grid` is need to run `AtomDB`. You can install it +from source for now: + +```bash +git clone git@github.com:theochem/grid.git +cd qc-grid +pip install . +``` + +Then, +`qc-AtomDB` can be installed using `pip`: + +```bash +pip install qc-AtomDB + +``` + + +## Contributing + +We welcome any contributions to the AtomDB library in accordance with our [Code of Conduct](https://qcdevs.org/guidelines/qcdevs_code_of_conduct/). Please see our [Contributing Guidelines](https://qcdevs.org/guidelines/). +Please report any issues you encounter while using AtomDB on GitHub Issues. + +For further information and inquiries, please contact us at [qcdevs@gmail.com](mailto:qcdevs@gmail.com). + +## Citing AtomDB + +Please use the following citation in any publication using AtomDB: + +```bibtex +@article{atomdb, + author = {S{\'a}nchez D{\'\i}az, Gabriela and Richer, Michelle and + Mart{\'\i}nez Gonz{\'a}lez, Marco and {v}an Zyl, Maximilian and + Pujal, Leila and Tehrani, Alireza and Bianchi, Julianna and + Ayers, Paul W. and Heidar-Zadeh, Farnaz}, + title = {{AtomDB: A Python Library for Atomic and Promolecular Properties}}, + journal = {-}, + year = {2024}, + url = {https://atomdb.qcdevs.org/}, + } +``` diff --git a/pyproject.toml b/pyproject.toml index c8da848..a21fa00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,11 +14,11 @@ # along with AtomDB. If not, see . [build-system] -requires = ["setuptools>=65.0", "setuptools_scm[toml]>=7.1.0"] +requires = ["setuptools>=65", "setuptools-scm>=8"] build-backend = "setuptools.build_meta" [project] -name = "AtomDB" +name = "qc-AtomDB" authors = [ { name="QC-Devs Community", email="qcdevs@gmail.com" }, ] @@ -27,7 +27,7 @@ readme = "README.rst" license = {text = "GPL-3.0-or-later"} requires-python = ">=3.9" classifiers = [ - 'Development Status :: 0 - Released', + 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 'Operating System :: POSIX :: Linux', @@ -47,7 +47,7 @@ dependencies = [ "msgpack-numpy>=0.4.8", "h5py>=3.6.0", "importlib_resources>=3.0.0", - "pooch==1.8.1", + "pooch>=1.8.1", ] dynamic = ["version"] @@ -59,11 +59,15 @@ Changelog = "https://github.com/theochem/atomdb/blob/main/CHANGELOG.md" [project.optional-dependencies] dev = [ - "pytest >=2.6", + "pytest>=8.3.3", "pyscf", - "qc-gbasis@git+https://github.com/theochem/gbasis.git@master", - "qc-grid@git+https://github.com/theochem/grid.git@master", - "qc-iodata@git+https://github.com/theochem/iodata.git@main", + # "qc-gbasis@git+https://github.com/theochem/gbasis.git@master", + "qc-gbasis", + # "qc-grid@git+https://github.com/theochem/grid.git@master", + # TODO: uncomment when grid is available on PyPI + # "qc-grid", + # "qc-iodata@git+https://github.com/theochem/iodata.git@main", + "qc-iodata", ] test_extra = [ "pytest-md", @@ -111,5 +115,3 @@ addopts = "-m 'not dev'" markers = [ "dev: mark a developer test, needs extra dependencies.", ] - -