Skip to content

Commit d366f79

Browse files
committed
various rephrasals and addition of a couple asides
1 parent 9e53a2f commit d366f79

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

source/overview.rst

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,19 @@ If you rely on any non-Python code, or non-Python packages (such as
8989
`lxml <https://pypi.org/project/lxml/>`_, or BLAS libraries in the
9090
case of `numpy <https://pypi.org/project/numpy>`_), you will want to read on.
9191

92-
.. TODO: "Did you know?" about distributions providing multiple
93-
versions of the same package. Python packaging superpower!
94-
95-
Python binary distribution
96-
^^^^^^^^^^^^^^^^^^^^^^^^^^
92+
.. note:: Python and PyPI support multiple distributions providing
93+
different implementations of the same package. For instance the
94+
unmaintained-but-seminal `PIL distribution
95+
<https://pypi.org/project/PIL/>`_ provides the PIL package, and so
96+
does `Pillow <https://pypi.org/project/Pillow/>`_, an
97+
actively-maintained fork of PIL!
98+
99+
This Python packaging superpower makes it possible for Pillow to be
100+
a drop-in replacement for PIL, just by changing your project's
101+
`q`install_requires`` or ``requirements.txt``.
102+
103+
Python binary distributions
104+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
97105

98106
So much of Python's practical power comes from its ability to
99107
integrate with the software ecosystem, in particular libraries written
@@ -142,29 +150,22 @@ code, called libraries, between developers. We can piggyback
142150
library packaging, using technologies like `setuptools entry_points
143151
<http://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation>`_.
144152

145-
Generally libraries are building blocks, and not complete
146-
applications. For distributing applications, there's a whole world of
147-
technologies out there.
153+
Libraries are building blocks, not complete applications. For
154+
distributing applications, there's a whole new world of technologies
155+
out there.
148156

149157
The best way to organize these application packaging options is by the
150158
way they depend on the target environment. That's how we'll approach
151159
the coming sections.
152160

153-
.. TODO: Another way of thinking about packaging solutions is by how
154-
much they include. All solutions include your code, plus some
155-
amount of your code's library and service dependencies. PEX
156-
includes Python libraries. RPM includes a list of dependencies on
157-
libraries and local services. Images can be built to include
158-
everything.
159-
160161
Depending on a framework
161162
^^^^^^^^^^^^^^^^^^^^^^^^
162163

163164
Some types of Python applications, like web sites and services, are
164165
common enough that they have frameworks to enable their development
165166
and packaging. Other types of applications, like web and mobile
166-
clients, are advanced enough that the framework is more or less a
167-
necessity.
167+
clients, are advanced enough that a framework becomes more than a
168+
convenience.
168169

169170
In all these cases, it makes sense to work backwards, from the
170171
framework's packaging and deployment story. Some frameworks include a
@@ -232,6 +233,15 @@ Technologies which support this model:
232233
* `zipapp <https://docs.python.org/3/library/zipapp.html>`_ (does not help manage dependencies, requires Python 3.5+)
233234
* `shiv <https://github.com/linkedin/shiv#shiv>`_ (requires Python 3)
234235

236+
.. note:: Of all the approaches here, depending on a pre-installed
237+
Python relies the most on the target environment. Of course,
238+
this also makes for the smallest package, as small as
239+
single-digit megabytes, or even kilobytes.
240+
241+
In general, decreasing the dependency on the target system
242+
increases the size of our package, so the solutions here
243+
are roughly arranged by increasing size of output.
244+
235245
.. _depending-on-a-new-python:
236246

237247
Depending on a new Python ecosystem
@@ -278,8 +288,8 @@ Python interpreter and any other dependencies into a single executable
278288
file.
279289

280290
This approach, called *freezing*, offers wide compatiblity and
281-
seamless user experience, though often through a panel of
282-
technologies, and a good amount of effort.
291+
seamless user experience, though often requires multiple technologies,
292+
and a good amount of effort.
283293

284294
A selection of Python freezers:
285295

@@ -288,7 +298,7 @@ A selection of Python freezers:
288298
* `constructor <https://github.com/conda/constructor>`_ - For command-line installers
289299
* `py2exe <http://www.py2exe.org/>`_ - Windows only
290300
* `py2app <https://py2app.readthedocs.io/en/latest/>`_ - Mac only
291-
* `bbFreeze <https://pypi.python.org/pypi/bbfreeze>`_ - Windows, Linux, Python 2 only
301+
* `bbFreeze <https://pypi.org/project/bbfreeze>`_ - Windows, Linux, Python 2 only
292302
* `osnap <https://github.com/jamesabel/osnap>`_ - Windows and Mac
293303
* `pynsist <https://pypi.org/project/pynsist/>`_ - Windows only
294304

0 commit comments

Comments
 (0)