Skip to main content

scikit-build project with CMake for compiling libmagic

Project description

A lightweight, minimal python package that ships magic libraries using automake, CMake, scikit-build, and cibuildwheel.

Actions Status Cirrus Status Documentation Status Code style: black

PyPI version PyPI platforms

GitHub Discussion Gitter

Why?

If you use python-magic, you typically get an error like this

>>> import magic
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/kratsg/.pyenv/versions/venv/lib/python3.7/site-packages/magic/__init__.py", line 209, in <module>
    libmagic = loader.load_lib()
  File "/Users/kratsg/.pyenv/versions/venv/lib/python3.7/site-packages/magic/loader.py", line 49, in load_lib
    raise ImportError('failed to find libmagic.  Check your installation')
ImportError: failed to find libmagic.  Check your installation

which is frustrating because they don’t ship shared lib with their python distribution. pylibmagic helps fill in the missing gap by shipping the required magic library and adding it to your path, so you can just do:

>>> import pylibmagic
>>> import magic

and be on your way. pylibmagic is designed to be very minimal and lightweight.

Compiling

$ docker run -it --rm -v $PWD:/home/root -w /home/root ubuntu
# apt install cmake autoconf automake libtool build-essential git python3-dev python3-pip
# cmake -S . -B build
# cmake --build build

Installing

$ python3 -m pip install pylibmagic

and the libraries are installed at

$ python -c "import pylibmagic; print(pylibmagic.data)"

Releasing

To release, due to concurrency issues, we need to push the tag after Cirrus CI finishes with the building for pushing to the main branch. So the order is typically:

tbump 0.5.0 --no-tag-push
# wait until Cirrus CI finishes
git push origin v0.5.0
# wait until Cirrus CI finishes
gh release create

See [cirruslabs/cirrus-ci-docs#1167](https://github.com/cirruslabs/cirrus-ci-docs/issues/1167) for more details.

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

pylibmagic-0.5.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distributions

pylibmagic-0.5.0-py3-none-musllinux_1_1_x86_64.whl (658.3 kB view details)

Uploaded Python 3 musllinux: musl 1.1+ x86-64

pylibmagic-0.5.0-py3-none-musllinux_1_1_aarch64.whl (652.9 kB view details)

Uploaded Python 3 musllinux: musl 1.1+ ARM64

pylibmagic-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (619.4 kB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

pylibmagic-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (617.4 kB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

pylibmagic-0.5.0-py3-none-macosx_11_0_arm64.whl (697.6 kB view details)

Uploaded Python 3 macOS 11.0+ ARM64

pylibmagic-0.5.0-py3-none-macosx_10_9_x86_64.whl (697.0 kB view details)

Uploaded Python 3 macOS 10.9+ x86-64

File details

Details for the file pylibmagic-0.5.0.tar.gz.

File metadata

  • Download URL: pylibmagic-0.5.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pylibmagic-0.5.0.tar.gz
Algorithm Hash digest
SHA256 942f4f194994f09021f6a4e6e6477ceeb28e4e92dc268fda10d96fa45c8c9ec4
MD5 b3422410689677386b8bd60a2b8f49ef
BLAKE2b-256 b243224e264598573f0e8befb13c1db7b5a28d1b43b5e7c26cc48eced1250f5c

See more details on using hashes here.

File details

Details for the file pylibmagic-0.5.0-py3-none-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pylibmagic-0.5.0-py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 948e94de523211c01a8dc1eee235e3433bdc96a39d7ecf8039b814386c27b832
MD5 114a8182b0bf723eea05a3b812b0f174
BLAKE2b-256 6546b8a8cf8c30b9ef58c8f0d3ce8e86bf71764189e8e5b1d2f80dcbc1c422a0

See more details on using hashes here.

File details

Details for the file pylibmagic-0.5.0-py3-none-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for pylibmagic-0.5.0-py3-none-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 10efe9403e45f3c9f379800991fb5f73c0f0fc80db4ec79b5e6db4d0a437a253
MD5 d9d21724c6323eae71bc62ccbb08dcef
BLAKE2b-256 41c5a5205b60eea794a8d5db0310e6ae0031875c875c2b4d140fa57192678bcb

See more details on using hashes here.

File details

Details for the file pylibmagic-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pylibmagic-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 24b5bb791d42653d2668913c7b9a789b5458a2fff09d0ec3c8af33a1204eea6a
MD5 90f082810486f3a9c16da61425b8aefd
BLAKE2b-256 9949775ba344737cd503dc4dac029446d94f024e1744ef7755e89f4e7b146b5f

See more details on using hashes here.

File details

Details for the file pylibmagic-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pylibmagic-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e8614c1e9d7bb0c6b6989646e385a514acb111fed9ec64f50aaf0e21dcf7b7bb
MD5 443bfb092c98d1aeecda470d0c46b712
BLAKE2b-256 793031e159d326f893466d3911f174cad689c57ecb33769fddb63262a9b319e8

See more details on using hashes here.

File details

Details for the file pylibmagic-0.5.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pylibmagic-0.5.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f403cf26e530fa45bcb260fed80f1cecc2df777f2d0239078a234b4f2f97dbf7
MD5 bd09688044d8628f698a48d4f0ed1736
BLAKE2b-256 f969ddecd0e57b1eff57abaee3aad1f435621e9907a2ea900612f7c13cce4904

See more details on using hashes here.

File details

Details for the file pylibmagic-0.5.0-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pylibmagic-0.5.0-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6e4aed7e50e7be87c33d7616393ec605be494388576efe3baa300da1d4c99703
MD5 905d65aca4dd7d830488a4ab930e1d40
BLAKE2b-256 23d72b22d223c4b667b5eacb8ab59c16ac907c66cd4a874e9565f4488e663880

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