Registry / serialization / typecode

typecode

JSON →
library30.2.0pypypiunverified

Comprehensive filetype and mimetype detection using libmagic and Pygments. Current version: 30.2.0. Regular releases every few months.

pip install typecode
INSTALL
IMPORT
SIG · TYPECODE
T
typecode
serializationpythonv30.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TypeCode
from typecode import TypeCode
from typecode.type import TypeCode
TypeCode is a top-level export; incorrect import caused by outdated docs.

Quickstart: create a TypeCode object from a file path and access mime/file types.

from typecode import TypeCode # Initialize with a file path tc = TypeCode('/path/to/file') print(tc.mimetype) print(tc.filetype)
Debug
Known issues
gotchalibmagic must be installed on the system or via the typecode-libmagic-system-provided plugin. On macOS/ARM Linux, you must install the 'system_provided' extra or have libmagic available via package manager.
fix
pip install typecode[system_provided] OR install libmagic via apt/brew/etc.
affects: >=30.2.0
deprecatedpkg_resources usage was removed in v30.1.0. Code relying on pkg_resources to access typecode resources may break. Use importlib.metadata instead.
fix
Replace pkg_resources references with importlib.metadata for resource access.
affects: >=30.1.0
gotchaPre-v30.0.0 used CalVer versioning; current versions are semantic (30.x.y). Some older documentation may reference CalVer patterns.
fix
Use semver (30.x.y) for current versions; ignore CalVer references.
affects: >=30.0.0
Upgrade
Version history
30.2.0latest on PyPI · released Mar 23, 2026
Audit
Dependencies
typecode-libmagic-system-providedoptionalOptional for using system libmagic on mac/linux arm
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
typecode — pip install typecode · libregistry