NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #864 most downloaded on PyPI
A tool to determine the content type of a file with deep learning
Last release 5 months ago
04 May 2026
Release timing varies
gaps range from 2 weeks to 9 months
Nearly every release is documented
notes for 8 of 8 stable releases
1 version withdrawn
withdrawn after publishing
3 years old
17 releases · first in 2023
One column per quarter.
- Update magika CLI binary.
Remove direct dependency on numpy.
Mark end of experimental phase. No changes from last version.
Pin onnxruntime on Windows (#1099).
Nothing published for this version
Nothing published for this version
New model standard_v3_3 model, with better support for TypeScript and non-ascii characters in textual files. See models' CHANGELOG for more informatio
standard_v3_3 model, with better support for TypeScript and non-ascii characters in textual files. See models' CHANGELOG for more information.identify_stream() now restores the stream's original position after reading from it, preventing side effects on subsequent stream operations. (#1020)asdict() utility method to MagikaResult.prediction.overwrite_reason to Overwrite.NONE if output.label is the same as dl.label. (#1023)…improvements, API enhancements, and a few breaking changes. This changelog entry rolls up all changes from v0.5.1, the last stable release.
Magika v0.6.1 is a significant update featuring a new model with 2x supported content types, a new command line client in Rust, performance improvements, API enhancements, and a few breaking changes. This changelog entry rolls up all changes from v0.5.1, the last stable release.
[!IMPORTANT] There are a few breaking changes! After reading about the new key features and improvements, we suggest to consult the migration guide below and the updated documentation.
standard_v3_2, which supports 2x content types (200+ in total, see full list here), has a similar ~99% average accuracy, and is ~20% faster, with an inference speed of about ~2ms on CPUs (YMMV depending on your testing setup). See models' CHANGELOG for more information.magika python package. This new client replaces the old client written in Python (but the old Python one is still available as a fallback for those platforms for which we don't have precompiled rust binaries).identify_stream(stream: typing.BinaryIO) API to infer content types from open binary streams. (#970)identify_path and identify_paths now accept Union[str, os.PathLike] objects. You no longer need to explicitly use pathlib.Path. (#935)MagikaResult, which is a absl::StatusOr-like object that wraps MagikaPrediction, with a clear separation between valid predictions and error situations; the output content types (label) are not just str anymore, but of type ContentTypeLabel, making integrations more robust (ContentTypeLabel extends StrEnum: thus, they are not just str, but you can treat them as such). The MagikaPrediction object now has additional is_text and extensions fields (in addition to the existing label, mime_type, group, and description).get_output_content_types(), get_model_content_types(), get_module_version(), and get_model_name().This release introduces several breaking changes. Please review this guide carefully to update your code:
identify_* API output format: The inference Python APIs now return a MagikaResult object, which is similar to absl::StatusOr; This provides a cleaner way to handle errors. dl.ct_label and output.ct_label are renamed to dl.label and output.label. labels are now of type ContentTypeLabel, which extends StrEnum (thus, they are not just str, but you can treat them as such). The score field is now at the top level, alongside dl and output. The magic field has been removed as it was often either incorrect or redundant; use description instead.Before (v0.5.x and earlier):
import magika
m = magika.Magika()
result = m.identify_path("my_file.py")
print(result.output.ct_label) # Assumed success
After (v0.6.1):
import magika
m = magika.Magika()
result = m.identify_path("my_file.py")
if result.ok():
print(result.output.label)
else:
print(f"Error: {result.status}")
score field is now at the top level, alongside dl and output, and is no longer nested within dl or output. The output also includes is_text and extensions fields. The magic metadata has been removed as it was often either incorrect or redundant; use description instead. Moreover, similarly to what happens under the hood with the StatusOr pattern, result.status indicates whether the prediction was successful, and the prediction results are available under the result.value key.Before (v0.5.x and earlier): (Illustrative example - adapt to your specific output)
{
"path": "code.py",
"dl": {
"ct_label": "python",
"score": 0.9940916895866394,
"group": "code",
"mime_type": "text/x-python",
"magic": "Python script",
"description": "Python source"
},
"output": {
"ct_label": "python",
"score": 0.9940916895866394,
"group": "code",
"mime_type": "text/x-python",
"magic": "Python script",
"description": "Python source"
}
}
After (v0.6.1):
{
"path": "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.9890000224113464
}
}
}
dl.label == ContentTypeLabel.UNDEFINED when the model is not used: There are situations in which the deep learning model is not used, for example when the file is too small or empty. In these cases, dl.label is now set to ContentTypeLabel.UNDEFINED instead of having the full dl block being set to None.Before (v0.5.x and earlier):
# ... (assuming successful result)
if prediction.dl is not None:
print(prediction.dl.ct_label)
After (v0.6.1):
# ... (assuming successful result)
if prediction.dl.label != magika.ContentTypeLabel.UNDEFINED:
print(prediction.dl.label)
javascript may not be detected as typescript. Consider using get_output_content_types() to dynamically retrieve the supported labels.$ magika-python-client.For a detailed list of all changes, including those from the -rc releases, please refer to the individual changelog entries for each release candidate:
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Add support for python 3.12. Magika now supports python >=3.8 and <3.13.
--list-output-content-types; see FAQs for context).New public python APIs: identify_paths, identify_path, identify_bytes.
identify_paths, identify_path, identify_bytes.MagikaResult object.-p/--output-probability has been renamed to -s/--output-score for consistency.standard_v1.- First release.
Your coding agent can read these notes before it upgrades. Set up the MCP server →