Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

Add libmagic1 to Dockerfile dependencies#310

Open
nijel wants to merge 1 commit intopre-commit-ci:main from
nijel:patch-1
Open

Add libmagic1 to Dockerfile dependencies #310
nijel wants to merge 1 commit intopre-commit-ci:main from
nijel:patch-1

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

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

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

Copy link

carmenbianca commented Oct 17, 2025
edited
Loading

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

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.

Copy link
Member

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

Copy link

ddelange commented Oct 25, 2025
edited
Loading

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /