Skip to main content

Python wrapper for libmagic

Project description

Github Actions Latest Version https://img.shields.io/pypi/wheel/cmagic.svg https://img.shields.io/pypi/pyversions/cmagic.svg https://img.shields.io/pypi/l/cmagic.svg

Python wrapper for libmagic.

Usage

# MacOS
$ export MAGIC=/usr/local/Cellar/libmagic/5.39/share/misc/magic.mgc

# Ubuntu
$ export MAGIC=/usr/lib/file/magic.mgc
import cmagic

m = cmagic.Magic()

if m.check(cmagic.MAGIC_DB):
   print("Database is ok")

m.load()

m.guess_file("/etc/hosts")
# 'ASCII text'

Installation

Ubuntu/Debian

apt-get install -y libmagic1 libmagic-mgc   # when using manilinux wheel
apt-get install -y libmagic-dev             # for building from sources
python3 -m pip install cmagic

Centos

yum install -y file-libs            # when using manilinux wheel
yum install -y file-devel           # for building from sources
python3 -m pip install cmagic

MacOS

brew install libmagic
python3 -m pip install cmagic

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmagic-0.3.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distributions

cmagic-0.3.2-cp38-cp38-manylinux2014_x86_64.whl (137.0 kB view details)

Uploaded CPython 3.8

cmagic-0.3.2-cp38-cp38-macosx_10_9_x86_64.whl (362.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

cmagic-0.3.2-cp37-cp37m-manylinux2014_x86_64.whl (138.6 kB view details)

Uploaded CPython 3.7m

cmagic-0.3.2-cp37-cp37m-macosx_10_9_x86_64.whl (361.9 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

cmagic-0.3.2-cp36-cp36m-manylinux2014_x86_64.whl (137.7 kB view details)

Uploaded CPython 3.6m

cmagic-0.3.2-cp36-cp36m-macosx_10_9_x86_64.whl (361.9 kB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

cmagic-0.3.2-cp35-cp35m-manylinux2014_x86_64.whl (137.4 kB view details)

Uploaded CPython 3.5m

cmagic-0.3.2-cp35-cp35m-macosx_10_6_intel.whl (364.7 kB view details)

Uploaded CPython 3.5m macOS 10.6+ intel

File details

Details for the file cmagic-0.3.2.tar.gz.

File metadata

  • Download URL: cmagic-0.3.2.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for cmagic-0.3.2.tar.gz
Algorithm Hash digest
SHA256 ebf773ab618c955ce03d74aca9e5c65457b68c0a51519bbcd198beb32e3b769b
MD5 7c883162f026f73c662b9f5dc2b3adfb
BLAKE2b-256 407e2d71ba4fa710c5ff9ac1918b309fd0c3f720a73a8f9b3b891da92a3b6cc6

See more details on using hashes here.

File details

Details for the file cmagic-0.3.2-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

  • Download URL: cmagic-0.3.2-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 137.0 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for cmagic-0.3.2-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d0599ae7cc2cbaab0b2822b9e959a55b6dfdb8bedd603a10871886d174259491
MD5 ce15f291ba982d028065737935471ecc
BLAKE2b-256 f8317fb0ea4abfbb948f7d475797ff674b5320f026b1c20431b468cbc7b0d9c0

See more details on using hashes here.

File details

Details for the file cmagic-0.3.2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: cmagic-0.3.2-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 362.0 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for cmagic-0.3.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 df9a20ffecfcbc763e8769ab72f53d1c2363a2b65243e0cb368c3e67ca37eb4a
MD5 9b7e7257f5aca2d8b4c4ba4c04a88437
BLAKE2b-256 3a3e0e59246a7ce87beba6a2dd412233b4241cd2b7d159dc8875226d7851f704

See more details on using hashes here.

File details

Details for the file cmagic-0.3.2-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: cmagic-0.3.2-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 138.6 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for cmagic-0.3.2-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c5d0d5c9e9db86771b44d863a68f79e20003a985fc1d55ef8e0ca13f4d79e831
MD5 31080b304b0a7774893e43f545824188
BLAKE2b-256 7b311dd50b3ebd60b64df435f9b32aa3bba89d837b42aabd22e40d678df8ef87

See more details on using hashes here.

File details

Details for the file cmagic-0.3.2-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: cmagic-0.3.2-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 361.9 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for cmagic-0.3.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 682bdcecb4b20f075ffb998e0d36f99b0009faef09dd62105d3ebac94f03c963
MD5 2b399d2e3bb59904d3a4cb0c0997b7af
BLAKE2b-256 f50424d98d78be0a474ad3ea544db6fbc72480be998fa7e4fbaf070055be7fb5

See more details on using hashes here.

File details

Details for the file cmagic-0.3.2-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: cmagic-0.3.2-cp36-cp36m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 137.7 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for cmagic-0.3.2-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5c6794946eb0a052fa9e08ceb1ee8b36ee5beb0fb8cfaf56de7c3f2ae132eb49
MD5 a2fd673b0e8c1082955005e2657af9be
BLAKE2b-256 1f5a6a2e9f2d80cf40277aa200436c6f5858015c8b292b834c56ab71824e9503

See more details on using hashes here.

File details

Details for the file cmagic-0.3.2-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: cmagic-0.3.2-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 361.9 kB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for cmagic-0.3.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 217ac9395ea7a2b1fd1f55fc4a6c438cdfaf7591f6d06852ae3b7c569c320f67
MD5 8ba8f2e28339dfc2689445cc3cda10b9
BLAKE2b-256 084721280e444936e1d7eb4f76d57af84287c030b3226c261855ffbb8690a6d3

See more details on using hashes here.

File details

Details for the file cmagic-0.3.2-cp35-cp35m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: cmagic-0.3.2-cp35-cp35m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 137.4 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for cmagic-0.3.2-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 507d56eb2c45ed0cc7c893f36941d02c4bc4464f680c8ce2bf4a52e3d8fdf6ec
MD5 7fbc819388478dbd5bddc38a8e510803
BLAKE2b-256 924e7824de94dffb88722f263ec67e364067a0c0f7b98af743f5b5b4b6e59d48

See more details on using hashes here.

File details

Details for the file cmagic-0.3.2-cp35-cp35m-macosx_10_6_intel.whl.

File metadata

  • Download URL: cmagic-0.3.2-cp35-cp35m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 364.7 kB
  • Tags: CPython 3.5m, macOS 10.6+ intel
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.3

File hashes

Hashes for cmagic-0.3.2-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 1679bef64457d77de8cc6d80d0c16af5922c6bafb7edb3c913f08b9747665851
MD5 bb5529b4d243acbfad122d1882bf5499
BLAKE2b-256 88b41f467df2192936ff0419b13bca054fb24dc127f8b9cc6d775febd0a5f77e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page