Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

setup.py 4.1 KB

You have to be logged in to leave a comment. Sign In
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
  1. # Copyright 2014 Google Inc. All rights reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # We used setup.py from the requests library as reference:
  15. # https://github.com/requests/requests/blob/master/setup.py
  16. from __future__ import absolute_import
  17. import os
  18. import re
  19. import sys
  20. from codecs import open
  21. from setuptools import setup
  22. from setuptools.command.test import test as TestCommand
  23. here = os.path.abspath(os.path.dirname(__file__))
  24. if sys.argv[-1] == 'publish':
  25. os.system('python setup.py sdist bdist_wheel')
  26. os.system('twine upload dist/*')
  27. sys.exit()
  28. py_version = sys.version_info
  29. if py_version.major == 2 and py_version.minor == 7:
  30. install_requires = [
  31. 'numpy==1.16.6',
  32. 'scipy==1.2.2',
  33. 'pandas==0.24.2',
  34. 'statsmodels==0.9.0',
  35. 'matplotlib==2.2.4',
  36. 'jinja2>=2.10'
  37. ]
  38. tests_require = [
  39. 'pytest==4.6.5',
  40. 'pytest-cov',
  41. 'mock==3.0.5',
  42. 'tox'
  43. ]
  44. else:
  45. install_requires = [
  46. 'numpy',
  47. 'scipy',
  48. 'statsmodels>=0.11.0',
  49. 'matplotlib>=2.2.3',
  50. 'jinja2>=2.10'
  51. ]
  52. tests_require = [
  53. 'pytest',
  54. 'pytest-cov',
  55. 'mock',
  56. 'tox'
  57. ]
  58. setup_requires = [
  59. 'flake8',
  60. 'isort',
  61. 'pytest-runner'
  62. ]
  63. extras_require = {
  64. 'docs': [
  65. 'ipython',
  66. 'jupyter'
  67. ],
  68. 'testing': tests_require
  69. }
  70. packages = ['causalimpact']
  71. _version = {}
  72. _version_path = os.path.join(here, 'causalimpact', '__version__.py')
  73. with open(_version_path, 'r', 'utf-8') as f:
  74. exec(f.read(), _version)
  75. with open('README.md', 'r', 'utf-8') as f:
  76. readme = f.read()
  77. class PyTest(TestCommand):
  78. user_options = [
  79. ('coverage=', None, 'Runs coverage report.'),
  80. ('html=', None, 'Saves result to html report.'),
  81. ]
  82. def initialize_options(self):
  83. TestCommand.initialize_options(self)
  84. self.pytest_args = []
  85. self.coverage = False
  86. self.html = False
  87. def finalize_options(self):
  88. TestCommand.finalize_options(self)
  89. if self.coverage:
  90. self.pytest_args.extend(['--cov-config', '.coveragerc'])
  91. self.pytest_args.extend([
  92. '--cov', 'causalimpact', '--cov-report', 'term-missing'])
  93. if self.html:
  94. self.pytest_args.extend(['--cov-report', 'html'])
  95. self.pytest_args.extend(['-p', 'no:warnings'])
  96. def run_tests(self):
  97. import pytest
  98. errno = pytest.main(self.pytest_args)
  99. sys.exit(errno)
  100. setup(
  101. name='pycausalimpact',
  102. version=_version['__version__'],
  103. author='Willian Fuks',
  104. author_email='willian.fuks@gmail.com',
  105. url='https://github.com/dafiti/causalimpact',
  106. description= "Python version of Google's Causal Impact model",
  107. long_description=readme,
  108. long_description_content_type='text/markdown',
  109. packages=packages,
  110. include_package_data=True,
  111. install_requires=install_requires,
  112. tests_require=tests_require,
  113. setup_requires=setup_requires,
  114. extras_require=extras_require,
  115. license='MIT',
  116. classifiers=[
  117. 'Development Status :: 4 - Beta',
  118. 'Environment :: Console',
  119. 'Intended Audience :: Developers',
  120. 'Intended Audience :: Science/Research',
  121. 'License :: OSI Approved :: Apache Software License',
  122. 'Natural Language :: English',
  123. 'Operating System :: Unix',
  124. 'Programming Language :: Python :: 3.6',
  125. 'Programming Language :: Python :: 3.7',
  126. 'Programming Language :: Python :: 3.8',
  127. 'Programming Language :: Python :: Implementation :: CPython',
  128. 'Topic :: Scientific/Engineering',
  129. ],
  130. cmdclass={'test': PyTest},
  131. test_suite='tests'
  132. )
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...