--- id: pylibmagic version: "0.5.0" license: unclear license_treatment: permissive maintenance: active --- # pylibmagic — scikit-build project with CMake for compiling libmagic License: permissive · Maintenance: active · Downloads: 330.5K/mo ## What it is and what it does pylibmagic is a minimal Python package that bundles pre-compiled libmagic libraries and registers them so they become available to dependent packages. It ships compiled binaries for multiple platforms (macOS, Linux, musl) and architectures using CMake and scikit-build, addressing the common ImportError that occurs when libmagic is not installed on the system. The package is designed as a lightweight shim: install it, and the bundled libraries become available. It depends only on importlib-resources and typing-extensions, keeping the footprint minimal. It supports Python 3.7 through 3.12 and is classified as Beta-stage software. Use it for: - Deploying applications in containerized or CI/CD environments where system package managers are unavailable or restricted. - Distributing Python applications that need file-type detection without requiring end-users to install system libraries. - Cross-platform development where developers use different operating systems and want consistent library availability. - Scientific or research workflows that depend on file-type detection in sandboxed or minimal-dependency environments. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides pre-compiled libmagic libraries bundled with Python, solving the missing system dependency problem that typically breaks python-magic imports. Yes, if you need to resolve libmagic import errors or distribute applications without system dependencies. The permissive license, active maintenance, and platform-specific wheels make it a straightforward solution to a real problem. The gap since the last release (2023-10-19) is worth verifying against your target Python and platform before production use. ## Install pip install pylibmagic uv add pylibmagic poetry add pylibmagic ## Installing pylibmagic Before you install: Medium install friction due to platform-specific wheels across macOS (x86_64 and arm64), Linux (x86_64 and aarch64), and musl variants. Repository is active with recent commits and stable maintenance. License in practice: Permissive BSD license allows commercial and private use without restriction; no copyleft obligations. Quickstart: $ python3 -m pip install pylibmagic import pylibmagic import importlib-resources import typing-extensions Requires Python 3.7 or later; platform-specific wheels available for macOS (Intel and ARM), Linux (glibc and musl), and aarch64 architectures. Verify before relying: - Whether pylibmagic works correctly as a drop-in solution for the libmagic import error described in the documentation. - Performance characteristics and feature compatibility with system-installed libmagic. - Real-world success rate in containerized or CI/CD environments where system dependencies are unavailable. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 330.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags libmagic python bundled, python-magic dependency fix, file type detection library, magic library python wrapper, system library bundling python, libmagic precompiled wheels, file-type-detection, system-library-bundling [View on SkillFed](https://skillfed.io/packages/pylibmagic) · [View on PyPI](https://pypi.org/project/pylibmagic/)