-
Notifications
You must be signed in to change notification settings - Fork 215
/
setup.py
115 lines (102 loc) · 3.9 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
from codecs import open # pylint:disable=redefined-builtin
from os.path import dirname, join
import re
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
CLASSIFIERS = [
'Development Status :: 6 - Mature',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Operating System :: OS Independent',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Topic :: Software Development :: Libraries :: Python Modules',
]
class PyTest(TestCommand):
# pylint:disable=attribute-defined-outside-init
user_options = [(b'pytest-args=', b'a', b"Arguments to pass to py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = None
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# Do the import here, once the eggs are loaded.
# pylint:disable=import-outside-toplevel
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
def main():
base_dir = dirname(__file__)
install_requires = [
'attrs>=17.3.0',
'urllib3',
'requests>=2.4.3,<3',
'requests-toolbelt>=0.4.0',
'python-dateutil', # To be removed after dropping Python 3.6
]
redis_requires = ['redis>=2.10.3']
jwt_requires = ['pyjwt>=1.7.0', 'cryptography>=3']
coveralls_requires = ['coveralls']
dev_requires = ['tox<=3.28.0']
gh_requires = ['tox-gh-actions']
test_requires = [
'bottle',
'jsonpatch>1.14',
'sqlalchemy<1.4.0',
# pytest 8.0.0 is not compatible, so we need to use the latest version of pytest 7.x
'pytest<8.0.0',
'pytest-timeout<3.0.0',
'pytest-cov<5.0.0',
'pytest-lazy-fixture<1.0.0',
'pytz',
'urllib3<2'
]
extra_requires = {
'jwt': jwt_requires,
'redis': redis_requires,
'coveralls': coveralls_requires + dev_requires,
'dev': dev_requires,
'gh': gh_requires + dev_requires,
'test': test_requires,
}
with open('boxsdk/version.py', encoding='utf-8') as config_py:
version = re.search(r'^\s*__version__\s*=\s*[\'"]([^\'"]*)[\'"]', config_py.read(), re.MULTILINE).group(1)
setup(
name='boxsdk',
version=version,
description='Official Box Python SDK',
long_description_content_type="text/markdown",
long_description=open(join(base_dir, 'README.md'), encoding='utf-8').read(), # pylint:disable=consider-using-with
author='Box',
author_email='oss@box.com',
url='https://github.com/box/box-python-sdk',
project_urls={
'Changelog': 'https://github.com/box/box-python-sdk/blob/main/CHANGELOG.md',
},
packages=find_packages(exclude=['demo', 'docs', 'test', 'test*', '*test', '*test*']),
install_requires=install_requires,
extras_require=extra_requires,
tests_require=test_requires,
cmdclass={'test': PyTest},
classifiers=CLASSIFIERS,
keywords='box oauth2 sdk',
license='Apache Software License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0',
package_data={'boxsdk': ['py.typed']},
)
if __name__ == '__main__':
main()