Debian Codegraph @

README.rst

raw
1 BrotliCFFI
2 ==========
3
4 .. image:: https://img.shields.io/pypi/v/brotlicffi
5 :alt: Version
6 :target: https://pypi.org/project/brotlicffi
7
8 .. image:: https://img.shields.io/conda/vn/conda-forge/brotlicffi
9 :alt: Version-Conda
10 :target: https://anaconda.org/conda-forge/brotlicffi
11
12 .. image:: https://pepy.tech/badge/brotlicffi
13 :alt: Downloads
14 :target: https://pepy.tech/project/brotlicffi
15
16 .. image:: https://img.shields.io/github/workflow/status/python-hyper/brotlicffi/CI/master
17 :alt: CI Status
18 :target: https://github.com/python-hyper/brotlicffi/actions
19
20 This library contains Python CFFI bindings for the reference Brotli encoder/decoder,
21 `available here`_. This allows Python software to use the Brotli compression
22 algorithm directly from Python code.
23
24 Install from PyPI:
25
26 .. code-block::
27
28 $ python -m pip install brotlicffi
29
30 Install from Conda:
31
32 .. code-block::
33
34 $ conda install -c conda-forge brotlicffi
35
36 To use it simply, try this:
37
38 .. code-block:: python
39
40 import brotlicffi
41 data = brotlicffi.decompress(compressed_data)
42
43 More information can be found `in the documentation`_.
44
45 .. _available here: https://github.com/google/brotli
46 .. _in the documentation: https://brotlipy.readthedocs.org
47
48 Using BrotliCFFI in Projects
49 ----------------------------
50
51 The API is 100% compatible with the `Brotli Python C bindings`_.
52 We recommend installing the C bindings on CPython and the CFFI
53 bindings everywhere else (PyPy, etc)
54
55 Essentially you use requirements like this:
56
57 .. code-block:: python
58
59 install_requires=[
60 "brotli; platform_python_implementation == 'CPython'",
61 "brotlicffi; platform_python_implementation != 'CPython'"
62 ]
63
64 and then import the correct Brotli library like so:
65
66 .. code-block:: python
67
68 try:
69 import brotlicffi as brotli
70 except ImportError:
71 import brotli
72
73 We provide an `example project`_ that shows how to use both
74 libraries together to support Brotli with multiple Python implementations.
75
76 .. _Brotli Python C bindings: https://pypi.org/project/Brotli
77 .. _example project: https://github.com/python-hyper/brotlipy/tree/master/example
78
79 License
80 -------
81
82 The source code of BrotliCFFI is available under the MIT license. Brotli itself
83 is made available under the Version 2.0 of the Apache Software License. See the
84 LICENSE and libbrotli/LICENSE files for more information.
85
86 Authors
87 -------
88
89 BrotliCFFI/brotlipy was authored by Cory Benfield and
90 is currently maintained by Seth Michael Larson.