Skip to content

How the neetbox.integrations are designedΒ #20

@visualDust

Description

@visualDust

The problem is, as we want a not-dependency-intensive neetbox, we are trying to remove codes with heavy dependencies from core functions. To be specific, in order to avoid installing package 'thop'(which depends on torch) for non-torch users, we have removed import torch from the headings of each python file into the line where the packages are required to overcome the import errors for most of the packages. For example, in neetbox.torch.profile:

from thop import profile as _profile
def profile():
    case 1: ... return
    case 2: ... return
    case that needs thop: ... return

was changed to:

def profile():
    case 1: ... return
    case 2: ... return
    case that needs thop: 
            assert pkg.is_installed('thop')
            from thop import profile as _profile
            ... 
            return

It was simple until we added neetbox.integrations. I'm not a pro for Python things, but I found it much more clear if we move things related to third parties into neetbox.integrations. So what does the neetbox.integrations stand for? In general, neetbox.integrations contains plugins for the original neetbox codes which empowers neetbox with third-party-compbilities.

I first mentioned the idea in #19 , in which I suggest that we should move 'nvidia-smi' and 'conda' command line getters out of neetbox.utils. However, since I'm a little confused about how to effectively add plugins into python class, I'm not sure what to do next to form the general framework for neetbox.integrations. Anyway, I think I need some help. Further discussions and methods are welcomed and appreciated.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions