forked from pydantic/pydantic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
105 lines (93 loc) · 3.65 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
import os
import re
import sys
from importlib.machinery import SourceFileLoader
from pathlib import Path
from setuptools import setup
class ReplaceLinks:
def __init__(self):
self.links = set()
def replace_issues(self, m):
id = m.group(1)
self.links.add(f'.. _#{id}: https://github.com/samuelcolvin/pydantic/issues/{id}')
return f'`#{id}`_'
def replace_users(self, m):
name = m.group(2)
self.links.add(f'.. _@{name}: https://github.com/{name}')
return f'{m.group(1)}`@{name}`_'
def extra(self):
return '\n\n' + '\n'.join(sorted(self.links)) + '\n'
description = 'Data validation and settings management using python 3.6 type hinting'
THIS_DIR = Path(__file__).resolve().parent
try:
history = (THIS_DIR / 'HISTORY.md').read_text()
history = re.sub(r'#(\d+)', r'[#\1](https://github.com/samuelcolvin/pydantic/issues/\1)', history)
history = re.sub(r'( +)@([\w\-]+)', r'\1[@\2](https://github.com/\2)', history, flags=re.I)
history = re.sub('@@', '@', history)
long_description = (THIS_DIR / 'README.md').read_text() + '\n\n' + history
except FileNotFoundError:
long_description = description + '.\n\nSee https://pydantic-docs.helpmanual.io/ for documentation.'
# avoid loading the package before requirements are installed:
version = SourceFileLoader('version', 'pydantic/version.py').load_module()
ext_modules = None
if not any(arg in sys.argv for arg in ['clean', 'check']) and 'SKIP_CYTHON' not in os.environ:
try:
from Cython.Build import cythonize
except ImportError:
pass
else:
# For cython test coverage install with `make build-cython-trace`
compiler_directives = {}
if 'CYTHON_TRACE' in sys.argv:
compiler_directives['linetrace'] = True
os.environ['CFLAGS'] = '-O3'
ext_modules = cythonize(
'pydantic/*.py',
exclude=['pydantic/generics.py'],
nthreads=int(os.getenv('CYTHON_NTHREADS', 0)),
language_level=3,
compiler_directives=compiler_directives,
)
setup(
name='pydantic',
version=str(version.VERSION),
description=description,
long_description=long_description,
long_description_content_type='text/markdown',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Operating System :: Unix',
'Operating System :: POSIX :: Linux',
'Environment :: Console',
'Environment :: MacOS X',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Internet',
],
author='Samuel Colvin',
author_email='s@muelcolvin.com',
url='https://github.com/samuelcolvin/pydantic',
license='MIT',
packages=['pydantic'],
package_data={'pydantic': ['py.typed']},
python_requires='>=3.6',
zip_safe=False, # https://mypy.readthedocs.io/en/latest/installed_packages.html
install_requires=[
'dataclasses>=0.6;python_version<"3.7"'
],
extras_require={
'email': ['email-validator>=1.0.3'],
'typing_extensions': ['typing-extensions>=3.7.2'],
'dotenv': ['python-dotenv>=0.10.4'],
},
ext_modules=ext_modules,
)