setup   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 114
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 83
dl 0
loc 114
rs 10
c 0
b 0
f 0
wmc 4

2 Functions

Rating   Name   Duplication   Size   Complexity  
A find_meta() 0 11 2
A read() 0 7 2
1
from codecs import open
2
from os import path
3
import re
4
# Always prefer setuptools over distutils
5
from setuptools import find_packages, setup
6
7
name = "sciapy"
8
meta_path = path.join(name, "__init__.py")
9
here = path.abspath(path.dirname(__file__))
10
11
extras_require = {
12
	"msis": ["nrlmsise00"],
13
	"tests": ["nrlmsise00", "pytest"],
14
}
15
extras_require["all"] = sorted(
16
	{v for req in extras_require.values() for v in req},
17
)
18
19
20
# Approach taken from
21
# https://packaging.python.org/guides/single-sourcing-package-version/
22
# and the `attrs` package https://www.attrs.org/
23
# https://github.com/python-attrs/attrs
24
def read(*parts):
25
	"""
26
	Builds an absolute path from *parts* and and return the contents of the
27
	resulting file.  Assumes UTF-8 encoding.
28
	"""
29
	with open(path.join(here, *parts), "rb", "utf-8") as f:
30
		return f.read()
31
32
33
def find_meta(meta, *path):
34
	"""
35
	Extracts __*meta*__ from *path* (can have multiple components)
36
	"""
37
	meta_file = read(*path)
38
	meta_match = re.search(
39
		r"^__{meta}__ = ['\"]([^'\"]*)['\"]".format(meta=meta), meta_file, re.M,
40
	)
41
	if not meta_match:
42
		raise RuntimeError("__{meta}__ string not found.".format(meta=meta))
43
	return meta_match.group(1)
44
45
46
# Get the long description from the README file
47
long_description = read("README.md")
48
version = find_meta("version", meta_path)
49
50
if __name__ == "__main__":
51
	setup(
52
		name=name,
53
		version=version,
54
		description='Python tools for (some) SCIAMACHY data',
55
		long_description=long_description,
56
		long_description_content_type="text/markdown",
57
		url='http://github.com/st-bender/sciapy',
58
		author='Stefan Bender',
59
		author_email='[email protected]',
60
		packages=find_packages(),
61
		scripts=['scripts/scia_binary_util.py',
62
			'scripts/scia_conv_hdf5_limb.py',
63
			'scripts/scia_daily_zonal_mean.py',
64
			'scripts/scia_post_process_l2.py'],
65
		package_data={
66
			'sciapy.level2': ['IGRF.tab', 'AACGM2005_80km_grid.nc'],
67
			'sciapy': ['data/indices/*.dat', 'data/indices/*.txt'],
68
		},
69
		install_requires=[
70
			'numpy>=1.13.0',
71
			'scipy>=0.17.0',
72
			'matplotlib>=2.2',
73
			'netCDF4',
74
			'h5py',
75
			'dask',
76
			'toolz',
77
			'astropy',
78
			'pandas',
79
			'xarray',
80
			'parse',
81
			'autograd',
82
			'celerite>=0.3.0',
83
			'corner',
84
			'george',
85
			'emcee',
86
			'regressproxy',
87
		],
88
		extras_require=extras_require,
89
		license='GPLv2',
90
		classifiers=[
91
			"Development Status :: 3 - Alpha",
92
			"Intended Audience :: Science/Research",
93
			"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
94
			"Programming Language :: Python",
95
			"Programming Language :: Python :: 2",
96
			"Programming Language :: Python :: 2.7",
97
			"Programming Language :: Python :: 3",
98
			"Programming Language :: Python :: 3.4",
99
			"Programming Language :: Python :: 3.5",
100
			"Programming Language :: Python :: 3.6",
101
			"Programming Language :: Python :: 3.7",
102
			"Programming Language :: Python :: 3.8",
103
		],
104
		entry_points={'console_scripts':
105
			[
106
				'scia_regress = sciapy.regress.__main__:main',
107
				'scia_post_process_l2 = sciapy.level2.post_process:main',
108
			]
109
		},
110
		options={
111
			"bdist_wheel": {"universal": True},
112
		},
113
		zip_safe=False,
114
	)
115