Skip to content

Commit 7a34c6a

Browse files
authored
Merge pull request #33 from theochem/pypi
Add pypi draft
2 parents 7e11e23 + 9dfa959 commit 7a34c6a

8 files changed

Lines changed: 689 additions & 21 deletions

File tree

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: PyPI Release
2+
on:
3+
push:
4+
tags:
5+
# Trigger on version tags (e.g., v1.0.0)
6+
- "v*.*.*"
7+
# Trigger on pre-release tags (e.g., v1.0.0-alpha.1)
8+
- "v*.*.*-*"
9+
10+
env:
11+
# package name
12+
PYPI_NAME: qc-B3DB
13+
14+
jobs:
15+
build:
16+
name: Build and Test Distribution
17+
runs-on: ${{ matrix.os }}
18+
19+
strategy:
20+
matrix:
21+
# os: [ubuntu-latest, macos-latest, windows-latest]
22+
os: [ubuntu-latest]
23+
# python-version: ["3.9", "3.10", "3.11", "3.12"]
24+
python-version: ["3.12"]
25+
outputs:
26+
os: ${{ matrix.os }}
27+
python-version: ${{ matrix.python-version }}
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ matrix.python-version }}
37+
# python-version: "3.11"
38+
- name: Install dependencies
39+
run: |
40+
python -m pip install --upgrade pip
41+
python -m pip install -r requirements.txt
42+
- name: Build package
43+
run: python -m build
44+
- name: Store the distribution packages
45+
uses: actions/upload-artifact@v4
46+
with:
47+
# Name of the artifact to upload, unique for each OS and Python version
48+
name: python-package-distributions
49+
path: dist/
50+
# Optional parameters for better artifact management
51+
overwrite: false
52+
include-hidden-files: false
53+
54+
publish-to-pypi:
55+
name: Publish Python distribution to PyPI
56+
if: startsWith(github.ref, 'refs/tags/v')
57+
needs: build
58+
runs-on: ubuntu-latest
59+
environment:
60+
name: PyPI-Release
61+
url: https://pypi.org/p/${{ env.PYPI_NAME }}
62+
permissions:
63+
id-token: write
64+
65+
steps:
66+
- name: Download all the dists
67+
uses: actions/download-artifact@v4
68+
with:
69+
name: python-package-distributions
70+
path: dist/
71+
- name: Publish distribution to PyPI
72+
uses: pypa/gh-action-pypi-publish@release/v1
73+
env:
74+
TWINE_USERNAME: "__token__"
75+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
76+
77+
github-release:
78+
name: Sign and Upload Python Distribution to GitHub Release
79+
needs:
80+
- build
81+
- publish-to-pypi
82+
runs-on: ubuntu-latest
83+
permissions:
84+
contents: write
85+
id-token: write
86+
87+
steps:
88+
- name: Download all the dists
89+
uses: actions/download-artifact@v4
90+
with:
91+
name: python-package-distributions
92+
path: dist/
93+
- name: Sign the dists with Sigstore
94+
uses: sigstore/gh-action-sigstore-python@v3.0.0
95+
with:
96+
inputs: >-
97+
./dist/*.tar.gz
98+
./dist/*.whl
99+
- name: Create GitHub Release
100+
env:
101+
GITHUB_TOKEN: ${{ github.token }}
102+
run: >
103+
gh release create
104+
'${{ github.ref_name }}'
105+
--repo '${{ github.repository }}'
106+
--notes ""
107+
- name: Upload artifact signatures to GitHub Release
108+
env:
109+
GITHUB_TOKEN: ${{ github.token }}
110+
run: >
111+
gh release upload
112+
'${{ github.ref_name }}' dist/**
113+
--repo '${{ github.repository }}'
114+
115+
publish-none-pypi:
116+
name: Publish Python distribution to TestPyPI (none)
117+
if: startsWith(github.ref, 'refs/tags/v')
118+
needs: build
119+
runs-on: ubuntu-latest
120+
environment:
121+
name: TestPyPI
122+
url: https://test.pypi.org/p/${{ env.PYPI_NAME }}
123+
permissions:
124+
id-token: write
125+
126+
steps:
127+
- name: Download all the dists
128+
uses: actions/download-artifact@v4
129+
with:
130+
name: python-package-distributions
131+
path: dist/
132+
- name: Publish distribution with relaxed constraints
133+
uses: pypa/gh-action-pypi-publish@release/v1
134+
with:
135+
repository-url: https://test.pypi.org/legacy/
136+
env:
137+
TWINE_USERNAME: "__token__"
138+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}

.gitignore

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
doc/_build/
73+
doc/html/
74+
doc/latex/
75+
doc/man/
76+
doc/xml/
77+
doc/source
78+
doc/modules
79+
80+
# PyBuilder
81+
target/
82+
83+
# Jupyter Notebook
84+
.ipynb_checkpoints
85+
86+
# IPython
87+
profile_default/
88+
ipython_config.py
89+
90+
# pyenv
91+
.python-version
92+
93+
# pipenv
94+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
96+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
97+
# install all needed dependencies.
98+
#Pipfile.lock
99+
100+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
101+
__pypackages__/
102+
103+
# Celery stuff
104+
celerybeat-schedule
105+
celerybeat.pid
106+
107+
# SageMath parsed files
108+
*.sage.py
109+
110+
# Environments
111+
.env
112+
.venv
113+
env/
114+
venv/
115+
ENV/
116+
env.bak/
117+
venv.bak/
118+
119+
# Spyder project settings
120+
.spyderproject
121+
.spyproject
122+
123+
# Rope project settings
124+
.ropeproject
125+
126+
# mkdocs documentation
127+
/site
128+
129+
# mypy
130+
.mypy_cache/
131+
.dmypy.json
132+
dmypy.json
133+
134+
# Pyre type checker
135+
.pyre/
136+
137+
# Editor junk
138+
tags
139+
[._]*.s[a-v][a-z]
140+
[._]*.sw[a-p]
141+
[._]s[a-v][a-z]
142+
[._]sw[a-p]
143+
*~
144+
\#*\#
145+
.\#*
146+
.ropeproject
147+
.idea/
148+
.spyderproject
149+
.spyproject
150+
.vscode/
151+
# Mac .DS_Store
152+
.DS_Store
153+
154+
# jupyter notebook checkpoints
155+
.ipynb_checkpoints
156+
157+
# codecov files
158+
*.gcno
159+
*.gcda
160+
*.gcov
161+
162+
*/*/_build
163+
*/_build

