ahupp/python-magic
A python wrapper for libmagic observed · 2026-08-28
Health v2 · maintenance only
74/100
- Activity 93
- Release rhythm 35
- Longevity 100
Flags: no_releases no_license
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 5999
- days_rel: n/a
- days_push: 44
- n_releases_24m: 0
Adoption not part of the score
2917 stars · 304 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
python-magic is a Python wrapper around the libmagic C library, the same engine behind the Unix `file` command. It identifies file types and MIME types by inspecting file headers rather than extensions.
Use cases
- detect the real file type of an uploaded file
- get the mime type of a file in python
- validate that uploads are actually pdfs or images
- identify file type from a byte buffer
- detect content type without relying on file extensions
When to choose
- you need reliable, header-based file type or MIME detection in Python
- you want the same identification behavior as the Unix `file` command
- you are validating user-uploaded files by content
When to avoid
- you cannot install native libmagic dependencies in your environment
- you only need simple extension-based checks
- you need pure-Python file type detection without C library bindings
Facets
library · maturity stable
file-system developer-tools files developer-tools python windows cross-platform libmagic file-type-detection mime-type wrapper linux macos
2 sources
- readme: https://github.com/ahupp/python-magic · fetched 2026-08-28 · da215a936a40
- registry_pypi: https://pypi.org/pypi/python-magic/json · fetched 2026-08-29 · 49c719c87818
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| ahupp/python-magic | main | 74 |
For agents
markdown · JSON · MCP: product_card(name="ahupp/python-magic")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem