-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ap--/packaging-changes
Packaging changes
- Loading branch information
Showing
9 changed files
with
175 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: scikit_mol ci | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
# run pytests for scikit_mol | ||
tests: | ||
name: pytest ${{ matrix.os }}::py${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
max-parallel: 6 | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: ["3.10"] | ||
include: | ||
# test python version compatibility on linux only | ||
- os: ubuntu-latest | ||
python-version: 3.9 | ||
- os: ubuntu-latest | ||
python-version: 3.8 | ||
- os: ubuntu-latest | ||
python-version: 3.7 | ||
steps: | ||
- name: Checkout scikit_mol | ||
uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install scikit_mol | ||
run: python -m pip install -e .[dev] | ||
- name: Cache tests/data | ||
uses: actions/cache@v3 | ||
with: | ||
path: tests/data | ||
key: ${{ runner.os }}-${{ hashFiles('tests/conftest.py') }} | ||
- name: Run Tests | ||
run: pytest --cov=./scikit_mol . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
prune .github | ||
exclude .git* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools >= 64", | ||
"setuptools_scm[toml]>=6.2", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools_scm] | ||
write_to = "scikit_mol/_version.py" | ||
version_scheme = "post-release" | ||
|
||
[tool.pytest.ini_options] | ||
addopts = [ | ||
"-v", | ||
] | ||
|
||
[tool.coverage.run] | ||
source = ["scikit_mol"] | ||
|
||
[tool.coverage.report] | ||
exclude_lines = [ | ||
"pragma: no cover", | ||
"raise NotImplementedError", | ||
"if TYPE_CHECKING:", | ||
"if MYPY:", | ||
"^\\s+[.][.][.]$", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
try: | ||
from scikit_mol._version import __version__ | ||
except ImportError: # pragma: no cover | ||
__version__ = "not-installed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
[metadata] | ||
name = scikit_mol | ||
url = https://github.com/EBjerrum/scikit-mol | ||
download_url = https://github.com/EBjerrum/scikit-mol | ||
license = Apache-2.0 | ||
license_file = LICENSE | ||
description = scikit-learn classes for molecule transformation | ||
long_description = file: README.md | ||
long_description_content_type = text/markdown | ||
author = Esben Jannik Bjerrum | ||
author_email = esben@cheminformania.com | ||
classifiers = | ||
Development Status :: 3 - Alpha | ||
Intended Audience :: Science/Research | ||
License :: OSI Approved :: Apache Software License | ||
Programming Language :: Python | ||
Programming Language :: Python :: 3 :: Only | ||
Programming Language :: Python :: 3.7 | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: 3.9 | ||
Programming Language :: Python :: 3.10 | ||
Topic :: Scientific/Engineering | ||
Topic :: Utilities | ||
Operating System :: Microsoft :: Windows | ||
Operating System :: POSIX | ||
Operating System :: Unix | ||
Operating System :: MacOS | ||
|
||
[options] | ||
packages = find: | ||
python_requires = >=3.7 | ||
install_requires = | ||
rdkit | ||
numpy | ||
pandas | ||
scikit-learn | ||
|
||
[options.packages.find] | ||
exclude = | ||
tests/* | ||
|
||
[options.extras_require] | ||
dev = | ||
pytest>=6 | ||
pytest-cov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import hashlib | ||
import shutil | ||
from pathlib import Path | ||
from pathlib import PurePath | ||
from urllib.parse import urlsplit | ||
from urllib.request import urlopen | ||
|
||
import pandas as pd | ||
import pytest | ||
|
||
|
||
TEST_DATA_URL = "https://ndownloader.figshare.com/files/25747817" | ||
TEST_DATA_MD5 = "1ec89bde544c3c4bc400d5b75315921e" | ||
|
||
|
||
def md5(fn): | ||
m = hashlib.md5() | ||
with open(fn, "rb") as f: | ||
for chunk in iter(lambda: f.read(4096), b""): | ||
m.update(chunk) | ||
return m.hexdigest() | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def data_pth(tmp_path_factory) -> Path: | ||
"""download the smallest aperio test image svs or use local""" | ||
filename = PurePath(urlsplit(TEST_DATA_URL).path).name | ||
data_dir = Path(__file__).parent / "data" | ||
data_dir.mkdir(parents=True, exist_ok=True) | ||
data_fn = data_dir / filename | ||
|
||
if not data_fn.is_file(): | ||
# download svs from openslide test images | ||
with urlopen(TEST_DATA_URL) as response, open( | ||
data_fn, "wb" | ||
) as out_file: | ||
shutil.copyfileobj(response, out_file) | ||
|
||
if md5(data_fn) != TEST_DATA_MD5: # pragma: no cover | ||
shutil.rmtree(data_fn) | ||
pytest.fail("incorrect md5") | ||
|
||
yield data_fn.absolute() | ||
|
||
@pytest.fixture() | ||
def data(data_pth) -> pd.DataFrame: | ||
yield pd.read_csv(data_pth) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
def test_load_data(data): | ||
assert len(data) > 0 | ||
|