Skip to content

Commit 5b6e0f0

Browse files
authored
Merge pull request #1 from ecrl/dev
0.1.3
2 parents bda4ad9 + 47a6102 commit 5b6e0f0

File tree

11 files changed

+79
-43
lines changed

11 files changed

+79
-43
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Upload new alvaDescPy version to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Set up Python 3.11
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: '3.11'
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install build
24+
- name: Build package
25+
run: python -m build
26+
- name: Publish package to PyPI
27+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
28+
with:
29+
user: __token__
30+
password: ${{ secrets.PYPI_API_TOKEN }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Installation via cloned repository:
2121
```
2222
$ git clone https://github.com/ecrl/alvadescpy
2323
$ cd alvadescpy
24-
$ python setup.py install
24+
$ pip install .
2525
```
2626

2727
There are currently no additional dependencies for alvaDescPy, however it requires a valid, licensed installation of [alvaDesc](https://www.alvascience.com/alvadesc/).

alvadescpy/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from alvadescpy.wrapper import alvadesc
22
from alvadescpy.functions import smiles_to_descriptors
33
from alvadescpy.wrapper import CONFIG
4-
__version__ = '0.1.2'
4+
import pkg_resources
5+
__version__ = pkg_resources.get_distribution('alvadescpy')
-286 Bytes
Binary file not shown.
-1.11 KB
Binary file not shown.
-5.08 KB
Binary file not shown.

alvadescpy/functions.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
from alvadescpy import alvadesc
1616

1717
# custom argument and return variables
18-
_DESC = TypeVar('_DESC', str, list)
19-
_RET_VAL = TypeVar('_RET_VAL', dict, list)
18+
str_or_list = TypeVar('str_or_list', str, list)
19+
list_or_dict = TypeVar('list_or_dict', dict, list)
2020

2121

22-
def smiles_to_descriptors(smiles: str, descriptors: _DESC='ALL',
23-
labels: bool=True) -> _RET_VAL:
22+
def smiles_to_descriptors(smiles: str_or_list,
23+
descriptors: str_or_list = 'ALL',
24+
labels: bool = True) -> list_or_dict:
2425
''' smiles_to_descriptors: returns molecular descriptors for a given
2526
molecule (represented by its SMILES string)
2627
@@ -37,6 +38,8 @@ def smiles_to_descriptors(smiles: str, descriptors: _DESC='ALL',
3738
'''
3839

3940
if type(smiles) == list:
40-
return [alvadesc(ismiles=smi, descriptors=descriptors, labels=labels)[0]
41-
for smi in smiles]
41+
return [
42+
alvadesc(ismiles=smi, descriptors=descriptors, labels=labels)[0]
43+
for smi in smiles
44+
]
4245
return alvadesc(ismiles=smiles, descriptors=descriptors, labels=labels)[0]

alvadescpy/wrapper.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@
99
#
1010

1111
# stdlib. imports
12-
from subprocess import check_output, PIPE, Popen, call
13-
from csv import writer, QUOTE_ALL
12+
from subprocess import PIPE, Popen
1413
from typing import TypeVar
1514
import platform
16-
from os.path import realpath
1715

1816
# path to alvaDesc command line interface executable
1917
CONFIG = {
2018
'alvadesc_path': None
2119
}
2220
plt = platform.system()
2321
if plt == 'Windows':
24-
CONFIG['alvadesc_path'] = 'C:\\Program Files\\Alvascience\\alvaDesc\\alvaDescCLI.exe'
22+
CONFIG['alvadesc_path'] = 'C:\\Program Files\\Alvascience\\alvaDesc\\\
23+
alvaDescCLI.exe'
2524
elif plt == 'Darwin':
26-
CONFIG['alvadesc_path'] = '/Applications/alvaDesc.app/Contents/MacOS/alvaDescCLI'
25+
CONFIG['alvadesc_path'] = '/Applications/alvaDesc.app/Contents/MacOS/\
26+
alvaDescCLI'
2727
elif plt == 'Linux':
2828
CONFIG['alvadesc_path'] = '/usr/bin/alvaDescCLI'
2929
else:
3030
raise RuntimeError('Unknown/unsupported operating system: {}'.format(plt))
3131

3232
# custom argument variable (either str or list)
33-
_DESC = TypeVar('_DESC', str, list)
33+
str_or_list = TypeVar('str_or_list', str, list)
3434

3535

3636
def _sub_call(command: str) -> list:
@@ -54,12 +54,15 @@ def _sub_call(command: str) -> list:
5454
return p.communicate()[0].decode('utf-8')
5555

5656

57-
def alvadesc(script: str=None, ismiles: str=None, input_file: str=None,
58-
inputtype: str=None, descriptors: _DESC=None, labels: bool=False,
59-
ecfp: bool=False, pfp: bool=False, fpsize: int=1024, fpmin: int=0,
60-
fpmax: int=2, count: bool=True, bits: int=2, fpoptions: str=None,
61-
maccsfp: bool=False, output: str=None, threads: int=None) -> list:
62-
''' alvadesc: calls alvaDesc's command line interface; supports all arguments
57+
def alvadesc(script: str = None, ismiles: str = None, input_file: str = None,
58+
inputtype: str = None, descriptors: str_or_list = None,
59+
labels: bool = False, ecfp: bool = False, pfp: bool = False,
60+
fpsize: int = 1024, fpmin: int = 0, fpmax: int = 2,
61+
count: bool = True, bits: int = 2, fpoptions: str = None,
62+
maccsfp: bool = False, output: str = None,
63+
threads: int = None) -> list:
64+
''' alvadesc: calls alvaDesc's command line interface; supports all
65+
arguments
6366
6467
Args:
6568
script (str): path to script file containing all available options; if

pyproject.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "alvadescpy"
7+
version = "0.1.3"
8+
authors = [
9+
{ name="Travis Kessler", email="travis.j.kessler@gmail.com" },
10+
]
11+
description = "Python wrapper for alvaDesc software"
12+
readme = "README.md"
13+
requires-python = ">=3.11"
14+
classifiers = [
15+
"Programming Language :: Python :: 3.11",
16+
"License :: OSI Approved :: MIT License",
17+
"Operating System :: OS Independent",
18+
]
19+
20+
[project.urls]
21+
"Homepage" = "https://github.com/ecrl/alvadescpy"
22+
"Bug Tracker" = "https://github.com/ecrl/alvadescpy/issues"

setup.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)