B3DB/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# The B3DB provides a rich molecule database for
2+
# Blood-Brain Barrier (BBB) permeability.
3+
#
4+
# Copyright (C) 2021-2025 The QC-Devs Community
5+
# This file is part of B3DB.
6+
#
7+
# B3DB is dedicated to the public domain under the terms of CC0 1.0 Universal.
8+
#
9+
# A full copy of the CC0 1.0 Universal license can be found at:
10+
# https://creativecommons.org/publicdomain/zero/1.0/legalcode
11+
#
12+
# --
13+
14+
from B3DB.b3db import B3DB_DATA_DICT

B3DB/b3db.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# The B3DB provides a rich molecule database for
2+
# Blood-Brain Barrier (BBB) permeability.
3+
#
4+
# Copyright (C) 2021-2025 The QC-Devs Community
5+
# This file is part of B3DB.
6+
#
7+
# B3DB is dedicated to the public domain under the terms of CC0 1.0 Universal.
8+
#
9+
# A full copy of the CC0 1.0 Universal license can be found at:
10+
# https://creativecommons.org/publicdomain/zero/1.0/legalcode
11+
#
12+
# --
13+
14+
from pathlib import Path
15+
16+
import pandas as pd
17+
18+
19+
def load_b3db_dataset():
20+
"""Load the B3DB dataset."""
21+
data_dir = Path(__file__).parent
22+
# load regression dataset
23+
regression_data = pd.read_csv(data_dir / "B3DB_regression.tsv", sep="\t")
24+
# load extended regression dataset
25+
regression_data_extended = pd.read_csv(
26+
data_dir / "B3DB_regression_extended.tsv.gz", sep="\t", compression="gzip", low_memory=False
27+
)
28+
# load classification dataset
29+
classification_data = pd.read_csv(data_dir / "B3DB_classification.tsv", sep="\t")
30+
# load extended classification dataset
31+
classification_data_extended = pd.read_csv(
32+
data_dir / "B3DB_classification_extended.tsv.gz",
33+
sep="\t",
34+
compression="gzip",
35+
low_memory=False,
36+
)
37+
# load manually curated external data
38+
classification_external_data = pd.read_csv(
39+
data_dir / "B3DB_classification_external.tsv", sep="\t"
40+
)
41+
# TODO: add classification_external_extended_data
42+
43+
return {
44+
"B3DB_regression": regression_data,
45+
"B3DB_classification": classification_data,
46+
"B3DB_regression_extended": regression_data_extended,
47+
"B3DB_classification_extended": classification_data_extended,
48+
# "B3DB_classification_external": classification_external_data,
49+
}
50+
51+
52+
B3DB_DATA_DICT = load_b3db_dataset()
53+
54+
__all__ = [
55+
"B3DB_DATA_DICT",
56+
]

0 commit comments

Comments
 (0)