typecode
Comprehensive filetype and mimetype detection using libmagic and Pygments.
Decision gist · record as of 2026-08-14
Yes. Active maintenance, production-stable status, low install friction, no known vulnerabilities, and permissive licensing make it a solid choice. Install with [full] for immediate use, or [minimal] if your environment already provides libmagic 5.39. Best suited for projects needing reliable file type detection beyond filename inspection.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires libmagic 5.39 available either via the [full] extra, system PATH, environment variables (TYPECODE_LIBMAGIC_PATH, TYPECODE_LIBMAGIC_DB_PATH), or a typecode-libmagic plugin.
- Low install friction with a pure Python wheel.
- Actively maintained with recent commits and production-stable status.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions—suitable for most projects.
last release 2026-03-23 (144 days) · last repo commit 2026-04-24 · 10 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 127,394 downloads/mo, #11,745 on PyPI
Alternatives
Verify before relying
pip install typecode
from typecode import identify
result = identify.identify_file('path/to/file')- Whether the package's API surface and typical workflows are well-documented beyond the README.
- Performance characteristics when processing large batches of files or unusual formats.
- Specific accuracy or edge-case behavior compared to direct libmagic or Pygments use.
What it is and what it does
TypeCode is a file type and MIME type detection library that wraps libmagic and Pygments to identify file formats. It started as a library within scancode-toolkit and provides a unified interface for comprehensive filetype detection across Linux, Windows, and macOS.
The package supports multiple installation modes: the [full] extra bundles libmagic binaries for immediate use, while the minimal install expects libmagic to be provided by the system, environment variables, or a plugin. It integrates with the plugincode system to allow custom libmagic providers, making it flexible for environments with non-standard library locations.
Use it for
- Identify file types in batch processing pipelines without relying on file extensions.
- Determine MIME types for web servers or content management systems handling user uploads.
- Integrate file type detection into security scanning or compliance tools.
- Classify documents by format in archival or document management workflows.
- Detect and handle PDF and other structured formats via pdfminer.six integration.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Active maintenance, production-stable status, low install friction, no known vulnerabilities, and permissive licensing make it a solid choice. Install with [full] for immediate use, or [minimal] if your environment already provides libmagic 5.39. Best suited for projects needing reliable file type detection beyond filename inspection.
Install
typecode on PyPI
Before you install
Low install friction with a pure Python wheel. Actively maintained with recent commits and production-stable status. Five runtime dependencies including attrs, binaryornot, commoncode, pdfminer.six, and plugincode.
Requires libmagic 5.39 available either via the [full] extra, system PATH, environment variables (TYPECODE_LIBMAGIC_PATH, TYPECODE_LIBMAGIC_DB_PATH), or a typecode-libmagic plugin.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install typecode
from typecode import identify
result = identify.identify_file('path/to/file')
Verify before relying
- Whether the package's API surface and typical workflows are well-documented beyond the README.
- Performance characteristics when processing large batches of files or unusual formats.
- Specific accuracy or edge-case behavior compared to direct libmagic or Pygments use.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 5 packagesattrsbinaryornotcommoncodepdfminer.sixplugincode |
| Maintenance | Actively maintained 144 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 127,394 / month, #11,745 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software DevelopmentTopic :: Utilities |
Evidence: typecode-30.2.0-py3-none-any.whl
Tags
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 wrapper”
- typecodeDetects file types and MIME types using libmagic and Pygments, with…
- pylibmagicProvides pre-compiled libmagic libraries bundled with Python, solving…
- python-magicIdentifies file types by reading file headers and checking them…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also typecode-libmagic · filetype · libmagic · polyfile-weave · python-magic · file-magic · python-magic-bin · extractcode-libarchive · mediatype · scancode-toolkit