Skip to content

Commit

Permalink
Add PyPI release (#106)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
FanwangM authored Oct 3, 2024
1 parent c625af7 commit b17bdeb
Show file tree
Hide file tree
Showing 3 changed files with 259 additions and 10 deletions.
140 changes: 140 additions & 0 deletions .github/workflows/pypi_release.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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 }}
107 changes: 107 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<!--
This file is part of AtomDB.
AtomDB is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version.
AtomDB is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with AtomDB. If not, see <http://www.gnu.org/licenses/>.
-->

[![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 [email protected]: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 [[email protected]](mailto:[email protected]).

## 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/},
}
```
22 changes: 12 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
# along with AtomDB. If not, see <http://www.gnu.org/licenses/>.

[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="[email protected]" },
]
Expand All @@ -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',
Expand All @@ -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"]

Expand All @@ -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",
Expand Down Expand Up @@ -111,5 +115,3 @@ addopts = "-m 'not dev'"
markers = [
"dev: mark a developer test, needs extra dependencies.",
]


0 comments on commit b17bdeb

Please sign in to comment.