setup.py 2.47 KB
Newer Older
1 2 3 4 5 6 7 8 9
"""
setup.py
~~~~~~~~

:copyright: (c) 2018 Sander Bollen
:copyright: (c) 2018 Leiden University Medical Center
:license: MIT
"""
from os.path import abspath, dirname, join
10 11 12
import sys
import pkg_resources
import subprocess
13

Sander Bollen's avatar
Sander Bollen committed
14
from setuptools import setup, find_packages
15 16


17 18 19 20
# Temporarily install dependencies required by setup.py before trying to
# import them. From https://bitbucket.org/dholth/setup-requires
sys.path[0:0] = ['setup-requires']
pkg_resources.working_set.add_entry('setup-requires')
21 22


23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
def missing_requirements(specifiers):
    for specifier in specifiers:
        try:
            pkg_resources.require(specifier)
        except pkg_resources.DistributionNotFound:
            yield specifier


def install_requirements(specifiers):
    to_install = list(specifiers)
    if to_install:
        cmd = [sys.executable, "-m", "pip", "install",
               "-t", "setup-requires"] + to_install
        subprocess.call(cmd)


requires = ['cython', 'numpy']
install_requirements(missing_requirements(requires))


from Cython.Build import cythonize
import numpy as np
45 46 47 48 49

readme_file = join(abspath(dirname(__file__)), "README.md")
with open(readme_file) as desc_handle:
    long_desc = desc_handle.read()

50 51 52 53
# create extensions and add numpy includes to all of them.
cython_extensions = cythonize("vtools/*.pyx")
for ext in cython_extensions:
    ext.include_dirs.append(np.get_include())
54 55

setup(
Sander Bollen's avatar
Sander Bollen committed
56
    name="v-tools",
57
    version="0.0.1",
58
    description="Various tools operating over VCF files",
59
    long_description=long_desc,
60 61
    author="Sander Bollen",
    author_email="a.h.b.bollen@lumc.nl",
62
    url="https://git.lumc.nl/klinische-genetica/capture-lumc/vtools",
63
    license="MIT",
Sander Bollen's avatar
Sander Bollen committed
64
    packages=find_packages(),
Sander Bollen's avatar
Sander Bollen committed
65 66
    python_requires=">=3.6",
    zip_safe=False,
Sander Bollen's avatar
Sander Bollen committed
67
    include_package_data=True,
68 69 70 71
    install_requires=[
        "click",
        "cyvcf2",
        "numpy",
72 73
        "cython",
        "tqdm"
74 75 76 77 78
    ],
    entry_points={
        "console_scripts": [
            "vtools-filter = vtools.cli:filter_cli",
            "vtools-stats = vtools.cli:stats_cli",
Sander Bollen's avatar
Sander Bollen committed
79 80
            "vtools-gcoverage = vtools.cli:gcoverage_cli",
            "vtools-evaluate = vtools.cli:evaluate_cli"
81 82 83
        ]
    },
    classifiers=[
Sander Bollen's avatar
Sander Bollen committed
84
        "License :: OSI Approved :: MIT License",
Sander Bollen's avatar
Sander Bollen committed
85 86
        "Programming Language :: Python :: 3 :: Only",
        "Programming Language :: Python :: 3.6",
Sander Bollen's avatar
Sander Bollen committed
87
        "Programming Language :: Python :: 3.7",
88
        "Topic :: Scientific/Engineering :: Bio-Informatics"
89
    ],
90
    ext_modules=cython_extensions
Sander Bollen's avatar
Sander Bollen committed
91
)