--- id: libmagic version: "1.0" license: GPL v3 license_treatment: copyleft maintenance: abandoned --- # libmagic — libmagic bindings License: copyleft · Maintenance: abandoned · Downloads: 127.8K/mo ## What it is and what it does libmagic is a Python wrapper around the libmagic C library, providing file type and MIME type detection through ctypes. It allows you to query the type of a file by reading its magic bytes—the identifying patterns at the start of a file—rather than relying on file extensions. The package is a thin binding with no runtime Python dependencies, relying entirely on the system-installed libmagic library. The package has been abandoned since its single release in 2012 and receives no maintenance. While it may still work on systems with libmagic installed, it carries significant risk: no bug fixes, no Python version support updates, and no response to security issues. The GPL v3 copyleft license also imposes source-code disclosure requirements on any project that uses it. Use it for: - Detect file types by content rather than extension in legacy systems still using this binding. - Identify MIME types for uploaded files in web applications that cannot upgrade dependencies. - Analyze file format in security or forensics tools where libmagic integration is already established. - Validate file integrity by checking magic bytes in batch processing scripts with minimal dependencies. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides Python bindings to the libmagic library for file type detection and MIME type identification using ctypes. No. The package is abandoned (last release 2012-03-02, no maintenance since), carries high install friction (requires compiled libmagic), and is licensed under GPL v3 copyleft. Modern alternatives like `python-magic` or `python-magic-bin` are maintained and provide the same functionality. Install this only if you are maintaining legacy code that already depends on it and cannot migrate. ## Install pip install libmagic uv add libmagic poetry add libmagic ## Installing libmagic Before you install: High install friction due to a compiled system dependency (libmagic-1.0.tar.gz). The package is abandoned—last release was 2012-03-02 with no commits or maintenance activity since. Use only if you have a specific reason to prefer this binding over maintained alternatives. License in practice: Licensed under GPL v3 (copyleft). Any code that imports this package must comply with GPL v3 terms, including potential source code disclosure obligations if distributed. Quickstart: import libmagic # Requires libmagic system library installed magic_instance = libmagic.open() file_type = magic_instance.file('/path/to/file') magic_instance.close() libmagic system library must be installed on the system; ctypes requires the compiled libmagic shared object to be available at runtime. Verify before relying: - Whether libmagic system dependency is available on modern operating systems and package managers. - Compatibility with Python versions beyond those available in 2012; requires_python is unspecified. - Whether the ctypes binding handles edge cases or errors that modern file-type libraries address. ## Package facts - License: GPL v3 (copyleft) - Python support: unspecified - Install friction: high - Maintenance: abandoned - Downloads: 127.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags file type detection python, libmagic bindings, mime type identification, file magic number detection, ctypes file analysis, file format recognition, abandoned, file-type-detection, ctypes-binding [View on SkillFed](https://skillfed.io/packages/libmagic) · [View on PyPI](https://pypi.org/project/libmagic/)