[File] Python bindings to libmagic

Christos Zoulas christos at zoulas.com
Sun Jul 24 23:55:47 UTC 2022

Applied, thanks. I am not sure how to include the pyi file in the package. Will take a look when I have some free time...


> On Jul 19, 2022, at 4:48 AM, Hoël Bézier <hoelbezier at leanco.fr> wrote:
> Signed PGP part
> Hi, this is a follow-up to my previous email.
>> So it seems to me that the `open` routine always returns a Magic object and cannot fail. The `_open` routine on the other hand might fail, and thus the returned Magic object would have a _magic_t attribute set to None.
>> If I understood things properly, maybe the documentation would need to be updated so that users may handle failures properly.
> I figured it would be best to update the code to reflect the documentation, so I’ve attached a patch that should do exactly this. I’ve also added a bit of error handling for the detect_from_* routines, using a magic.error exception.
> Since I’m also trying to type my code whenever possible, the patch includes a brand new magic.pyi file which contains type annotations for all public routines and constants of the module. However, as I have no experience with python packaging, I’m not sure this file would be included by the setup.py.
> Feedback is of course welcome. :)
> Hoël
> <libmagic.patch>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20220724/3ea2dd05/attachment.asc>

More information about the File mailing list