Metadata-Version: 2.1
Name: pylibmagic
Version: 0.5.0
Summary: scikit-build project with CMake for compiling libmagic
Author-Email: Giordon Stark <kratsg@gmail.com>
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Project-URL: Bug tracker, https://github.com/kratsg/pylibmagic/issues
Project-URL: Changelog, https://github.com/kratsg/pylibmagic/releases
Project-URL: Discussions, https://github.com/kratsg/pylibmagic/discussions
Project-URL: Documentation, https://pylibmagic.readthedocs.io/
Project-URL: Homepage, https://github.com/kratsg/pylibmagic
Requires-Python: >=3.7
Requires-Dist: importlib-resources; python_version < "3.9"
Requires-Dist: typing-extensions>=3.7; python_version < "3.8"
Requires-Dist: pytest-cov>=3; extra == "dev"
Requires-Dist: pytest>=6; extra == "dev"
Requires-Dist: tbump>=6.7.0; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: myst-parser>=0.13; extra == "docs"
Requires-Dist: sphinx-book-theme>=0.1.0; extra == "docs"
Requires-Dist: sphinx-copybutton; extra == "docs"
Requires-Dist: Sphinx>=4.0; extra == "docs"
Requires-Dist: pytest-cov>=3; extra == "test"
Requires-Dist: pytest>=6; extra == "test"
Requires-Dist: python-magic; extra == "test"
Provides-Extra: dev
Provides-Extra: docs
Provides-Extra: test
Description-Content-Type: text/x-rst

pylibmagic v0.5.0
=================

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 <https://github.com/ahupp/python-magic>`__, you typically get an error like this

.. code:: pycon

   >>> 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:

.. code:: pycon

   >>> import pylibmagic
   >>> import magic

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

Compiling
---------

.. code:: bash

   $ 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
----------

.. code:: bash

   $ python3 -m pip install pylibmagic

and the libraries are installed at

.. code:: bash

    $ 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:

.. code:: bash

   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.

.. |Actions Status| image:: https://github.com/kratsg/pylibmagic/workflows/CI/badge.svg
   :target: https://github.com/kratsg/pylibmagic/actions
.. |Cirrus Status| image:: https://api.cirrus-ci.com/github/kratsg/pylibmagic.svg?branch=main
   :target: https://cirrus-ci.com/github/kratsg/pylibmagic
.. |Documentation Status| image:: https://readthedocs.org/projects/pylibmagic/badge/?version=latest
   :target: https://pylibmagic.readthedocs.io/en/latest/?badge=latest
.. |Code style: black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
   :target: https://github.com/psf/black
.. |PyPI version| image:: https://badge.fury.io/py/pylibmagic.svg
   :target: https://pypi.org/project/pylibmagic/
.. |PyPI platforms| image:: https://img.shields.io/pypi/pyversions/pylibmagic
   :target: https://pypi.org/project/pylibmagic/
.. |GitHub Discussion| image:: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
   :target: https://github.com/kratsg/pylibmagic/discussions
.. |Gitter| image:: https://badges.gitter.im/https://github.com/kratsg/pylibmagic/community.svg
   :target: https://gitter.im/https://github.com/kratsg/pylibmagic/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
