Skip to content

Remove the HAVE_PACKAGE logic and module import of extra dependency. #1160

@samuelgarcia

Description

@samuelgarcia

We have this kind of logic for many IOs

try:
    import sonpy
    HAVE_SONPY = True
except ImportError:
    HAVE_SONPY = False

class SomeClass
   def __init__(self):
        assert HAVE_SONPY, 'sonpy must be installed'

This make importing many modules for every import neo because all extra dependencies are at module level.
I propose to move to "import on demand" logic with this

class SomeClass
   def __init__(self):
        import sonpy

I propose to do this (it is easy) for the next release 0.11.0

@JuliaSprenger @apdavison : are you OK with this ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions