Giter VIP home page Giter VIP logo

Comments (3)

bastibe avatar bastibe commented on July 19, 2024

I read that article, too. The article is based on the idea that one uses cffi.verify(), though. This will invoke a compiler and do all kinds of interesting magics.

We don't do all that, though. We merely cffi.dlopen(), which needs no compiler and sidesteps most of the issues that make distribution difficult. To be honest, I have not yet understood why one would ever use cffi.verify() instead of cffi.dlopen().

So, in our case, and if I understand this correctly, we only require the loaded library to be present when cffi.dlopen() is called. Since the library is necessarily packaged outside of Python and pip, I don't see how we could improve our install experience within the confines of pip. Pip wheels, and the conda package manager might be interesting targets in addition to Windows bdists, but that has little to do with CFFI or setup.py.

from python-soundfile.

mgeier avatar mgeier commented on July 19, 2024

If I understand it correctly, when using verify(), the compiler actually checks the definitions given in cdef() and possible errors would show up during compilation. In our case dlopen() opens the library and any errors will happen at runtime, probably leading to crashes.
Therefore, verify() is safer, but it is also much harder to handle (as the blog post shows).
I've never had any problems regarding dlopen(), please tell us if you do!

The compilation with verify() might also yield a small performance gain, but as we make only very few calls to the library, this shouldn't be noticeable. I guess this is only relevant if library calls happen in tight Python loops, but that's probably a bad idea anyway.

@davidblewett: did you experience any troubles with installing/using PySound{File|Card}?
It would be great if you could test this an report back if everything works on your system.
What OS are you using?
If you're using Windows, it would be great if you could also test the alternative installation mechanism suggested in #88.

At no point in installing, using or developing PySound{File|Card} a compiler should ever be needed (assuming you have the dependencies already installed!).

from python-soundfile.

davidblewett avatar davidblewett commented on July 19, 2024

It has been awhile since I've been able to play with these 2 projects. I didn't realize the nuance of verify vs. dlopen, so this can be closed. I think I've gotten these 2 projects confused with some projects where I did see errors with cffi trying to compile something after installation time (and failing).

Sorry for the noise!

from python-soundfile.

Related Issues (20)

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.