Skip to content

Commit 9ca6ebe

Browse files
authored
Add optional dependency on pyvips-binary (#507)
* Add optional dependency on `pyvips-binary` Allowing users to install pyvips with binary packages via: pip install "pyvips[binary]" See: https://pypi.org/project/pyvips-binary/. * Update README.rst for `pyvips-binary`
1 parent 17da7bd commit 9ca6ebe

File tree

3 files changed

+48
-34
lines changed

3 files changed

+48
-34
lines changed

Diff for: .github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CI
22

3-
on: [ push, pull_request ]
3+
on: [push, pull_request]
44

55
jobs:
66
CI:

Diff for: README.rst

+46-33
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ https://libvips.github.io/pyvips/
1919

2020
This module wraps the libvips image processing library:
2121

22-
https://libvips.github.io/libvips/
22+
https://www.libvips.org/
2323

2424
The libvips docs are also very useful:
2525

26-
https://libvips.github.io/libvips/API/current/
26+
https://www.libvips.org/API/current/
2727

2828
If you have the development headers for libvips installed and have a working C
29-
compiler, this module will use cffi API mode to try to build a libvips
30-
binary extension for your Python.
29+
compiler, this module will use cffi API mode to try to build a libvips
30+
binary extension for your Python.
3131

3232
If it is unable to build a binary extension, it will use cffi ABI mode
3333
instead and only needs the libvips shared library. This takes longer to
34-
start up and is typically ~20% slower in execution. You can find out if
34+
start up and is typically ~20% slower in execution. You can find out if
3535
API mode is being used with:
3636

3737
.. code-block:: python
@@ -41,7 +41,7 @@ API mode is being used with:
4141
print(pyvips.API_mode)
4242
4343
This binding passes the vips test suite cleanly and with no leaks under
44-
python3 and pypy3 on Windows, macOS and Linux.
44+
python3 and pypy3 on Windows, macOS and Linux.
4545

4646
How it works
4747
------------
@@ -53,31 +53,45 @@ pipeline executes at once, streaming the image in parallel from source to
5353
destination a section at a time.
5454

5555
Because ``pyvips`` is parallel, it's quick, and because it doesn't need to
56-
keep entire images in memory, it's light. For example, the libvips
56+
keep entire images in memory, it's light. For example, the libvips
5757
speed and memory use benchmark:
5858

5959
https://github.com/libvips/libvips/wiki/Speed-and-memory-use
6060

6161
Loads a large tiff image, shrinks by 10%, sharpens, and saves again. On this
6262
test ``pyvips`` is typically 3x faster than ImageMagick and needs 5x less
63-
memory.
63+
memory.
6464

6565
There's a handy chapter in the docs explaining how libvips opens files,
6666
which gives some more background.
6767

68-
http://libvips.github.io/libvips/API/current/How-it-opens-files.md.html
68+
https://www.libvips.org/API/current/How-it-opens-files.html
6969

70-
Install
71-
-------
70+
Binary installation
71+
-------------------
72+
73+
The quickest way to start with pyvips is by installing the binary package
74+
with:
75+
76+
.. code-block:: shell
7277
73-
You need the libvips shared library on your library search path,
74-
version 8.2 or later, though at least version 8.9 is required for all features
75-
to work. See:
78+
$ pip install "pyvips[binary]"
7679
77-
https://libvips.github.io/libvips/install.html
80+
This installs a self-contained package with the most commonly needed
81+
libraries. If your platform is unsupported or the pre-built binary is
82+
unsuitable, you can install libvips globally instead.
7883

79-
Linux install
80-
-------------
84+
Local installation
85+
------------------
86+
87+
You need the libvips shared library on your library search path, version 8.2
88+
or later, though at least version 8.9 is required for all features to work.
89+
See:
90+
91+
https://www.libvips.org/install.html
92+
93+
Linux
94+
^^^^^
8195

8296
Perhaps:
8397

@@ -94,22 +108,22 @@ With python 3.11 and later, you will need to create a venv first and add
94108
$ python3 -m venv ~/.local
95109
$ pip install pyvips
96110
97-
macOS install
98-
-------------
111+
macOS
112+
^^^^^
99113

100-
With homebrew:
114+
With Homebrew:
101115

102116
.. code-block:: shell
103117
104118
$ brew install vips python pkg-config
105119
$ pip3 install pyvips
106120
107-
Windows install
108-
---------------
121+
Windows
122+
^^^^^^^
109123

110-
on Windows you can download a pre-compiled binary from the libvips website.
124+
On Windows, you can download a pre-compiled binary from the libvips website.
111125

112-
https://libvips.github.io/libvips/install.html
126+
https://www.libvips.org/install.html
113127

114128
You'll need a 64-bit Python. The official one works well.
115129

@@ -123,15 +137,15 @@ start of your program:
123137
.. code-block:: python
124138
125139
import os
126-
vipsbin = r'c:\vips-dev-8.13\bin'
140+
vipsbin = r'c:\vips-dev-8.16\bin'
127141
os.environ['PATH'] = vipsbin + ';' + os.environ['PATH']
128142
129143
For Python 3.8 and later, you need:
130144

131145
.. code-block:: python
132146
133147
import os
134-
vipsbin = r'c:\vips-dev-8.13\bin'
148+
vipsbin = r'c:\vips-dev-8.16\bin'
135149
add_dll_dir = getattr(os, 'add_dll_directory', None)
136150
if callable(add_dll_dir):
137151
add_dll_dir(vipsbin)
@@ -140,10 +154,10 @@ For Python 3.8 and later, you need:
140154
141155
Now when you import pyvips, it should be able to find the DLLs.
142156

143-
conda install
144-
-------------
157+
Conda
158+
^^^^^
145159

146-
The conda package includes a matching libvips binary, so just enter:
160+
The Conda package includes a matching libvips binary, so just enter:
147161

148162
.. code-block:: shell
149163
@@ -184,7 +198,7 @@ Run all tests:
184198

185199
.. code-block:: shell
186200
187-
$ tox
201+
$ tox
188202
189203
Run test suite:
190204

@@ -237,9 +251,9 @@ then
237251
.. code-block:: shell
238252
239253
$ cd doc; \
240-
python3 -c "import pyvips; pyvips.Operation.generate_sphinx_all()" > x
254+
python3 -c "import pyvips; pyvips.Operation.generate_sphinx_all()" > x
241255
242-
And copy-paste ``x`` into the obvious place in ``doc/vimage.rst``.
256+
And copy-paste ``x`` into the obvious place in ``doc/vimage.rst``.
243257

244258
Update version number:
245259

@@ -256,4 +270,3 @@ Update pypi package:
256270
$ twine upload --repository pyvips dist/*
257271
$ git tag -a v2.2.0 -m "as uploaded to pypi"
258272
$ git push origin v2.2.0
259-

Diff for: pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ exclude = [
7474
]
7575

7676
[project.optional-dependencies]
77+
binary = ["pyvips-binary"]
7778
# All the following are used for our own testing
7879
tox = ["tox"]
7980
test = [

0 commit comments

Comments
 (0)