-
Notifications
You must be signed in to change notification settings - Fork 27
Comments
Add libmagic1 to Dockerfile dependencies#310
Add libmagic1 to Dockerfile dependencies #310nijel wants to merge 1 commit intopre-commit-ci:main from
Conversation
This allows us to use language bindings such as python-magic inside pre-commit checks.
nijel
commented
Oct 7, 2025
Discovered via fsfe/reuse-tool#1244, it falls back to less performant and worse working detection using other libraries.
carmenbianca
commented
Oct 7, 2025
You could also consider installing file instead of libmagic1. file has a dependency on libmagic1 and is a fairly useful and standard Unix-y util.
Lets avoid it for now. We run pre-commit directly as well and the pre-commit.ci is needed to apply formatting, what reuse does not do. See fsfe/reuse-tool#1244 and pre-commit-ci/runner-image#310
asottile
commented
Oct 16, 2025
could you comment on the size this adds to the image? would make it easier to understand whether this is a good idea or not
I'm surprised python-magic doesn't ship a wheel with it bundled (as is typical for manylinux and friends)
nijel
commented
Oct 16, 2025
The library itself is 200 kB, but it pulls the detection data which is 7 MB. That might me also the reason why it's not shipped in the wheel...
There is an unmerged PR against python-magic which does just that: ahupp/python-magic#294
ddelange
commented
Oct 20, 2025
The library itself is 200 kB, but it pulls the detection data which is 7 MB. That might me also the reason why it's not shipped in the wheel...
check out the compressed sizes (including the mime database and the libmagic binary) here. uncompressed, magic.mgc is 10.4MB and libmagic.so.1 (manylinux_x86_64) is 896kB.
asottile
commented
Oct 24, 2025
so should I merge this or should the other thing use python-magic-standalone instead?
It looks like my PR wont get merged any time soon, which is why python-magic-standalone was created in the first place (see the end of the thread). That's ment to be a temporary solution until my PR gets merged.
This allows us to use language bindings such as python-magic inside pre-commit checks.