source: general/prog/python3.xml

trunk
Last change on this file was aeda083, checked in by Bruce Dubbs <bdubbs@…>, 3 weeks ago

Fix md5sum for python docs.

  • Property mode set to 100644
File size: 13.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
7 <!ENTITY python3-download-http
8 "https://www.python.org/ftp/python/&python3-version;/Python-&python3-version;.tar.xz">
9 <!ENTITY python3-download-ftp " ">
10 <!ENTITY python3-md5sum "cb669514937d3e894e74081627722aa5">
11 <!ENTITY python3-size "19 MB">
12 <!ENTITY python3-buildsize "336 MB (add 60 MB for tests)">
13 <!ENTITY python3-time "1.5 SBU (add 0.7 SBU for tests; both using parallelism=4)">
14 <!--
15 Note: Size does not reflect docs that were installed in LFS.
16 Test time measured with 60 second timeout.
17 -->
18 <!ENTITY python3htmldoc-download-http
19 "https://www.python.org/ftp/python/doc/&python3-version;/python-&python3-version;-docs-html.tar.bz2">
20 <!ENTITY python3-docs-md5sum "35e90037a10d51af0c396b05bd64659d" >
21]>
22
23<sect1 id="python3" xreflabel="Python-&python3-version;">
24 <?dbhtml filename="python3.html" ?>
25
26
27 <title>Python-&python3-version;</title>
28
29 <indexterm zone="python3">
30 <primary sortas="a-Python3">Python3</primary>
31 </indexterm>
32
33 <sect2 role="package">
34 <title>Introduction to Python 3</title>
35
36 <para>
37 The <application>Python 3</application> package contains the
38 <application>Python</application> development environment.
39 This is useful for object-oriented programming, writing scripts,
40 prototyping large programs or developing entire applications.
41 </para>
42
43 <note>
44 <para>
45 <application>Python 3</application> was installed in LFS.
46 The only reason to rebuild it here is if optional modules
47 are needed, or to upgrade this package.
48 </para>
49 </note>
50
51 &lfs122_checked;
52
53 <important>
54 <para>
55 If upgrading to a new Python-3 minor version (for example,
56 from Python-3.11.x to Python-3.12.0), you will need to reinstall
57 any Python3 modules you have installed. You should also
58 reinstall packages that generate Python3 modules
59 including
60 &gobject-introspection;,
61 <xref linkend="libxml2"/>,
62 <xref linkend="opencv"/>,
63 <xref linkend="fontforge"/>,
64 <xref linkend="gnome-tweaks"/>,
65 <xref linkend="samba"/>, and
66 <xref linkend="graphviz"/> (if swig is installed).
67 </para>
68
69 <para>Before you upgrade, you can get a list of modules installed
70 with <command>pip3 list</command>. The list may be incomplete as
71 some Python modules are not installed with <command>pip3</command>,
72 for example the <literal>cracklib</literal> module installed by
73 <xref role='nodep' linkend='cracklib'/>. Use <command>ls
74 /usr/lib/python3.<replaceable>minor</replaceable>/site-packages</command>
75 for a comprehensive list.
76 </para>
77
78 <para>
79 The Python modules from LFS will also have to be reinstalled:
80 <ulink url="&lfs-root;/chapter08/flit-core.html">flit-core</ulink>,
81 <ulink url="&lfs-root;/chapter08/wheel.html">wheel</ulink>,
82 <ulink url="&lfs-root;/chapter08/setuptools.html">setuptools</ulink>,
83 <ulink url="&lfs-root;/chapter08/meson.html">meson</ulink>,
84 <ulink url="&lfs-root;/chapter08/markupsafe.html">MarkupSafe</ulink>,
85 and <ulink url="&lfs-root;/chapter08/jinja2.html">Jinja2</ulink>.
86 </para>
87 </important>
88
89 <bridgehead renderas="sect3">Package Information</bridgehead>
90 <itemizedlist spacing="compact">
91 <listitem>
92 <para>
93 Download (HTTP): <ulink url="&python3-download-http;"/>
94 </para>
95 </listitem>
96 <listitem>
97 <para>
98 Download (FTP): <ulink url="&python3-download-ftp;"/>
99 </para>
100 </listitem>
101 <listitem>
102 <para>
103 Download MD5 sum: &python3-md5sum;
104 </para>
105 </listitem>
106 <listitem>
107 <para>
108 Download size: &python3-size;
109 </para>
110 </listitem>
111 <listitem>
112 <para>
113 Estimated disk space required: &python3-buildsize;
114 </para>
115 </listitem>
116 <listitem>
117 <para>
118 Estimated build time: &python3-time;
119 </para>
120 </listitem>
121 </itemizedlist>
122
123 <bridgehead renderas="sect3">Additional Optional Download</bridgehead>
124 <itemizedlist spacing="compact">
125 <listitem>
126 <para>
127 Download (HTTP): <ulink url="&python3htmldoc-download-http;"/>
128 </para>
129 </listitem>
130 <listitem>
131 <para>
132 Download MD5 sum: &python3-docs-md5sum;
133 </para>
134 </listitem>
135 </itemizedlist>
136
137 <bridgehead renderas="sect3">Python 3 Dependencies</bridgehead>
138
139 <bridgehead renderas="sect4">Recommended</bridgehead>
140 <para role="recommended">
141 <xref linkend="sqlite"/> (required if building firefox or thunderbird)
142 </para>
143
144 <bridgehead renderas="sect4">Optional</bridgehead>
145 <para role="optional">
146 <xref linkend="bluez"/>,
147 <xref linkend="gdb"/> (required for some tests),
148 <xref linkend="valgrind"/>, and
149 <ulink url="https://www.bytereef.org/mpdecimal/">libmpdec</ulink>
150 </para>
151
152 <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
153 <para role="optional">
154 <xref linkend="libnsl"/>,
155 <xref linkend="tk"/>, and
156 &berkeley-db;
157 </para>
158
159 <para condition="html" role="usernotes">Editor Notes:
160 <ulink url="&blfs-wiki;/Python3"/>
161 </para>
162 </sect2>
163
164 <sect2 role="installation">
165 <title>Installation of Python 3</title>
166
167 <para>
168 Install <application>Python 3</application> by running the following
169 commands:
170 </para>
171
172<screen><userinput>CXX="/usr/bin/g++" \
173./configure --prefix=/usr \
174 --enable-shared \
175 --with-system-expat \
176 --enable-optimizations &amp;&amp;
177make</userinput></screen>
178
179 <para>
180 Some tests are known to occasionally hang indefinitely. So to test
181 the results, run the test suite but set a 2-minute time limit for each
182 test case:
183 </para>
184
185<screen remap='test'><userinput>make test TESTOPTS="--timeout 120"</userinput></screen>
186
187 <!--
188 For Python-3.12.3 all tests pass
189 Total tests: run=41,778 skipped=1,155
190 Total test files: run=485/488 skipped=24 resource_denied=3
191
192 For Python-3.13.4
193 Total tests: run=42,152 failures=6 skipped=1,234
194 Total test files: run=487/489 failed=4 skipped=17 resource_denied=6 rerun=4
195 -->
196
197 <para>
198 For a relatively slow system you may need to increase the time
199 limit and 1 SBU (measured when building Binutils pass 1 with one CPU
200 core) should be enough. Some tests are flaky, so the test suite will
201 automatically re-run failed tests. If a test failed but then passed
202 when re-run, it should be considered as passed.
203 </para>
204
205 <para>
206 Of over 42,000 tests, the following are known to fail: test__xxsubinterpreters,
207 test_import, test_interpreters, and test_threading.
208 </para>
209
210 <para>
211 Now, as the <systemitem class="username">root</systemitem> user:
212 </para>
213
214<screen role="root"><userinput>make install</userinput></screen>
215
216 <para>
217 If upgrading and the documentation has been downloaded, optionally install
218 it as the &root; user:
219 </para>
220
221<screen role="root"><userinput>install -v -dm755 /usr/share/doc/python-&python3-version;/html
222
223tar --strip-components=1 \
224 --no-same-owner \
225 --no-same-permissions \
226 -C /usr/share/doc/python-&python3-version;/html \
227 -xvf ../python-&python3-version;-docs-html.tar.bz2</userinput></screen>
228
229 </sect2>
230
231 <sect2 role="commands">
232 <title>Command Explanations</title>
233
234 <para>
235 <command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
236 message during configuration.
237 </para>
238
239 <para>
240 <parameter>--with-system-expat</parameter>: This switch enables linking
241 against the system version of <application>Expat</application>.
242 </para>
243
244<!--
245 <para>
246 <parameter>- -with-ensurepip=yes</parameter> : This switch enables building
247 the <command>pip</command> and <command>setuptools</command> packaging
248 programs. <command>setuptools</command> is needed for building some
249 Python modules.
250 </para>
251-->
252
253 <para>
254 <parameter>--enable-optimizations</parameter>: This switch enables
255 stable, but expensive, optimizations.
256 </para>
257
258 <para>
259 <option>--with-lto</option>: This optional switch enables thick Link
260 Time Optimization. Unusually, it creates a much larger <filename
261 class="libraryfile">/usr/lib/python&python3-majorver;/config-&python3-majorver;-&lt;arch&gt;-linux-gnu/libpython&python3-majorver;.a</filename>
262 with a small increase in the time to compile
263 <application>Python</application>. Run-time results do not appear to show
264 any benefit from doing this.
265 </para>
266
267 </sect2>
268
269 <sect2 role="configuration">
270 <title>Configuring Python 3</title>
271
272 <para>
273 In order for <command>python3</command> to find the installed
274 documentation, create the following version independent symlink:
275 </para>
276
277<screen role="root"><userinput>ln -svfn python-&python3-version; /usr/share/doc/python-3</userinput></screen>
278
279 <para>
280 and add the following environment variable to the individual user's or
281 system's profile:
282 </para>
283
284<screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-3/html</userinput></screen>
285
286 </sect2>
287
288 <sect2 role="content">
289 <title>Contents</title>
290
291 <segmentedlist>
292 <segtitle>Installed Programs</segtitle>
293 <segtitle>Installed Libraries</segtitle>
294 <segtitle>Installed Directories</segtitle>
295
296 <seglistitem>
297 <seg>
298 2to3 (symlink) and
299 2to3-&python3-majorver;,
300
301 <!--
302 easy_install-&python3-majorver;,
303 -->
304
305 idle3 (symlink) and
306 idle&python3-majorver;,
307
308 pip3 and
309 pip&python3-majorver;,
310
311 pydoc3 (symlink) and
312 pydoc&python3-majorver;,
313
314 python3 (symlink) and
315 python&python3-majorver;, and
316
317 python3-config (symlink) and
318 python&python3-majorver;-config
319 </seg>
320 <seg>
321 libpython&python3-majorver;.so and libpython3.so
322 </seg>
323 <seg>
324 /usr/include/python&python3-majorver;,
325 /usr/lib/python&python3-majorver;, and
326 /usr/share/doc/python-&python3-version;
327 </seg>
328 </seglistitem>
329 </segmentedlist>
330
331 <variablelist>
332 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
333 <?dbfo list-presentation="list"?>
334 <?dbhtml list-presentation="table"?>
335 <!--
336 <varlistentry id="2to3">
337 <term><command>2to3</command></term>
338 <listitem>
339 <para>
340 is designed to assist in the transition between python2 and python3
341 by automatically converting code to be Python3 compatible.
342 </para>
343 <indexterm zone="python3 2to3">
344 <primary sortas="b-2to3">2to3</primary>
345 </indexterm>
346 </listitem>
347 </varlistentry>
348 Put here for easy use when removing Python2 -->
349 <!--
350 <varlistentry id="easy_install">
351 <term><command>easy_install</command></term>
352 <listitem>
353 <para>
354 is a frontend to pip3 to make it easier to configure python modules
355 through the PIP package manager
356 </para>
357 <indexterm zone="python3 easy_install">
358 <primary sortas="python3 easy_install">easy_install</primary>
359 </indexterm>
360 </listitem>
361 </varlistentry>
362 -->
363 <varlistentry id="idle3">
364 <term><command>idle3</command></term>
365 <listitem>
366 <para>
367 is a wrapper script that opens a <application>Python</application>
368 aware GUI editor. For this script to run, you must have installed
369 <application>Tk</application> before Python so that the Tkinter
370 Python module is built
371 </para>
372 <indexterm zone="python3 idle3">
373 <primary sortas="b-idle3">idle3</primary>
374 </indexterm>
375 </listitem>
376 </varlistentry>
377
378 <varlistentry id="pydoc3">
379 <term><command>pydoc3</command></term>
380 <listitem>
381 <para>
382 is the <application>Python</application> documentation
383 tool
384 </para>
385 <indexterm zone="python3 pydoc3">
386 <primary sortas="b-pydoc3">pydo3c</primary>
387 </indexterm>
388 </listitem>
389 </varlistentry>
390
391 <varlistentry id="python3-prog">
392 <term><command>python3</command></term>
393 <listitem>
394 <para>
395 is an interpreted, interactive, object-oriented programming
396 language
397 </para>
398 <indexterm zone="python3 python3-prog">
399 <primary sortas="b-python3">python3</primary>
400 </indexterm>
401 </listitem>
402 </varlistentry>
403
404 <varlistentry id="python-ver">
405 <term><command>python&python3-majorver;</command></term>
406 <listitem>
407 <para>
408 is a version-specific name for the <command>python</command>
409 program
410 </para>
411 <indexterm zone="python3 python-ver">
412 <primary sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
413 </indexterm>
414 </listitem>
415 </varlistentry>
416 <!--
417 <varlistentry id="pyvenv">
418 <term><command>pyvenv</command></term>
419 <listitem>
420 <para>
421 creates virtual <application>Python</application> environments in
422 one or more target directories.
423 </para>
424 <indexterm zone="python3 pyvenv">
425 <primary
426 sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
427 </indexterm>
428 </listitem>
429 </varlistentry>
430 -->
431 </variablelist>
432
433 </sect2>
434
435</sect1>
Note: See TracBrowser for help on using the repository browser.