setup.py 2.03 KB
Newer Older
1 2 3 4 5
import subprocess

from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand

6
FLAKE8_COMMAND = ['./venv/bin/flake8', '--ignore=E501', 'tg263', 'tests']
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
MYPY_COMMAND = ['./venv/bin/mypy', 'tg263']
TESTS_COMMAND = ['./venv/bin/python', '-m', 'unittest', 'discover', '-s', './tests/']


def _run_command(command: str) -> None:
    try:
        subprocess.check_call(command)

    except subprocess.CalledProcessError as error:
        print('Command failed with exit code', error.returncode)
        exit(error.returncode)


class Tests(TestCommand):
    description = 'run unit tests'
    user_options = []

    def run_tests(self):
        _run_command(TESTS_COMMAND)


class LintTests(TestCommand):
    description = 'run linters'
    user_options = []

    def run_tests(self):
33
        _run_command(FLAKE8_COMMAND)
34 35 36 37 38 39 40 41 42
        _run_command(MYPY_COMMAND)


class AllTests(TestCommand):
    description = 'run tests and linters'
    user_options = []

    def run_tests(self):
        _run_command(TESTS_COMMAND)
43
        _run_command(FLAKE8_COMMAND)
44 45 46
        _run_command(MYPY_COMMAND)


47
with open('./README.md') as file_handler:
48 49 50 51
    long_description = file_handler.read()

setup(
    name='tg263',
Gabriel Couture's avatar
Gabriel Couture committed
52
    version='0.2.0',
53 54 55 56
    packages=find_packages(),
    url='https://gitlab.physmed.chudequebec.ca/gacou54/tg263',
    license='MIT',
    author='Gabriel Couture',
57
    author_email='gacou54@gmail.com',
58
    description='TG263 implementation',
59 60
    long_description=long_description,
    long_description_content_type='text/markdown',
61 62 63 64 65
    cmdclass={
        'lint': LintTests,
        'unit': Tests,
        'test': AllTests
    },
66 67 68 69 70 71 72
    classifiers=[
        'Development Status :: 3 - Alpha',
        'Intended Audience :: Healthcare Industry',
        'Intended Audience :: Science/Research',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 3 :: Only',
Gabriel Couture's avatar
Gabriel Couture committed
73 74
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
75
    ]
76
)