$npx skillfedfor your agent

puremagic

Pure python implementation of magic file detection

Worth itPyPI UtilitiesReleased Apr 20267.5M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — puremagic-2.2.0-py3-none-any.whl
v2.2.0 · released 2026-04-08 · Python >=3.12

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.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.12 or later; Python 3.7–3.11 users must use the 1.x release chain.
  • Low install friction with no runtime dependencies.
  • Active maintenance with recent releases; last commit 2026-04-09 and 128 days since latest release.

License · maintenance · safety

MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; attribution required.

last release 2026-04-08 (128 days) · last repo commit 2026-04-09 · 242 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 7,537,817 downloads/mo, #1,725 on PyPI

Verify before relying

import puremagic

# Identify file from path
ext = puremagic.from_file('test.gif')
# Returns: '.gif'

# Get all matches with confidence
results = puremagic.magic_file('test.gif')
# Returns: [['.gif', 'image/gif', 'Graphics interchange format file (GIF87a)', 0.7], ...]
  • Exact count of supported file formats and how it compares to libmagic coverage
  • Performance benchmarks against libmagic or other alternatives
  • Accuracy metrics for deep scan across the supported format categories
Same gist for agents: .md · .json

What it is and 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.

Since 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.

Use it for

  • 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.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

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.

Install

puremagic on PyPI

Before you install

Low install friction with no runtime dependencies. Active maintenance with recent releases; last commit 2026-04-09 and 128 days since latest release.

Requires Python 3.12 or later; Python 3.7–3.11 users must use the 1.x release chain.

License in practice

MIT license permits commercial and private use with minimal restrictions; attribution required.

Quickstart

import puremagic

# Identify file from path
ext = puremagic.from_file('test.gif')
# Returns: '.gif'

# Get all matches with confidence
results = puremagic.magic_file('test.gif')
# Returns: [['.gif', 'image/gif', 'Graphics interchange format file (GIF87a)', 0.7], ...]

Verify before relying

  • Exact count of supported file formats and how it compares to libmagic coverage
  • Performance benchmarks against libmagic or other alternatives
  • Accuracy metrics for deep scan across the supported format categories

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.12
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 128 days since the last release
Last repo commit
First released
Downloads7,537,817 / month, #1,725 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: PyPyTopic :: Utilities

Evidence: puremagic-2.2.0-py3-none-any.whl

Tags

Capabilities
file type detectionmagic number identificationfile format recognitionmime type detectionpure python file identificationlibmagic alternativecontent-based file detection
Topics
file-identificationcross-platformzero-dependencies

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “magic number identification”

  • puremagicIdentifies file types by analyzing magic numbers and file content,…
  • cigamDetects and reports file types, MIME types, and extensions by…
  • python-magic-binIdentifies file types by examining file headers using libmagic,…

Give your agent the search over MCP, or paste the wish link into any chat.

More Utilities packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
charset-normalizer Worth it
PyPI · Utilities · released Aug 2026

Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.

permissive licensepure Python · 3.7+
1.7Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
Pygments Worth it
PyPI · Utilities · released Mar 2026

Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.

Install it if you need to display or transform source code.

BSD-2-Clausepure Python · 3.9+
1.3Bdownloads / mo
six With conditions
PyPI · Libraries · released Dec 2024

Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.

MITpure Python
1.2Bdownloads / mo

See also filetype · python-magic-bin · python-magic · cigam · magika · file-magic · libmagic · identify · polyfile-weave · pylibmagic