1#!/usr/bin/env python 2# 3# (C) Copyright 2017- ECMWF. 4# 5# This software is licensed under the terms of the Apache Licence Version 2.0 6# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 7# 8# In applying this licence, ECMWF does not waive the privileges and immunities 9# granted to it by virtue of its status as an intergovernmental organisation nor 10# does it submit to any jurisdiction. 11# 12 13import io 14import os 15import re 16import sys 17 18import setuptools 19 20 21def read(path): 22 file_path = os.path.join(os.path.dirname(__file__), *path.split("/")) 23 return io.open(file_path, encoding="utf-8").read() 24 25 26# single-sourcing the package version using method 1 of: 27# https://packaging.python.org/guides/single-sourcing-package-version/ 28def parse_version_from(path): 29 version_pattern = ( 30 r"^__version__ = [\"\'](.*)[\"\']" # More permissive regex pattern 31 ) 32 version_file = read(path) 33 version_match = re.search(version_pattern, version_file, re.M) 34 if version_match is None or len(version_match.groups()) > 1: 35 raise ValueError("couldn't parse version") 36 return version_match.group(1) 37 38 39install_requires = ["numpy"] 40if sys.version_info < (3, 7): 41 install_requires = ["numpy<1.20"] 42 43install_requires += ["attrs", "cffi", "findlibs"] 44 45setuptools.setup( 46 name="eccodes", 47 version=parse_version_from("gribapi/bindings.py"), 48 description="Python interface to the ecCodes GRIB and BUFR decoder/encoder", 49 long_description=read("README.rst") + read("CHANGELOG.rst"), 50 author="European Centre for Medium-Range Weather Forecasts (ECMWF)", 51 author_email="software.support@ecmwf.int", 52 license="Apache License Version 2.0", 53 url="https://github.com/ecmwf/eccodes-python", 54 packages=setuptools.find_packages(), 55 include_package_data=True, 56 install_requires=install_requires, 57 tests_require=[ 58 "pytest", 59 "pytest-cov", 60 "pytest-flakes", 61 ], 62 test_suite="tests", 63 zip_safe=True, 64 keywords="ecCodes GRIB BUFR", 65 classifiers=[ 66 "Development Status :: 4 - Beta", 67 "Intended Audience :: Developers", 68 "License :: OSI Approved :: Apache Software License", 69 "Programming Language :: Python :: 3.6", 70 "Programming Language :: Python :: 3.7", 71 "Programming Language :: Python :: 3.8", 72 "Programming Language :: Python :: 3.9", 73 "Programming Language :: Python :: Implementation :: CPython", 74 "Programming Language :: Python :: Implementation :: PyPy", 75 "Operating System :: OS Independent", 76 ], 77) 78