freshcrate
Home > RAG & Memory > magika

magika

A tool to determine the content type of a file with deep learning

Description

# Magika Python Package [![image](https://img.shields.io/pypi/v/magika.svg)](https://pypi.python.org/pypi/magika) [![NPM Version](https://img.shields.io/npm/v/magika)](https://npmjs.com/package/magika) [![image](https://img.shields.io/pypi/l/magika.svg)](https://pypi.python.org/pypi/magika) [![image](https://img.shields.io/pypi/pyversions/magika.svg)](https://pypi.python.org/pypi/magika) [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8706/badge)](https://www.bestpractices.dev/en/projects/8706) ![CodeQL](https://github.com/google/magika/workflows/CodeQL/badge.svg) [![Actions status](https://github.com/google/magika/actions/workflows/python-build-and-release-package.yml/badge.svg)](https://github.com/google/magika/actions) [![PyPI Monthly Downloads](https://static.pepy.tech/badge/magika/month)](https://pepy.tech/projects/magika) [![PyPI Downloads](https://static.pepy.tech/badge/magika)](https://pepy.tech/projects/magika) <!-- [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/google/magika/badge)](https://securityscorecards.dev/viewer/?uri=github.com/google/magika) --> Magika is a novel AI-powered file type detection tool that relies on the recent advance of deep learning to provide accurate detection. Under the hood, Magika employs a custom, highly optimized model that only weighs about a few MBs, and enables precise file identification within milliseconds, even when running on a single CPU. Magika has been trained and evaluated on a dataset of ~100M samples across 200+ content types (covering both binary and textual file formats), and it achieves an average ~99% accuracy on our test set. Use Magika as a command line client or in your Python code! You can find more information on which content types are supported, extended documentation, and bindings for other languages on Magika's website at [https://securityresearch.google/magika/](https://securityresearch.google/magika/). ## Installing Magika Magika is available as `magika` on [PyPI](https://pypi.org/project/magika): To install the most recent stable version: ```shell pip install magika ``` If you intend to use Magika only as a command line, you may want to use `pipx install magika` instead. If you want to test out the latest release candidate, you can install it with `pip install --pre magika`. ## Using Magika as a command-line tool > Beginning with version `0.6.0`, the magika Python package includes a pre-compiled Rust-based command-line tool, replacing the previous Python version. This binary is distributed as platform-specific wheels for most common architectures. For unsupported platforms, a pure-Python wheel is also available, providing the legacy Python client as a fallback. ```shell $ cd tests_data/basic && magika -r * asm/code.asm: Assembly (code) batch/simple.bat: DOS batch file (code) c/code.c: C source (code) css/code.css: CSS source (code) csv/magika_test.csv: CSV document (code) dockerfile/Dockerfile: Dockerfile (code) docx/doc.docx: Microsoft Word 2007+ document (document) epub/doc.epub: EPUB document (document) epub/magika_test.epub: EPUB document (document) flac/test.flac: FLAC audio bitstream data (audio) handlebars/example.handlebars: Handlebars source (code) html/doc.html: HTML document (code) ini/doc.ini: INI configuration file (text) javascript/code.js: JavaScript source (code) jinja/example.j2: Jinja template (code) jpeg/magika_test.jpg: JPEG image data (image) json/doc.json: JSON document (code) latex/sample.tex: LaTeX document (text) makefile/simple.Makefile: Makefile source (code) markdown/README.md: Markdown document (text) [...] ``` ```shell $ magika ./tests_data/basic/python/code.py --json [ { "path": "./tests_data/basic/python/code.py", "result": { "status": "ok", "value": { "dl": { "description": "Python source", "extensions": [ "py", "pyi" ], "group": "code", "is_text": true, "label": "python", "mime_type": "text/x-python" }, "output": { "description": "Python source", "extensions": [ "py", "pyi" ], "group": "code", "is_text": true, "label": "python", "mime_type": "text/x-python" }, "score": 0.753000020980835 } } } ] ``` ```shell $ cat doc.ini | magika - -: INI configuration file (text) ``` ```help $ magika --help Determines the content type of files with deep-learning Usage: magika [OPTIONS] [PATH]... Arguments: [PATH]... List of paths to the files to analyze. Use a dash (-) to read from standard input (can only be used once). Options: -r, --recursive Identifies files within directories instead of identifying the directory itself --no-dereference Identifies symbolic links as is instead of identifying their content by following them --colors

Release History

