Skip to content

Commit b17bdeb

Browse files
authored
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
1 parent c625af7 commit b17bdeb

File tree

3 files changed

+259
-10
lines changed

3 files changed

+259
-10
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# This workflow is adapted from:
2+
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
3+
# Changes made:
4+
# - Removed emoticons
5+
# - Updated some actions to more recent versions
6+
# - Customized for the qc-AtomDB repository
7+
8+
name: PyPI Release
9+
on:
10+
push:
11+
tags:
12+
# Trigger on version tags (e.g., v1.0.0)
13+
- "v[0-9].[0-9].[0-9]*"
14+
- "[0-9].[0-9].[0-9]*"
15+
# Trigger on pre-release tags (e.g., v1.0.0-alpha.1)
16+
- "v[0-9].[0-9].[0-9]*-*"
17+
- "[0-9].[0-9].[0-9]*-*"
18+
19+
env:
20+
# The name of the package to be published to PyPI and TestPyPI.
21+
PYPI_NAME: qc-AtomDB
22+
23+
jobs:
24+
build:
25+
name: Build distribution
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
- name: Set up Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: "3.11"
36+
- name: Install pypa/build
37+
run: |
38+
# install from github
39+
# TODO: change to pypi once the release of qc-grid is made
40+
python -m pip install git+https://github.com/theochem/grid.git@master
41+
python -m pip install build
42+
- name: Build package
43+
run: >-
44+
python -m build
45+
- name: Store the distribution packages
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
51+
publish-to-pypi:
52+
name: Publish Python distribution to PyPI
53+
# only publish to PyPI on tag pushes
54+
if: startsWith(github.ref, 'refs/tags/')
55+
needs:
56+
- build
57+
runs-on: ubuntu-latest
58+
environment:
59+
name: PyPI-Release
60+
url: https://pypi.org/project/${{ env.PYPI_NAME }}
61+
permissions:
62+
id-token: write
63+
64+
steps:
65+
- name: Download all the dists
66+
uses: actions/download-artifact@v4
67+
with:
68+
name: python-package-distributions
69+
path: dist/
70+
- name: Publish distribution to PyPI
71+
uses: pypa/gh-action-pypi-publish@release/v1
72+
env:
73+
TWINE_USERNAME: "__token__"
74+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
75+
76+
github-release:
77+
name: Sign the Python distribution with Sigstore and upload them to GitHub Release
78+
needs:
79+
- publish-to-pypi
80+
runs-on: ubuntu-latest
81+
82+
permissions:
83+
contents: write
84+
id-token: write
85+
86+
steps:
87+
- name: Download all the dists
88+
uses: actions/download-artifact@v4
89+
with:
90+
name: python-package-distributions
91+
path: dist/
92+
- name: Sign the dists with Sigstore
93+
uses: sigstore/[email protected]
94+
with:
95+
inputs: >-
96+
./dist/*.tar.gz
97+
./dist/*.whl
98+
- name: Create GitHub Release
99+
env:
100+
GITHUB_TOKEN: ${{ github.token }}
101+
run: >-
102+
gh release create
103+
'${{ github.ref_name }}'
104+
--repo '${{ github.repository }}'
105+
--notes ""
106+
- name: Upload artifact signatures to GitHub Release
107+
env:
108+
GITHUB_TOKEN: ${{ github.token }}
109+
run: >-
110+
gh release upload
111+
'${{ github.ref_name }}' dist/**
112+
--repo '${{ github.repository }}'
113+
114+
publish-to-testpypi:
115+
name: Publish Python distribution to TestPyPI
116+
# if: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'theochem' }}
117+
needs:
118+
- build
119+
runs-on: ubuntu-latest
120+
121+
environment:
122+
name: TestPyPI
123+
url: https://test.pypi.org/project/${{ env.PYPI_NAME }}
124+
125+
permissions:
126+
id-token: write
127+
128+
steps:
129+
- name: Download all the dists
130+
uses: actions/download-artifact@v4
131+
with:
132+
name: python-package-distributions
133+
path: dist/
134+
- name: Publish distribution to TestPyPI
135+
uses: pypa/gh-action-pypi-publish@release/v1
136+
with:
137+
repository-url: https://test.pypi.org/legacy/
138+
env:
139+
TWINE_USERNAME: "__token__"
140+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<!--
2+
This file is part of AtomDB.
3+
4+
AtomDB is free software: you can redistribute it and/or modify it under
5+
the terms of the GNU General Public License as published by the Free
6+
Software Foundation, either version 3 of the License, or (at your
7+
option) any later version.
8+
9+
AtomDB is distributed in the hope that it will be useful, but WITHOUT
10+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with AtomDB. If not, see <http://www.gnu.org/licenses/>.
16+
-->
17+
18+
[![This project supports Python 3.9+](https://img.shields.io/badge/Python-3.9+-blue.svg)](https://python.org/downloads)
19+
[![pytest](https://github.com/theochem/AtomDB/actions/workflows/pytest.yaml/badge.svg?branch=master)](https://github.com/theochem/AtomDB/actions/workflows/pytest.yaml)
20+
[![PyPI](https://img.shields.io/pypi/v/qc-AtomDB.svg)](https://pypi.python.org/pypi/qc-AtomDB/)
21+
![License](https://img.shields.io/github/license/theochem/AtomDB)
22+
[![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)
23+
24+
# AtomDB
25+
26+
## About
27+
28+
AtomDB is a versatile, free, and open-source Python library for accessing and managing atomic and
29+
promolecular properties. It serves as an extended database or periodic table of neutral and charged
30+
atomic properties, offering accurate experimental and computational data for various atomic
31+
charge/multiplicity states. AtomDB is a [QC-Devs](https://qcdevs.org/) project.
32+
33+
## Documentation
34+
35+
AtomDB's documentation, including installation and usage instructions, as well as API documentation, is available at [atomdb.qcdevs.org](https://atomdb.qcdevs.org/).
36+
37+
### Functionality
38+
39+
- **Atomic scalar properties**
40+
41+
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**.
42+
43+
- **Point dependent properties**
44+
45+
AtomDB provides functions to calculate point-dependent properties, such as:
46+
**Electron density** $\rho(r)$,
47+
**Electron density gradient** $\nabla \rho(r)$,
48+
**Electron density Laplacian** $\nabla^2 \rho(r)$,
49+
**Electron density Hessian** $\nabla^2 \rho(r)$ (for these properties, only the radial part is provided),
50+
and **Kinetic energy density** $ked(r)$.
51+
52+
The computation of contributions per orbital, set of orbitals, or spin to these properties is also supported.
53+
54+
- **Promolecular properties**
55+
56+
AtomDB provides the capabilities to create promolecular models, and then estimate molecular properties from the atomic properties.
57+
58+
- **Dumping and loading**
59+
60+
AtomDB provides the capability to dump and load atomic properties to and from JSON files.
61+
62+
For a complete list of available properties, see [this
63+
table](https://atomdb.qcdevs.org/api/index.html#properties).
64+
65+
## Installation
66+
67+
We recommend using Python 3.9 or later. The `qc-grid` is need to run `AtomDB`. You can install it
68+
from source for now:
69+
70+
```bash
71+
git clone [email protected]:theochem/grid.git
72+
cd qc-grid
73+
pip install .
74+
```
75+
76+
Then,
77+
`qc-AtomDB` can be installed using `pip`:
78+
79+
```bash
80+
pip install qc-AtomDB
81+
82+
```
83+
84+
85+
## Contributing
86+
87+
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/).
88+
Please report any issues you encounter while using AtomDB on GitHub Issues.
89+
90+
For further information and inquiries, please contact us at [[email protected]](mailto:[email protected]).
91+
92+
## Citing AtomDB
93+
94+
Please use the following citation in any publication using AtomDB:
95+
96+
```bibtex
97+
@article{atomdb,
98+
author = {S{\'a}nchez D{\'\i}az, Gabriela and Richer, Michelle and
99+
Mart{\'\i}nez Gonz{\'a}lez, Marco and {v}an Zyl, Maximilian and
100+
Pujal, Leila and Tehrani, Alireza and Bianchi, Julianna and
101+
Ayers, Paul W. and Heidar-Zadeh, Farnaz},
102+
title = {{AtomDB: A Python Library for Atomic and Promolecular Properties}},
103+
journal = {-},
104+
year = {2024},
105+
url = {https://atomdb.qcdevs.org/},
106+
}
107+
```

pyproject.toml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
# along with AtomDB. If not, see <http://www.gnu.org/licenses/>.
1515

1616
[build-system]
17-
requires = ["setuptools>=65.0", "setuptools_scm[toml]>=7.1.0"]
17+
requires = ["setuptools>=65", "setuptools-scm>=8"]
1818
build-backend = "setuptools.build_meta"
1919

2020
[project]
21-
name = "AtomDB"
21+
name = "qc-AtomDB"
2222
authors = [
2323
{ name="QC-Devs Community", email="[email protected]" },
2424
]
@@ -27,7 +27,7 @@ readme = "README.rst"
2727
license = {text = "GPL-3.0-or-later"}
2828
requires-python = ">=3.9"
2929
classifiers = [
30-
'Development Status :: 0 - Released',
30+
'Development Status :: 5 - Production/Stable',
3131
'Environment :: Console',
3232
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
3333
'Operating System :: POSIX :: Linux',
@@ -47,7 +47,7 @@ dependencies = [
4747
"msgpack-numpy>=0.4.8",
4848
"h5py>=3.6.0",
4949
"importlib_resources>=3.0.0",
50-
"pooch==1.8.1",
50+
"pooch>=1.8.1",
5151
]
5252
dynamic = ["version"]
5353

@@ -59,11 +59,15 @@ Changelog = "https://github.com/theochem/atomdb/blob/main/CHANGELOG.md"
5959

6060
[project.optional-dependencies]
6161
dev = [
62-
"pytest >=2.6",
62+
"pytest>=8.3.3",
6363
"pyscf",
64-
"qc-gbasis@git+https://github.com/theochem/gbasis.git@master",
65-
"qc-grid@git+https://github.com/theochem/grid.git@master",
66-
"qc-iodata@git+https://github.com/theochem/iodata.git@main",
64+
# "qc-gbasis@git+https://github.com/theochem/gbasis.git@master",
65+
"qc-gbasis",
66+
# "qc-grid@git+https://github.com/theochem/grid.git@master",
67+
# TODO: uncomment when grid is available on PyPI
68+
# "qc-grid",
69+
# "qc-iodata@git+https://github.com/theochem/iodata.git@main",
70+
"qc-iodata",
6771
]
6872
test_extra = [
6973
"pytest-md",
@@ -111,5 +115,3 @@ addopts = "-m 'not dev'"
111115
markers = [
112116
"dev: mark a developer test, needs extra dependencies.",
113117
]
114-
115-

0 commit comments

Comments
 (0)