setup.py 2.26 KB
Newer Older
#!/usr/bin/env python
# coding=utf-8
"""Installation script for EarthDiagnostics package"""

from os import path
import sys
from setuptools import setup, Command, find_packages

here = path.abspath(path.dirname(__file__))

# Get the version number from the relevant file
with open(path.join(here, 'VERSION')) as f:
    version = f.read().strip()

class RunTests(Command):
    """Class to run tests and generate reports."""

Javier Vegas-Regidor's avatar
Javier Vegas-Regidor committed
    user_options = []

    def initialize_options(self):
        """Do nothing."""

    def finalize_options(self):
        """Do nothing."""

    def run(self):
        """Run tests and generate a coverage report."""
        import pytest

        version = sys.version_info[0]
        report_dir = 'test/report/python{}'.format(version)
        args = [
            'test',
            'earthdiagnostics',  # for doctests
            '--ignore=test/report',
            '--doctest-modules',
Javier Vegas-Regidor's avatar
Javier Vegas-Regidor committed
            '--cov=earthdiagnostics',
            '--cov-report=term',
            '--cov-report=html:{}/coverage_html'.format(report_dir),
            '--cov-report=xml:{}/coverage.xml'.format(report_dir),
            '--junit-xml={}/report.xml'.format(report_dir),
            '--html={}/report.html'.format(report_dir),
        ]
        errno = pytest.main(args)
        sys.exit(errno)

setup(
    name='earthdiagnostics',
    license='GNU GPL v3',
    platforms=['GNU/Linux Debian'],
    version=version,
    description='EarthDiagnostics',
    author='BSC-CNS Earth Sciences Department',
    author_email='javier.vegas@bsc.es',
    url='http://www.bsc.es/projects/earthsciences/autosubmit/',
    keywords=['climate', 'weather', 'diagnostic'],
    setup_requires=['pyproj'],
    install_requires=[
        'bscearth.utils',
        'cdo>=1.3.4',
        'cfgrib',
        'coverage',
        'dask[array]',
        'exrex',
        'futures',
        'mock',
        'netCDF4',
        'nco>=0.0.3',
        'numba',
        'numpy',
        'psutil',
        'openpyxl',
        'pycodestyle',
        'pytest',
        'pytest-cov',
        'pytest-html',
        'scitools-iris>=2.2',
        'six',
        'xxhash',
Javier Vegas-Regidor's avatar
Javier Vegas-Regidor committed
        'diagonals'
    packages=find_packages(),
    include_package_data=True,
    scripts=['bin/earthdiags'],
    cmdclass={
        'test': RunTests,