VersionChangesUrgencyDate
1.0.2Imported from PyPI (1.0.2)Low4/21/2026
cli-latestThis moving release simply replicates the assets and commit hash of the latest CLI release. The latest CLI release is [cli/v1.0.2](https://github.com/google/magika/releases/tag/cli/v1.0.2). High4/16/2026
python-v1.0.2Changelog: - Mark python 3.14 as supported. - Remove direct dependency on numpy. - Remove dependency on python-dotenv (note: .env files are no longer loaded automatically). - Remove onnxruntime<=1.20.1 Windows pin. See all CHANGELOGs here: https://github.com/google/magika/blob/python-v1.0.2/python/CHANGELOG.md#102---2026-02-25Low2/27/2026
cli/v1.0.2## Install magika 1.0.2 ### Install prebuilt binaries via shell script ```sh curl --proto '=https' --tlsv1.2 -LsSf https://github.com/google/magika/releases/download/cli/v1.0.2/magika-installer.sh | sh ``` ### Install prebuilt binaries via powershell script ```sh powershell -ExecutionPolicy Bypass -c "irm https://github.com/google/magika/releases/download/cli/v1.0.2/magika-installer.ps1 | iex" ``` ## Download magika 1.0.2 | File | Platform | Checksum | |--------|----------|----------| | Low2/25/2026
python-v1.0.1This release marks the first stable release, and the end of the experimental phase. Updated documentation is at the new website: https://securityresearch.google/magika/ See CHANGELOGs here: https://github.com/google/magika/blob/python-v1.0.1/python/CHANGELOG.md#101---2025-10-31.Low10/31/2025
python-v0.6.3See changelog at https://github.com/google/magika/blob/python-v0.6.3/python/CHANGELOG.md#063---2025-10-30Low10/30/2025
cli/v1.0.1## Install magika 1.0.1 ### Install prebuilt binaries via shell script ```sh curl --proto '=https' --tlsv1.2 -LsSf https://github.com/google/magika/releases/download/cli/v1.0.1/magika-installer.sh | sh ``` ### Install prebuilt binaries via powershell script ```sh powershell -ExecutionPolicy Bypass -c "irm https://github.com/google/magika/releases/download/cli/v1.0.1/magika-installer.ps1 | iex" ``` ## Download magika 1.0.1 | File | Platform | Checksum | |--------|----------|----------| | Low10/10/2025
cli/v1.0.0## Install magika 1.0.0 ### Install prebuilt binaries via shell script ```sh curl --proto '=https' --tlsv1.2 -LsSf https://github.com/google/magika/releases/download/cli/v1.0.0/magika-installer.sh | sh ``` ### Install prebuilt binaries via powershell script ```sh powershell -ExecutionPolicy Bypass -c "irm https://github.com/google/magika/releases/download/cli/v1.0.0/magika-installer.ps1 | iex" ``` ## Download magika 1.0.0 | File | Platform | Checksum | |--------|----------|----------| | Low9/12/2025
cli/v0.1.4## Install magika 0.1.4 ### Install prebuilt binaries via shell script ```sh curl --proto '=https' --tlsv1.2 -LsSf https://github.com/google/magika/releases/download/cli/v0.1.4/magika-installer.sh | sh ``` ### Install prebuilt binaries via powershell script ```sh powershell -ExecutionPolicy Bypass -c "irm https://github.com/google/magika/releases/download/cli/v0.1.4/magika-installer.ps1 | iex" ``` ## Download magika 0.1.4 | File | Platform | Checksum | |--------|----------|----------| | Low9/10/2025
cli/v0.1.3## Install magika 0.1.3 ### Install prebuilt binaries via shell script ```sh curl --proto '=https' --tlsv1.2 -LsSf https://github.com/google/magika/releases/download/cli/v0.1.3/magika-installer.sh | sh ``` ### Install prebuilt binaries via powershell script ```sh powershell -ExecutionPolicy Bypass -c "irm https://github.com/google/magika/releases/download/cli/v0.1.3/magika-installer.ps1 | iex" ``` ## Download magika 0.1.3 | File | Platform | Checksum | |--------|----------|----------| | Low9/10/2025
python-v0.6.2See changelog at https://github.com/google/magika/blob/python-v0.6.2/python/CHANGELOG.md#062---2025-05-02Low5/2/2025
python-v0.6.1This release includes breaking changes from the last stable release, 0.5.1. See changelog at https://github.com/google/magika/blob/python-v0.6.1/python/CHANGELOG.md for more information about the changes, the new features, and a migration guide.Low3/19/2025
python-v0.6.1-rc3See changelog at https://github.com/google/magika/blob/python-v0.6.1-rc3/python/CHANGELOG.md#061-rc3---2025-03-17Low3/17/2025
python-v0.6.1-rc2See changelog at https://github.com/google/magika/blob/python-v0.6.1-rc2/python/CHANGELOG.md#061-rc2---2025-03-11Low3/11/2025
python-v0.6.1-rc1See changelog at https://github.com/google/magika/blob/python-v0.6.1-rc1/python/CHANGELOG.md#061-rc1---2025-02-04Low2/4/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

apache-tvm-ffitvm ffi0.1.10
outlines-coreStructured Text Generation in Rust0.2.14
xgrammarEfficient, Flexible and Portable Structured Generation0.1.33
nvidia-cuda-cupti-cu12CUDA profiling tools runtime libs.12.9.79
gymnasiumA standard API for reinforcement learning and a diverse set of reference environments (formerly Gym).1.2.3