Giter Site home page Giter Site logo

Comments (2)

walchko avatar walchko commented on September 28, 2024 1

I haven't figured out a good way to solve this either in anything I have written. I generally tend to let it fail like this:

try:
    import open3d as o3d
except ImportError:
    print("Please do 'pip install open3d' to use this feature")
    raise

I don't totally like this, but haven't found another clean way to do it. It alerts the user to the missing library.

The next issue you have is the from .visualizer import visualize will issue an error based on what I just suggested. So the answer is to remove the line from __init__.py. However now that forces the user to do something like from tinyik.visualize import Visualizer, which is different than the rest of the other workflow in your module. But this is typically what I have done.

Sorry for the rambling, but I don't have a good answer that I personally like. I think python didn't think through this very well and forces you to do a bunch of try/except statements which makes the code overly complex in places.

from tinyik.

lanius avatar lanius commented on September 28, 2024

Thanks you so much! I apologize for confusing you with the error.

The visualizer is not a core feature of tinyik. In order to keep the library as "tiny" as possible, it is set to extra.

If you install tinyik with no extra, open3d will not be installed and you will get the import error in the following facade module, so I'm bypassing the check to avoid it.

from .visualizer import visualize

That said, I think you're right that this will confuse users who use the library exploratively. Is there any good way to solve this? Shouldn't we be using extra for this purpose in the first place?

from tinyik.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.