filetype.py is a small, dependency-free Python package that infers a file type and MIME type by checking a file’s magic number signatures. It also supports getting an inferred extension, discovering types by extension or MIME, and can work from the first 261 bytes of a file or buffer.
Project status
- The source (h2non/filetype.py) appears quiet or in maintenance mode, with the most recent upstream push on 2025-05-02 and the last publicly described tagged update in 2022-11-08 (v1.2.0), which is well over 12 months ago relative to 2026-06-09.
- The apparent update cadence is sparse, with no evidence of regular ongoing updates (tagged updates span 2022-04 through 2022-11, then a long gap afterward).
AI summary generated
Recent updates
v1.2.0
v1.2.0 expands file type detection significantly by adding new matchers for APNG, AVIF, Zstd, and multiple Microsoft and OpenDocument office document formats. The code also adjusts several signature-matching routines for robustness and to reduce false positives (or broaden detection), including changes that can affect which type is chosen when multiple matchers could match.
v1.1.0
v1.1.0 adds detection support for Zstandard archives (zst) and improves some signature matching edge cases, including PDF files that start with a UTF-8 BOM. The code diff also includes a notable change to how inputs are converted to bytes internally (filetype/utils.py), which can break existing callers that relied on passing file-like objects.
Featuresv1.0.13
v1.0.13 was published on 2022-04-21, but the release notes were not provided by the publisher. As a result, there is no documented information about new features, fixes, breaking changes, or dependency updates in this release.
v1.0.11
Release v1.0.11 was published on 2022-04-19. No release notes were provided, so the specific changes, bug fixes, or potential breaking changes cannot be determined from the release description alone.