Passed
Push — master ( 5ab10b...e01c5d )
by Jisk
05:31
created

setup.BuildPyCommand.run()   A

Complexity

Conditions 1

Size

Total Lines 10
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 10
rs 9.95
c 0
b 0
f 0
cc 1
nop 1
1
import setuptools
2
import setuptools.command.build_py
3
import os
4
import tensorflow as tf
5
import subprocess
6
import pkg_resources
7
8
__version__ = None
9
10
with open("README.md", "r") as fh:
11
    long_description = fh.read()
12
13
with open(os.path.join(os.path.dirname(__file__), 'e2edutch/__version__.py')) as versionpy:
14
    exec(versionpy.read())
15
16
17
class BuildPyCommand(setuptools.command.build_py.build_py):
18
    """Build the tensorflow kernels, and proceed with default build."""
19
20
    def run(self):
21
        args = ["g++", "-std=c++11", "-shared", "-fPIC", "-O2"]
22
        args += tf.sysconfig.get_compile_flags() + tf.sysconfig.get_link_flags()
23
        args += [
24
                pkg_resources.resource_filename("e2edutch", "coref_kernels.cc"),
25
                "-o",
26
                pkg_resources.resource_filename("e2edutch", "coref_kernels.so")
27
                ]
28
        subprocess.check_call(args)
29
        setuptools.command.build_py.build_py.run(self)
30
31
32
setuptools.setup(
33
    name="e2e-Dutch",
34
    version=__version__,
35
    author="Dafne van Kuppevelt",
36
    author_email="[email protected]",
37
    description="Coreference resolution with e2e for Dutch",
38
    long_description=long_description,
39
    long_description_content_type="text/markdown",
40
    url="https://github.com/Filter-Bubble/e2e-Dutch",
41
    packages=setuptools.find_packages(),
42
    classifiers=[
43
        "Programming Language :: Python :: 3",
44
        "Development Status :: 4 - Beta",
45
        "Environment :: Console",
46
        "License :: OSI Approved :: Apache Software License",
47
        "Operating System :: OS Independent",
48
    ],
49
    include_package_data=True,
50
    package_data={'e2edutch': ['cfg/*.conf']},
51
    cmdclass={
52
        "build_py": BuildPyCommand
53
    },
54
    test_suite='test',
55
    python_requires='>=3.6',
56
    install_requires=[
57
        "tensorflow>=2.0.0",
58
        "h5py",
59
        "nltk",
60
        "pyhocon",
61
        "scipy",
62
        "scikit-learn",
63
        "torch",
64
        "transformers"
65
    ],
66
    tests_require=[
67
        'pytest',
68
        'pytest-cov',
69
        'pycodestyle',
70
    ],
71
)
72