setup.py 2.09 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 56

setup(
    name="vtools",
57
    version="0.0.1",
58 59 60 61
    description="Various tools operating over VCF files",
    author="Sander Bollen",
    author_email="a.h.b.bollen@lumc.nl",
    license="MIT",
Sander Bollen's avatar
Sander Bollen committed
62
    packages=find_packages(),
63 64 65 66
    install_requires=[
        "click",
        "cyvcf2",
        "numpy",
67 68
        "cython",
        "tqdm"
69 70 71 72 73
    ],
    entry_points={
        "console_scripts": [
            "vtools-filter = vtools.cli:filter_cli",
            "vtools-stats = vtools.cli:stats_cli",
Sander Bollen's avatar
Sander Bollen committed
74 75
            "vtools-gcoverage = vtools.cli:gcoverage_cli",
            "vtools-evaluate = vtools.cli:evaluate_cli"
76 77 78 79
        ]
    },
    classifiers=[
        "Topic :: Scientific/Engineering :: Bio-Informatics"
80
    ],
81
    ext_modules=cython_extensions
Sander Bollen's avatar
Sander Bollen committed
82
)