From f5018ad525efc6bf0b17cbc67ec3fe97c1291793 Mon Sep 17 00:00:00 2001 From: Stephan Seitz <stephan.seitz@fau.de> Date: Wed, 7 Aug 2019 17:38:34 +0200 Subject: [PATCH] Add pystencils.autodiff --- pystencils/__init__.py | 10 ++++++++++ pystencils_tests/test_import_autodiff.py | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 pystencils_tests/test_import_autodiff.py diff --git a/pystencils/__init__.py b/pystencils/__init__.py index a7e21703..23f6e601 100644 --- a/pystencils/__init__.py +++ b/pystencils/__init__.py @@ -13,6 +13,16 @@ from .simp import AssignmentCollection from .slicing import make_slice from .sympyextensions import SymbolCreator +try: + import sys + import pystencils_autodiff + sys.modules['pystencils.autodiff'] = pystencils_autodiff +except Exception: + class autodiff: # NOQA + def __getattribute__(self): + raise NotImplementedError("pystencils_autodiff is not installed! Run 'pip install pystencils_autodiff'") + + __all__ = ['Field', 'FieldType', 'fields', 'TypedSymbol', 'make_slice', diff --git a/pystencils_tests/test_import_autodiff.py b/pystencils_tests/test_import_autodiff.py new file mode 100644 index 00000000..f4f57db4 --- /dev/null +++ b/pystencils_tests/test_import_autodiff.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# +# Copyright © 2019 Stephan Seitz <stephan.seitz@fau.de> +# +# Distributed under terms of the GPLv3 license. + +""" + +""" + + +def test_import_autodiff(): + import pystencils.autodiff + + +def main(): + test_import_autodiff() + + +if __name__ == '__main__': + main() -- GitLab