{"id":24748,"library":"typecode-libmagic","title":"typecode-libmagic","description":"A Scancode path provider plugin that downloads and provides a prebuilt native libmagic binary and its database for file type detection. Version 5.39.210531. Low release cadence; primarily used as a dependency within the ScanCode toolkit ecosystem.","status":"active","version":"5.39.210531","language":"python","source_language":"en","source_url":"https://github.com/nexB/scancode-plugins","tags":["libmagic","file-type","scanning","plugin"],"install":[{"cmd":"pip install typecode-libmagic","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Library that consumes the libmagic binary provided by this plugin","package":"typecode","optional":false},{"reason":"Plugin infrastructure used by ScanCode","package":"plugincode","optional":false}],"imports":[{"note":"Uses underscores in package name consistent with PEP 8","symbol":"LibmagicPathProvider","correct":"from typecode_libmagic import LibmagicPathProvider"}],"quickstart":{"code":"from typecode_libmagic import LibmagicPathProvider\nprovider = LibmagicPathProvider()\nprint(provider.get_libmagic_path())","lang":"python","description":"Instantiate the provider to get the path to the bundled libmagic binary."},"warnings":[{"fix":"Install typecode instead: pip install typecode","message":"Do not install typecode-libmagic directly unless you are building a ScanCode plugin environment. For general use, rely on typecode which pulls this plugin automatically.","severity":"gotcha","affected_versions":"all"},{"fix":"Use from typecode_libmagic import LibmagicPathProvider","message":"In versions prior to 1.0.0, the provider class was located in a different module. Update imports if upgrading from an older release.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Replace provider.get_libmagic() with provider.get_libmagic_path()","message":"The old method get_libmagic() is deprecated in favor of get_libmagic_path() which returns a path string.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install the package with pip install typecode-libmagic and then import it as from typecode_libmagic import ...","cause":"Trying to import with hyphens instead of underscores. The installed package name uses hyphens but the import uses underscores.","error":"ModuleNotFoundError: No module named 'typecode_libmagic'"},{"fix":"Upgrade to the latest version: pip install --upgrade typecode-libmagic. Then use LibmagicPathProvider.","cause":"Using an older version of the library where the class had a different name or location.","error":"AttributeError: module 'typecode_libmagic' has no attribute 'LibmagicPathProvider'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}