Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package build update #18

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .flake8

This file was deleted.

120 changes: 120 additions & 0 deletions .github/workflows/build-laplaciannb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

## from packaging tutorial: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

on: push

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pdm
run: >-
python3 -m
pip install
pdm
--user
- name: Build a binary wheel and a source tarball
run: pdm 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
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/laplaciannb # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

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

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 # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

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 }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'

publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/laplaciannb

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

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/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
48 changes: 0 additions & 48 deletions .github/workflows/build-lmnb.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Ruff
on: [push, pull_request]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v1
with:
args: 'format --check'
src: './src'
45 changes: 0 additions & 45 deletions .github/workflows/tests.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -67,3 +67,6 @@ _configtest.o.d

# Used by mypy
.mypy_cache/

# Pdm
.pdm-python
44 changes: 19 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
exclude: tests/
args: [--check]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: [
'flake8-blind-except',
'flake8-docstrings',
'flake8-bugbear',
'flake8-comprehensions',
'flake8-docstrings',
'flake8-implicit-str-concat',
'pydocstyle>=5.0.0',
]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.7.2
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi ]
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi ]
- repo: local
hooks:
- id: pytest-check
name: pytest-check
entry: pytest
language: system
pass_filenames: false
always_run: true
17 changes: 1 addition & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -34,28 +34,12 @@ https://doi.org/10.1002/cbic.201900741
Authors
--------

Huge thanks to **Florian Nigsch** (florian.nigsch@novartis.com) for the first implementation of the algorithm in python and **Peter Kutchukian** (peter.kutchukian@novartis.net) for scientific guidance and validation.


Author and maintainer: **Bartosz Baranowski** (bartosz.baranowski@novartis.com)


Installation
------------

Dependencies:

```
- Python (>= 3.8)
- pandas (>=1.4.2)
- numpy (>=1.22.4)
- scikit-learn (>=1.1.1)
- scipy (>=1.8.1)
```

=======


User installation:

```pip install laplaciannb```
@@ -64,4 +48,5 @@ User installation:

Changelog
---------
`v0.6.0` - Move to pdm build
`v0.5.0` - Initial release
1 change: 0 additions & 1 deletion bayes/__about__.py

This file was deleted.

4 changes: 2 additions & 2 deletions examples/bayes_tutorial.ipynb
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
"metadata": {},
"outputs": [],
"source": [
"import joblib\n",
"import pandas as pd"
]
},
@@ -61,7 +60,7 @@
"metadata": {},
"outputs": [],
"source": [
"from bayes.LaplacianNB import LaplacianNB"
"from laplaciannb.LaplacianNB import LaplacianNB"
]
},
{
@@ -82,6 +81,7 @@
"from rdkit import Chem\n",
"from rdkit.Chem import AllChem\n",
"\n",
"\n",
"def get_fp(smiles: str) -> set:\n",
" \"\"\"Function to calculate MorganFingerprint from smiles.\n",
" It returns index of all '1' bits of not-folded fingerprint.\n",
Loading