$npx skillfedfor your agent

libmagic

libmagic bindings

SkipPyPI Python ModulesReleased Mar 2012127.8K downloads / moGPL v3Source build

Decision gist · record as of 2026-08-14

sdist only — libmagic-1.0.tar.gz · builds from source
v1.0 · released 2012-03-02

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

Before you install

  • libmagic system library must be installed on the system; ctypes requires the compiled libmagic shared object to be available at runtime.
  • 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.

License · maintenance · safety

GPL v3 (copyleft) — 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.

last release 2012-03-02 (5278 days)

0 known vulnerabilities (OSV.dev, 2026-08-14) · 127,815 downloads/mo, #11,729 on PyPI

Verify before relying

import libmagic
# Requires libmagic system library installed
magic_instance = libmagic.open()
file_type = magic_instance.file('/path/to/file')
magic_instance.close()
  • 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.
Same gist for agents: .md · .json

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 on this page. Verify before relying on it.

Skip

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

libmagic on PyPI

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.

libmagic system library must be installed on the system; ctypes requires the compiled libmagic shared object to be available at runtime.

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()

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

LicenseGPL v3 copyleft
Python supportNot specified
Install frictionHigh. Source build required
Runtime dependenciesNone
MaintenanceAbandoned 5,278 days since the last release
First released
Downloads127,815 / month, #11,729 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaEnvironment :: ConsoleEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: GNU General Public License (GPL)Operating System :: OS IndependentProgramming Language :: PythonTopic :: SecurityTopic :: Software Development :: Libraries :: Python Modules

Evidence: libmagic-1.0.tar.gz

Tags

Capabilities
file type detection pythonlibmagic bindingsmime type identificationfile magic number detectionctypes file analysisfile format recognition
Topics
abandonedfile-type-detectionctypes-binding

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 › “libmagic bindings”

  • libmagicProvides Python bindings to the libmagic library for file type…
  • file-magicfile-magic provides a Python interface to libmagic, enabling…
  • typecodeDetects file types and MIME types using libmagic and Pygments, with…

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

More Python Modules 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
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
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also file-magic · python-magic · python-magic-bin · typecode · polyfile-weave · cigam · puremagic · filetype · typecode-libmagic · magika