setup.py 2.65 KB
Newer Older
1
2
import os
import sys
Martin Bauer's avatar
Martin Bauer committed
3
import io
4
from setuptools import setup, find_packages
Martin Bauer's avatar
Martin Bauer committed
5
6
7
8
9
10
11
12
13
import distutils
from contextlib import redirect_stdout
from importlib import import_module
sys.path.insert(0, os.path.abspath('doc'))
from version_from_git import version_number_from_git


quick_tests = [
    'test_serial_scenarios.test_ldc_mrt',
Martin Bauer's avatar
Martin Bauer committed
14
    'test_serial_scenarios.test_channel_srt',
Martin Bauer's avatar
Martin Bauer committed
15
16
17
18
19
20
21
22
23
24
25
26
]


class SimpleTestRunner(distutils.cmd.Command):
    """A custom command to run selected tests"""

    description = 'run some quick tests'
    user_options = []

    @staticmethod
    def _run_tests_in_module(test):
        """Short test runner function - to work also if py.test is not installed."""
Martin Bauer's avatar
Martin Bauer committed
27
        print("at start")
Martin Bauer's avatar
Martin Bauer committed
28
29
30
        test = 'lbmpy_tests.' + test
        mod, function_name = test.rsplit('.', 1)
        if isinstance(mod, str):
Martin Bauer's avatar
Martin Bauer committed
31
            print("before import ", mod)
Martin Bauer's avatar
Martin Bauer committed
32
            mod = import_module(mod)
Martin Bauer's avatar
Martin Bauer committed
33
            print("after import ", mod)
Martin Bauer's avatar
Martin Bauer committed
34

Martin Bauer's avatar
Martin Bauer committed
35
        print("before getattr")
Martin Bauer's avatar
Martin Bauer committed
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
        func = getattr(mod, function_name)
        print("   -> %s in %s" % (function_name, mod.__name__))
        with redirect_stdout(io.StringIO()):
            func()

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        """Run command."""
        for test in quick_tests:
            self._run_tests_in_module(test)
51

52
53

setup(name='lbmpy',
Martin Bauer's avatar
Martin Bauer committed
54
      version=version_number_from_git(),
55
56
57
58
      description='Code Generation for Lattice Boltzmann Methods',
      author='Martin Bauer',
      license='AGPLv3',
      author_email='martin.bauer@fau.de',
59
      url='https://i10git.cs.fau.de/pycodegen/lbmpy/',
60
61
62
63
64
65
66
67
68
69
70
71
72
      packages=['lbmpy'] + ['lbmpy.' + s for s in find_packages('lbmpy')],
      install_requires=['pystencils'],
      classifiers=[
            'Development Status :: 4 - Beta',
            'Framework :: Jupyter',
            'Topic :: Software Development :: Code Generators',
            'Topic :: Scientific/Engineering :: Physics',
            'Intended Audience :: Developers',
            'Intended Audience :: Science/Research',
            'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
      ],
      python_requires=">=3.6",
      extras_require={
73
74
75
76
77
78
79
          'gpu': ['pycuda'],
          'opencl': ['pyopencl'],
          'alltrafos': ['islpy', 'py-cpuinfo'],
          'interactive': ['scipy', 'scikit-image', 'cython', 'matplotlib',
                          'ipy_table', 'imageio', 'jupyter', 'pyevtk'],
          'doc': ['sphinx', 'sphinx_rtd_theme', 'nbsphinx',
                  'sphinxcontrib-bibtex', 'sphinx_autodoc_typehints', 'pandoc'],
80
      },
Martin Bauer's avatar
Martin Bauer committed
81
82
83
      cmdclass={
          'quicktest': SimpleTestRunner
      }
84
      )