{"categories":[{"label":"Utilities","url":"https://skillfed.io/packages/category/utilities/2"}],"enrichment":{"capability":"Identifies file types by analyzing magic numbers and file content, with zero runtime dependencies and cross-platform support.","skillfed_tags":["file-identification","cross-platform","zero-dependencies"],"use_cases":["Identify uploaded file types in web applications without installing system dependencies like libmagic.","Batch scan directories to classify files by format and MIME type across different operating systems.","Validate file authenticity by confirming magic numbers match expected formats before processing.","Detect and distinguish between similar formats (e.g., Office xlsx vs. OpenDocument odt) via deep scan.","Analyze scientific data files (HDF5, VCF, SAM, GFF) with format-specific validation built in."],"what_it_does":"puremagic is a pure Python library that identifies file types by examining magic numbers and file content. It serves as a lightweight, dependency-free alternative to python-magic/libmagic, making it suitable for cross-platform use without requiring system libraries. The package implements functions like from_file() and from_string() for basic identification, plus more detailed magic_file() and magic_stream() methods that return all possible matches ranked by confidence.\n\nSince version 2.0, puremagic includes a deep scan system that performs content-aware analysis beyond simple magic number matching, improving accuracy for formats like Office documents, text files, CSV, MP3, Python source, JSON, HDF5, email, and scientific formats. Deep scan is enabled by default but can be disabled via the PUREMAGIC_DEEPSCAN environment variable. The package also includes a command-line interface for batch file identification.","worth_installing":"Yes. Zero runtime dependencies, active maintenance, permissive MIT license, and no known vulnerabilities make this a low-risk choice. Install friction is minimal. Use it if you need file type detection without system library dependencies or if you want content-aware analysis beyond simple magic number matching. The Python 3.12+ requirement is a constraint but not a blocker for modern projects."},"id":"puremagic","links":{"html":"https://skillfed.io/packages/puremagic","md":"https://skillfed.io/packages/puremagic.md","pypi":"https://pypi.org/project/puremagic/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-04-08","license_spdx":"MIT","license_treatment":"permissive","name":"puremagic","python_support":"supports_current","summary":"Pure python implementation of magic file detection"},"popularity":{"monthly_downloads":7537817,"position":1725,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"2.2.0"}
