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 to be dependency-free and small, but based on published update info it has been quiet for a long time, with the latest documented versioned updates dating to 2022-11-08 (v1.2.0); no newer release notes are shown up to today (2026-09-10).
- Apparent update cadence: versioned updates slowed to roughly multi-year intervals (2022-04, 2022-07, 2022-11), and while there was an upstream push on 2025-05-02, the evidence provided does not show any corresponding documented updates after 2022.
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.