python-magic-bin is a Python wrapper for `libmagic`, the file type identification library. Unlike the original `python-magic` package, `python-magic-bin` bundles the `libmagic` binary and its associated magic database, making it easier to install and use, especially on platforms like Windows where `libmagic` is not natively available. It currently stands at version 0.4.14 and has a slow release cadence, primarily for bug fixes or compatibility updates.
pip install python-magic-binVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use `python-magic-bin` to identify the MIME type of a local file. The `magic.Magic()` constructor is used, typically with `mime=True` to get standard MIME types.
Ensure you explicitly install either `python-magic` or `python-magic-bin`, but not both if you don't understand their differences. For easier setup, especially on Windows, `python-magic-bin` is usually preferred.
Be aware that new issues or detection problems might not be resolved quickly. Consider contributing to the project or evaluating the more actively maintained `python-magic` if system-level `libmagic` installation is not an issue for your environment.
Check the `python-magic-bin` release notes for information on the bundled `libmagic` version. If you require the absolute latest `libmagic` features or security patches, consider using `python-magic` and installing the latest `libmagic` via your system package manager.
No dependency data recorded yet.