-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
194 lines (182 loc) · 6 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/usr/bin/env python
"""DataModels.
Dataclass Reimplementation with true inheritance (without decorators.)
See:
https://github.com/phenobarbital/DataModel
"""
import ast
from os import path
from Cython.Build import cythonize
from setuptools import Extension, find_packages, setup
def get_path(filename):
return path.join(path.dirname(path.abspath(__file__)), filename)
def readme():
with open(get_path('README.md'), encoding='utf-8') as rd:
return rd.read()
version = get_path('datamodel/version.py')
with open(version, 'r', encoding='utf-8') as meta:
t = compile(meta.read(), version, 'exec', ast.PyCF_ONLY_AST)
for node in (n for n in t.body if isinstance(n, ast.Assign)):
if len(node.targets) == 1:
name = node.targets[0]
if isinstance(name, ast.Name) and \
name.id in (
'__version__',
'__title__',
'__description__',
'__author__',
'__license__', '__author_email__'):
v = node.value
if name.id == '__version__':
__version__ = v.s
if name.id == '__title__':
__title__ = v.s
if name.id == '__description__':
__description__ = v.s
if name.id == '__license__':
__license__ = v.s
if name.id == '__author__':
__author__ = v.s
if name.id == '__author_email__':
__author_email__ = v.s
COMPILE_ARGS = ["-O2"]
extensions = [
Extension(
name='datamodel.fields',
sources=['datamodel/fields.pyx'],
extra_compile_args=COMPILE_ARGS,
language="c++"
),
Extension(
name='datamodel.converters',
sources=['datamodel/converters.pyx'],
extra_compile_args=COMPILE_ARGS,
language="c"
),
Extension(
name='datamodel.functions',
sources=['datamodel/functions.pyx'],
extra_compile_args=COMPILE_ARGS,
language="c++"
),
Extension(
name='datamodel.validation',
sources=['datamodel/validation.pyx'],
extra_compile_args=COMPILE_ARGS,
language="c++"
),
Extension(
name='datamodel.exceptions',
sources=['datamodel/exceptions.pyx'],
extra_compile_args=COMPILE_ARGS,
language="c"
),
Extension(
name='datamodel.types',
sources=['datamodel/types.pyx'],
extra_compile_args=COMPILE_ARGS,
language="c"
),
Extension(
name='datamodel.parsers.json',
sources=['datamodel/parsers/json.pyx'],
extra_compile_args=COMPILE_ARGS,
language="c++"
),
Extension(
name='datamodel.libs.mapping',
sources=['datamodel/libs/mapping.pyx'],
extra_compile_args=COMPILE_ARGS,
language="c"
),
Extension(
name='datamodel.typedefs.singleton',
sources=['datamodel/typedefs/singleton.pyx'],
extra_compile_args=COMPILE_ARGS,
language="c"
),
Extension(
name='datamodel.typedefs.types',
sources=['datamodel/typedefs/types.pyx'],
extra_compile_args=COMPILE_ARGS,
language="c"
),
]
setup(
name="python-datamodel",
version=__version__,
python_requires=">=3.9.13",
url="https://github.com/phenobarbital/python-datamodel",
description=__description__,
keywords=['asyncio', 'dataclass', 'dataclasses', 'data models'],
platforms=['any'],
long_description=readme(),
long_description_content_type='text/markdown',
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Topic :: Software Development :: Build Tools",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Framework :: AsyncIO",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Topic :: System :: Systems Administration",
"Topic :: Utilities",
"Environment :: Web Environment",
],
author=__author__,
author_email=__author_email__,
packages=find_packages(exclude=["contrib", "docs", "tests", "examples"]),
include_package_data=True,
package_data={
"datamodel.fields": ["*.pyx"],
"datamodel.converters": ["*.pyx"],
"datamodel.validation": ["*.pyx"],
"datamodel.exceptions": ["*.pxd", "*.pyx"],
"datamodel.functions": ["*.pxd", "*.pyx"],
"datamodel.libs.mapping": ["*.pxd", "*.pyx"],
"datamodel.typedefs.singleton": ["*.pxd", "*.pyx"],
"datamodel.typedefs.types": ["*.pxd", "*.pyx"],
"datamodel.parsers.json": ["*.pyx"],
},
license=__license__,
setup_requires=[
'setuptools==74.0.0',
'Cython==3.0.11',
'wheel==0.44.0'
],
install_requires=[
"numpy>=1.26.4",
"uvloop>=0.21.0",
"asyncio==3.4.3",
"faust-cchardet==2.1.19",
"ciso8601==2.3.2",
"objectpath==0.6.1",
"orjson==3.10.11",
'typing_extensions>=4.9.0',
"asyncpg>=0.29.0",
"python-dateutil>=2.8.2",
"python-slugify==8.0.1",
"pendulum==3.0.0"
],
tests_require=[
'pytest>=7.2.2',
'pytest-asyncio==0.23.2',
'pytest-xdist==3.5.0',
'pytest-assume==2.4.3'
],
test_suite='tests',
ext_modules=cythonize(extensions),
project_urls={ # Optional
"Source": "https://github.com/phenobarbital/datamodel",
"Funding": "https://paypal.me/phenobarbital",
"Say Thanks!": "https://saythanks.io/to/phenobarbital",
},
)