-
Notifications
You must be signed in to change notification settings - Fork 986
/
setup.py
63 lines (53 loc) · 1.82 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import setuptools
import os
from distutils.extension import Extension
import numpy as np
def is_source_release(path):
return os.path.exists(os.path.join(path, "PKG-INFO"))
def setup_package():
root = os.path.abspath(os.path.dirname(__file__))
long_description = "pkuseg-python"
extensions = [
Extension(
"pkuseg.inference",
["pkuseg/inference.pyx"],
include_dirs=[np.get_include()],
language="c++"
),
Extension(
"pkuseg.feature_extractor",
["pkuseg/feature_extractor.pyx"],
include_dirs=[np.get_include()],
),
Extension(
"pkuseg.postag.feature_extractor",
["pkuseg/postag/feature_extractor.pyx"],
include_dirs=[np.get_include()],
),
]
if not is_source_release(root):
from Cython.Build import cythonize
extensions = cythonize(extensions, annotate=True)
setuptools.setup(
name="pkuseg",
version="0.0.25",
author="Lanco",
author_email="[email protected]",
description="A small package for Chinese word segmentation",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/lancopku/pkuseg-python",
packages=setuptools.find_packages(),
package_data={"": ["*.txt*", "*.pkl", "*.npz", "*.pyx", "*.pxd"]},
classifiers=[
"Programming Language :: Python :: 3",
"License :: Other/Proprietary License",
"Operating System :: OS Independent",
],
install_requires=["cython", "numpy>=1.16.0"],
setup_requires=["cython", "numpy>=1.16.0"],
ext_modules=extensions,
zip_safe=False,
)
if __name__ == "__main__":
setup_package()