A lightweight, minimal python package that ships magic libraries using automake, CMake, scikit-build, and cibuildwheel.
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.
Release files for pylibmagic 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pylibmagic-0.5.0.tar.gz | 13.9 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pylibmagic-0.5.0-py3-none-musllinux_1_1_x86_64.whl | Python 3 | none | Linux musl 1.1+ x86-64 | Details |
| pylibmagic-0.5.0-py3-none-musllinux_1_1_aarch64.whl | Python 3 | none | Linux musl 1.1+ ARM64 | Details |
| pylibmagic-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| pylibmagic-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| pylibmagic-0.5.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
| pylibmagic-0.5.0-py3-none-macosx_10_9_x86_64.whl | Python 3 | none | macOS 10.9+ x86-64 | Details |
Total release size: 4.0 MB
Release files / pylibmagic-0.5.0.tar.gz
| Download URL | pylibmagic-0.5.0.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
942f4f194994f09021f6a4e6e6477ceeb28e4e92dc268fda10d96fa45c8c9ec4
|
|
BLAKE2b-256 checksum How to use checksums |
b243224e264598573f0e8befb13c1db7b5a28d1b43b5e7c26cc48eced1250f5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / pylibmagic-0.5.0-py3-none-musllinux_1_1_x86_64.whl
| Download URL | pylibmagic-0.5.0-py3-none-musllinux_1_1_x86_64.whl |
|---|---|
| Size | 658.3 kB |
| Tags | Linux musl 1.1+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
948e94de523211c01a8dc1eee235e3433bdc96a39d7ecf8039b814386c27b832
|
|
BLAKE2b-256 checksum How to use checksums |
6546b8a8cf8c30b9ef58c8f0d3ce8e86bf71764189e8e5b1d2f80dcbc1c422a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / pylibmagic-0.5.0-py3-none-musllinux_1_1_aarch64.whl
| Download URL | pylibmagic-0.5.0-py3-none-musllinux_1_1_aarch64.whl |
|---|---|
| Size | 652.9 kB |
| Tags | Linux musl 1.1+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
10efe9403e45f3c9f379800991fb5f73c0f0fc80db4ec79b5e6db4d0a437a253
|
|
BLAKE2b-256 checksum How to use checksums |
41c5a5205b60eea794a8d5db0310e6ae0031875c875c2b4d140fa57192678bcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / pylibmagic-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pylibmagic-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 619.4 kB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
24b5bb791d42653d2668913c7b9a789b5458a2fff09d0ec3c8af33a1204eea6a
|
|
BLAKE2b-256 checksum How to use checksums |
9949775ba344737cd503dc4dac029446d94f024e1744ef7755e89f4e7b146b5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / pylibmagic-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pylibmagic-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 617.4 kB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
e8614c1e9d7bb0c6b6989646e385a514acb111fed9ec64f50aaf0e21dcf7b7bb
|
|
BLAKE2b-256 checksum How to use checksums |
793031e159d326f893466d3911f174cad689c57ecb33769fddb63262a9b319e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / pylibmagic-0.5.0-py3-none-macosx_11_0_arm64.whl
| Download URL | pylibmagic-0.5.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 697.6 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f403cf26e530fa45bcb260fed80f1cecc2df777f2d0239078a234b4f2f97dbf7
|
|
BLAKE2b-256 checksum How to use checksums |
f969ddecd0e57b1eff57abaee3aad1f435621e9907a2ea900612f7c13cce4904
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / pylibmagic-0.5.0-py3-none-macosx_10_9_x86_64.whl
| Download URL | pylibmagic-0.5.0-py3-none-macosx_10_9_x86_64.whl |
|---|---|
| Size | 697.0 kB |
| Tags | Python 3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
6e4aed7e50e7be87c33d7616393ec605be494388576efe3baa300da1d4c99703
|
|
BLAKE2b-256 checksum How to use checksums |
23d72b22d223c4b667b5eacb8ab59c16ac907c66cd4a874e9565f4488e663880
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|