Skip to content

Conversation

@nijel
Copy link
Contributor

@nijel nijel commented Oct 7, 2025

This allows us to use language bindings such as python-magic inside pre-commit checks.

This allows us to use language bindings such as python-magic inside pre-commit checks.
@nijel
Copy link
Contributor Author

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
Copy link

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.

nijel added a commit to WeblateOrg/meta that referenced this pull request Oct 8, 2025
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
Copy link
Member

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
Copy link
Contributor Author

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...

@carmenbianca
Copy link

carmenbianca commented Oct 17, 2025

There is an unmerged PR against python-magic which does just that: ahupp/python-magic#294

@ddelange
Copy link

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
Copy link
Member

so should I merge this or should the other thing use python-magic-standalone instead?

@ddelange
Copy link

ddelange commented Oct 25, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants