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("/bin/sh")
# '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.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8

cmagic-0.3.1-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.1-cp37-cp37m-manylinux2014_x86_64.whl (138.6 kB view details)

Uploaded CPython 3.7m

cmagic-0.3.1-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.1-cp36-cp36m-manylinux2014_x86_64.whl (137.7 kB view details)

Uploaded CPython 3.6m

cmagic-0.3.1-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.1-cp35-cp35m-manylinux2014_x86_64.whl (137.4 kB view details)

Uploaded CPython 3.5m

cmagic-0.3.1-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.1.tar.gz.

File metadata

  • Download URL: cmagic-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 713cd63d32ac4c53fe9272aba51d3fd6739e64788d5be54cc6d1a1fb989b0e1d
MD5 9462ba7b7727acb2bc4d001a2a4c989d
BLAKE2b-256 4eddc08812f2d31fbc7c5518c48b60078c7afc312ebda04ae0b92987e152fbd9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmagic-0.3.1-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.1-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cb0a1a9efcda62a301a6719ed605f2a770c7a400e5ebbe718c169a083c849b15
MD5 687f2b0d59d5f294cc368e7686e82686
BLAKE2b-256 ebf25f1d20e91b1ecf908781b27e5ebec0340a02ee7b407ea6eb519251728123

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmagic-0.3.1-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.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0bd9749dbd691d711f95a8ae8ca2f8d5b1d5d5e31201e83ee1806dd42991684a
MD5 51a176a8dae40a755ae7da9b43f2b7f0
BLAKE2b-256 70ee8fc048565c1c30eaf9fe181941e08056263487593c856e5bd5a64e0c8193

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmagic-0.3.1-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.1-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea609091ed6d87716b5f601ccff87fb09e8a876dc7966e23755855782cbb8fa5
MD5 36473269be089a29ae0e25233e12ea60
BLAKE2b-256 10bd99252de0e2723465a219804c4917a60b29b64d9ec730a1ef9d7c7e734978

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmagic-0.3.1-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.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ccc7650db7a64d2978b2495784ba056756b95edee6fb5aa16b01bfddfeb70292
MD5 4fa4f95b14ae20c9fb312132c8fc1f89
BLAKE2b-256 95fb983b2142e518ead32373180c9f2b141b6a92c990ab863a7e6a834733e6fb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmagic-0.3.1-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.1-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8690d39804843841d37518a9e6f21848646137a60c2c17237057d84cdc74fcb2
MD5 776a3382f8fad9272807e0aa70a0d47c
BLAKE2b-256 4bf696601c1b9d869a76514a12a227db3b8bdc19a8bf33edb4cc41c33c52c41a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmagic-0.3.1-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.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7138f73886fd0324d109c99c459a42ae13a6c9f600491dee36b5e31030fbbbca
MD5 c32435636261ecc0baaf33cdab920a62
BLAKE2b-256 bc3d623f79600759bc9d2d7d7ed503964d1f5ba52801bcfdb4674f9c81603f02

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmagic-0.3.1-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.1-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e81a223c02c8049e0cbc76eefd0789f13d1de4ff6497fd183eb51ecac5c975b
MD5 0ba10b923c01bbfb5a502f04b48065f8
BLAKE2b-256 4b72c5eda39b1bc5a85f9a49b75fc6afc4392d7c675e02a849e11307716e51ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cmagic-0.3.1-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.1-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 a1ff7d2993985377dd4d592e0ee07cbe524495a2ade866e375588ccd5d36e353
MD5 645cc65c781d4997436feb5e1c3fd30b
BLAKE2b-256 72b6cb2e872b8824162c4845ec15db45cb6346a7b70a18adef853c9d46f89102

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