forked from treble-ai/pyduckling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
85 lines (69 loc) · 2.26 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Treble.ai
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Setup script for PyDuckling."""
# yapf: disable
# Standard library imports
import re
import os
# Third party imports
import toml
from setuptools import find_packages, setup
from setuptools_rust import Binding, RustExtension
HERE = os.path.abspath(os.path.dirname(__file__))
AUTHOR_REGEX = re.compile(r'(.*) <(.*@.*[.].*)>')
def get_metadata():
"""Get version from text file and avoids importing the module."""
with open(os.path.join(HERE, 'Cargo.toml'), 'r') as f:
data = toml.load(f)
# version = data['package']['version']
return data['package']
def get_description():
"""Get long description."""
with open(os.path.join(HERE, 'README.md'), 'r') as f:
data = f.read()
return data
def get_author(metadata):
author = metadata['authors'][0]
match = AUTHOR_REGEX.match(author)
name = match.group(1)
email = match.group(2)
return name, email
REQUIREMENTS = [
'pendulum'
]
metadata = get_metadata()
name, email = get_author(metadata)
setup(
name=metadata['name'],
version=metadata['version'],
license=metadata['license'],
description=metadata['description'],
long_description=get_description(),
long_description_content_type='text/markdown',
author=name,
author_email=email,
url=metadata['repository'],
keywords=metadata['keywords'],
packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
rust_extensions=[RustExtension("duckling.duckling", binding=Binding.PyO3)],
package_data={
'duckling': ['*.dll', '*.dylib', '*.so']
},
zip_safe=False,
install_requires=REQUIREMENTS,
include_package_data=True,
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'
],
)