Closed cbetta closed 8 years ago
libmagic is the mimemagic binding, its required for guessing mime types, the ruby gem also depends on the same library.
@danielknell the ruby gem relies on the mimemagic
gem but it does not rely on any other dependencies (including libmagic).
Could you have a look and see if there's any viable option that does not use libmagic
? And if not, can we add a note to the docs pointing out this dependency?
@danielknell @cbetta Guys,
It might be overkill to use a third-party MIME detection library for the general case. Can we assume that the developer knows the media type he's providing?
Also, for those devs who don't know what their media type is (e.g. with those cryptic ones like application/vnd.openxmlformats-officedocument.presentationml.presentation), we have a handy extension-to-media-type conversion tool at https://rest.interfax.net/outbound/help/mediatype.
And for those who don't even know their file extensions, e.g. if they're receiving a buffer, we might point them to a third-party library.
@eyalnevo
@danielknell @if-adam I am trying to find the right balance between:
I'd be happy to consider any option, I just want to make sure @danielknell has considered all.
filename based mime lookup seems fragile enough to be a non starter, and mime types tend to be poorly understood from what i have seen amongst more junior developers, so making it implicit has a bunch of benefits, but the library needs to be installed manually on windows though (its there by default on *nix and in homebrew for mac), which is also something to balance...
https://github.com/ahupp/python-magic there are some straightforward instructions to get it working on the projects homepage.
iin time should a pure python alternative emerge it would be worth using that, as it stands the options seem to be:
if no changes are made then the docs probably need an extra paragraph in the installation field to inform people of the dependency.
@danielknell agreed that just using filenames is a no-go. So the only 2 options are:
I'd like to make sure we searched for a library for options 1 (I assume you did now and it's not there). Therefore happy to go with option 2.
Please go ahead and add the extra install instructions and notes.
experimented with puremagic, a pure python alternative to libmagic, results were disappointing...
Ah that's sad to hear.
@danielknell this pip library relies on
libmagic
it seems. I'm trying to decide if this is wise? What is this for? Can we work without it? Is it easy to install on every OS (including windows)?If we do need it we should look at making this dependency clear in the docs.