Skip to content

Commit

Permalink
Merge pull request #48 from ecrl/update-install
Browse files Browse the repository at this point in the history
Update install method, update unit tests
  • Loading branch information
tjkessler authored Aug 1, 2023
2 parents 05f08da + 75375ff commit 61c4557
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 111 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Upload new PaDELPy version to PyPI

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run PaDELPy tests

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install pytest pytest-md
- name: Install package
run: python -m pip install .
- name: Run tests
uses: pavelzw/pytest-action@v2
with:
emoji: false
report-title: 'PaDELPy test report'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Installation via cloned repository:
```
$ git clone https://github.com/ecrl/padelpy
$ cd padelpy
$ python setup.py install
$ pip install .
```

PaDEL-Descriptor is bundled into PaDELPy, therefore an external installation/download of PaDEL-Descriptor is not necessary. There are currently no additional Python dependencies for PaDELPy, however it requires an installation of the [Java JRE](https://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html) version 6+.
Expand Down
26 changes: 0 additions & 26 deletions azure-pipelines.yml

This file was deleted.

1 change: 0 additions & 1 deletion padelpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from .wrapper import padeldescriptor
from .functions import from_mdl, from_smiles, from_sdf
__version__ = '0.1.13'
5 changes: 2 additions & 3 deletions padelpy/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
VERSION = (0, 1, 14, "")
import pkg_resources

__version__ = ".".join(map(str, VERSION[:-1]))
__release__ = ".".join(map(str, VERSION))
__version__ = pkg_resources.get_distribution("padelpy").version
30 changes: 30 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
include-package-data = true

[project]
name = "padelpy"
version = "0.1.15"
authors = [
{ name="Travis Kessler", email="travis.j.kessler@gmail.com" },
]
description = "A Python wrapper for PaDEL-Descriptor software"
readme = "README.md"
requires-python = ">=3.11"
classifiers = [
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]

[project.urls]
"Homepage" = "https://github.com/ecrl/padelpy"
"Bug Tracker" = "https://github.com/ecrl/padelpy/issues"

[tool.pytest.ini_options]
filterwarnings = [
"ignore::DeprecationWarning",
]
43 changes: 0 additions & 43 deletions setup.py

This file was deleted.

37 changes: 0 additions & 37 deletions tests/test.py

This file was deleted.

34 changes: 34 additions & 0 deletions tests/test_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import pytest

from padelpy import from_sdf, from_smiles


def test_from_smiles():
descriptors = from_smiles('CCC')
assert len(descriptors) == 1875
assert float(descriptors['MW']) == pytest.approx(44.0626, 1e-4)
assert int(descriptors['nC']) == 3


def test_multiple_smiles():
smiles = ['CCC', 'CCCC']
descriptors = from_smiles(smiles)
assert len(descriptors) == 2
assert len(descriptors[0]) == 1875


def test_errors():
bad_smiles = 'SJLDFGSJ'
with pytest.raises(RuntimeError):
_ = from_smiles(bad_smiles)
bad_smiles = ['SJLDFGSJ', 'CCC']
with pytest.raises(RuntimeError):
_ = from_smiles(bad_smiles)


def test_from_sdf():
descriptors = from_sdf('tests/aspirin_3d.sdf')[0]
assert len(descriptors) == 1875
assert float(descriptors['MW']) == pytest.approx(180.04225, 1e-4)
assert float(descriptors['SsCH3']) == pytest.approx(1.2209, 1e-4)
assert int(descriptors['nC']) == 9

0 comments on commit 61c4557

Please sign in to comment.