calculix / ccx2paraview

CalculiX to Paraview converter (frd to vtk/vtu). Makes possible to view and postprocess CalculiX analysis results in Paraview. Generates Mises and Principal components for stress and strain tensors.
GNU General Public License v3.0
91 stars 18 forks source link

Empty `__init__.py`: Need `from ccx2paraview import ccx2paraview` instead of `import ccx2paraview` #31

Open pstelzig opened 1 year ago

pstelzig commented 1 year ago

Problem description

When installing ccx2paraview under Ubuntu 22.04 using pip like

pip3 install --user ccx2paraview

pip will create a file ~/.local/lib/python3.10/site-packages/ccx2paraview/__init__.py that turns ccx2paraview into a Python module.

The __init__.py is empty, and therefore the module ccx2paraview -- when importing in a Python file -- has no members except again the submodule ccx2paraview (because the folder ~/.local/lib/python3.10/site-packages/ccx2paraview contains the file ccx2paraview.py).

Hence, in order to access the module elements from ccx2paraview one has to state from ccx2paraview import ccx2paraview and then all elements are again available like e.g. ccx2paraview.Converter

Desired behavior

After import ccx2paraview in a Python file have the relevant members of ccx2paraview available like ccx2paraview.Converter etc.

Potential fix

Include a file __init__.py into the ccx2paraview repository with content like

from .ccx2paraview import *

to import everything from the ccx2paraview.py or

from .ccx2paraview import Converter
from .ccx2paraview import <whatever a user needs>

I modified the empty __init__.py like this and it worked.