Skip to content

Issues with lifting of classes and functions into pyttb namespace, documentation, etc. #417

@tgkolda

Description

@tgkolda

I have been very confused about the qualification of names of classes and functions within PyTTB until I found these (sneaky) lines of code in the init file:

pyttb/pyttb/__init__.py

Lines 14 to 32 in 6279f88

from pyttb.cp_als import cp_als
from pyttb.cp_apr import cp_apr
from pyttb.export_data import export_data
from pyttb.gcp_opt import gcp_opt
from pyttb.hosvd import hosvd
from pyttb.import_data import import_data
from pyttb.khatrirao import khatrirao
from pyttb.ktensor import ktensor
from pyttb.matlab import matlab_support
from pyttb.sptenmat import sptenmat
from pyttb.sptensor import sptendiag, sptenrand, sptensor
from pyttb.sptensor3 import sptensor3
from pyttb.sumtensor import sumtensor
from pyttb.symktensor import symktensor
from pyttb.symtensor import symtensor
from pyttb.tenmat import tenmat
from pyttb.tensor import tendiag, teneye, tenones, tenrand, tensor, tenzeros
from pyttb.ttensor import ttensor
from pyttb.tucker_als import tucker_als

The reason I was confused is that the sphinx documentation wants to include the module names in the documentation. However, using the module names will cause PyTTB to break. Observe:

Image

This is really confusing!!

I could envision a few possible fixes. I'm guessing the error that I'm having is that by importing tensor directly as a class it no longer makes sense to reference it as a module, so one recommendation is that the modules be named differently than the classes. If they are to be hidden, then maybe an underscore or something.

Then, in the documentation, we need to be ultra careful about the way that the methods are documented. Calling automodule automatically inserts the module name. So, we need to instead use autoclass and autofunction directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions