polyfile-weave
A utility to recursively map the structure of a file.
Decision gist · record as of 2026-08-14
Yes, if you need recursive file identification and polyglot detection. The pure-Python libmagic implementation and low install friction make it accessible, and Apache 2.0 licensing poses no restrictions. However, the aging maintenance status (204 days since last release, minimal repository activity) and 14 runtime dependencies warrant caution for production use—verify that the package remains stable for your specific file formats and that dependency bloat is acceptable for your use case.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Java must be installed before installing from source, as it is required to run the Kaitai Struct compiler for file format definitions.
- Low install friction with a pure-Python wheel.
- Maintenance status is aging—last release was 204 days ago and the repository has minimal activity (2 stars), though it remains unarchived and the codebase was last updated on 2026-01-22.
License · maintenance · safety
permissive license (permissive) — Licensed under Apache 2.0 (permissive), which allows commercial and private use with minimal restrictions, making it safe to adopt in most projects.
last release 2026-01-22 (204 days) · last repo commit 2026-01-22 · 2 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 935,471 downloads/mo, #4,694 on PyPI
Alternatives
Verify before relying
pip install polyfile-weave
from polyfile.magic import MagicMatcher
with open("file_to_test", "rb") as f:
for match in MagicMatcher.DEFAULT_INSTANCE.match(f.read()):
for mimetype in match.mimetypes:
print(f"Matched MIME: {mimetype}")- Whether the 14 runtime dependencies (including graphviz, Pillow, pdfminer.six) are all truly required for basic file identification or only for specific features.
- Current stability and bug-fix rate given the aging maintenance status and minimal repository activity.
- Whether the automatic patching of the Kaitai Struct Python reserved keyword issue works reliably across all installation scenarios.
What it is and what it does
PolyFile is a file analysis utility that identifies file types and recursively maps their internal structure, including detecting polyglots (files with multiple valid formats), chimeras, and embedded files. It includes a cleanroom pure-Python implementation of libmagic that supports 263 MIME types and can act as a drop-in replacement for the Unix `file` command, but with the added capability to recursively identify files embedded within other files—similar to binwalk.
The package supports parsing and semantic mapping of PDF, ZIP, JPEG/JFIF, iNES, and any format specified in a Kaitai Struct grammar. It offers multiple output formats (including an extension of the SBuD JSON format), an interactive debugger for troubleshooting file matching and parsing, and both command-line and programmatic interfaces. The package automatically patches a known issue with Kaitai Struct's auto-generated Python code on import.
Use it for
- Analyze polyglot files to understand all embedded file types and their byte offsets within a single file.
- Recursively extract and identify all files embedded within ZIP archives or PDF documents programmatically.
- Generate interactive HTML hex viewers of files with semantic structure annotations for forensic analysis.
- Debug why a file is not being classified with the expected MIME type using the built-in interactive debugger.
- Replace the system `file` command in scripts while gaining recursive file identification capabilities.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need recursive file identification and polyglot detection.
The pure-Python libmagic implementation and low install friction make it accessible, and Apache 2.0 licensing poses no restrictions. However, the aging maintenance status (204 days since last release, minimal repository activity) and 14 runtime dependencies warrant caution for production use—verify that the package remains stable for your specific file formats and that dependency bloat is acceptable for your use case.
Install
polyfile-weave on PyPI
Before you install
Low install friction with a pure-Python wheel. Maintenance status is aging—last release was 204 days ago and the repository has minimal activity (2 stars), though it remains unarchived and the codebase was last updated on 2026-01-22.
Java must be installed before installing from source, as it is required to run the Kaitai Struct compiler for file format definitions.
License in practice
Licensed under Apache 2.0 (permissive), which allows commercial and private use with minimal restrictions, making it safe to adopt in most projects.
Quickstart
pip install polyfile-weave
from polyfile.magic import MagicMatcher
with open("file_to_test", "rb") as f:
for match in MagicMatcher.DEFAULT_INSTANCE.match(f.read()):
for mimetype in match.mimetypes:
print(f"Matched MIME: {mimetype}")
Verify before relying
- Whether the 14 runtime dependencies (including graphviz, Pillow, pdfminer.six) are all truly required for basic file identification or only for specific features.
- Current stability and bug-fix rate given the aging maintenance status and minimal repository activity.
- Whether the automatic patching of the Kaitai Struct Python reserved keyword issue works reliably across all installation scenarios.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 14 packagesabnfchardetcintficklingfilelockgraphvizintervaltreejinja2kaitaistructnetworkxPillowpyreadline3pyyamlpdfminer.six |
| Maintenance | Aging 204 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 935,471 / month, #4,694 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3 :: OnlyTopic :: SecurityTopic :: Software Development :: TestingTopic :: Utilities |
Evidence: polyfile_weave-0.5.9-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 › “polyglot file detection”
- polyfile-weaveIdentifies and maps the semantic and syntactic structure of files,…
- polyglotPolyglot is a multilingual natural language processing pipeline that…
- chessA pure-Python chess library providing move generation, validation,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
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.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
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.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also python-magic · libmagic · python-magic-bin · typecode · file-magic · puremagic · filetype · typecode-libmagic · mo-parsing · identify