Passed
Push — master ( e02303...deabbd )
by Stefan
09:39
created

setup.read()   A

Complexity

Conditions 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
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
12
# Approach taken from
13
# https://packaging.python.org/guides/single-sourcing-package-version/
14
# and the `attrs` package https://www.attrs.org/
15
# https://github.com/python-attrs/attrs
16
def read(*parts):
17
	"""
18
	Builds an absolute path from *parts* and and return the contents of the
19
	resulting file.  Assumes UTF-8 encoding.
20
	"""
21
	with open(path.join(here, *parts), "rb", "utf-8") as f:
22
		return f.read()
23
24
25
def find_meta(meta, *path):
26
	"""
27
	Extracts __*meta*__ from *path* (can have multiple components)
28
	"""
29
	meta_file = read(*path)
30
	meta_match = re.search(
31
		r"^__{meta}__ = ['\"]([^'\"]*)['\"]".format(meta=meta), meta_file, re.M,
32
	)
33
	if not meta_match:
34
		raise RuntimeError("__{meta}__ string not found.".format(meta=meta))
35
	return meta_match.group(1)
36
37
38
# Get the long description from the README file
39
long_description = read("README.md")
40
version = find_meta("version", meta_path)
41
42
if __name__ == "__main__":
43
	setup(
44
		name=name,
45
		version=version,
46
		description='Python tools for (some) SCIAMACHY data',
47
		long_description=long_description,
48
		long_description_content_type="text/markdown",
49
		url='http://github.com/st-bender/sciapy',
50
		author='Stefan Bender',
51
		author_email='[email protected]',
52
		packages=find_packages(),
53
		scripts=['scripts/scia_binary_util.py',
54
			'scripts/scia_conv_hdf5_limb.py',
55
			'scripts/scia_daily_zonal_mean.py',
56
			'scripts/scia_post_process_l2.py'],
57
		package_data={'sciapy.level2': ['IGRF.tab',
58
				'AACGM2005_80km_grid.nc'],
59
			'sciapy': ['data/indices/*.dat', 'data/indices/*.txt']},
60
		install_requires=[
61
			'numpy>=1.13.0',
62
			'scipy>=0.17.0',
63
			'matplotlib>=2.2',
64
			'netCDF4',
65
			'h5py',
66
			'dask',
67
			'toolz',
68
			'astropy',
69
			'pandas',
70
			'xarray',
71
			'pysolar',
72
			'parse',
73
			'autograd',
74
			'celerite>=0.3.0',
75
			'corner',
76
			'george',
77
			'emcee',
78
			'nrlmsise00',
79
		],
80
		license='GPLv2',
81
		classifiers=[
82
			"Development Status :: 3 - Alpha",
83
			"Intended Audience :: Science/Research",
84
			"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
85
			"Programming Language :: Python",
86
			"Programming Language :: Python :: 2",
87
			"Programming Language :: Python :: 3",
88
		],
89
		entry_points={'console_scripts':
90
			['scia_regress = sciapy.regress.__main__:main']
91
		},
92
		zip_safe=False,
93
	)
94