PyTrilinos: Implement new infrastructure for nested sub-packages
Created by: wfspotz
@trilinos/pytrilinos
Expectations
All packages that have nested sub-packages should use the same infrastructure, and we need to avoid swig-generated base classes that include the __init__
"module", because this is not valid python syntax. Also, there are import issues that are different for Python 2 and Python 3, and the resulting solution should work for both.
Current Behavior
Import issues keep cropping up, and some "solutions" create base classes with __init__
in the module path.
Possible Solution
-
Use the relatively new
moduleimport
option for the%module
SWIG directive to better control importing required modules. -
Change
__init__.py
modules from swig-generated, which includes a compiled extension, to pure python. Use__init__.py.in
files to generate these files inpackages/PyTrilinos/src/PyTrilinos
-
Change
Package.__init__.i
toPackage.i
and have it generate a python filePackage/Base.py
which is imported by the__init__.py
file from the previous bullet. Useglobals().update(Base.__dict__)
to create references from everything inBase
to the__init__.py
file. Certain special variables, such as__file__
will need to be preserved.