# python-magic — card for AI agents

Python binding for libmagic: tells a file's real type from its bytes, e.g. to check uploads.

Category: Files, images and media · PyPI package `python-magic` · latest version 0.4.27 (checked 2026-11-01)
Install: `pip install python-magic`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Numbers (AgentGid data)
- Gid Score: 58.4 (#1145 of all tools, 73 of 281 in its category)
- Used in 13 public projects set up for AI coding agents (0.2%)
- Downloads last week: 6,177,865 (as of 2026-11-24), +3.4% over 4 weeks
- GitHub stars: 2,924 (as of 2026-11-24)
- Last push: 2026-10-14

## Often used with
python-dotenv 92.6%, Pydantic 92.1%, NumPy 91.5%, Pillow 91.5%, Requests 91.0%, PyYAML 89.4%

## Links
- AgentGid page: https://agentgid.com/tools/python-magic/
- Homepage: http://github.com/ahupp/python-magic
- Repository: https://github.com/ahupp/python-magic

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
