Debian Codegraph @

doc/bootstrap.rst

raw
1 Bootstrapping
2 =============
3
4 Flit is itself packaged using Flit, as are some foundational packaging tools
5 such as ``pep517``. So where can you start if you need to install everything
6 from source?
7
8 .. note::
9
10 For most users, ``pip`` handles all this automatically. You should only need
11 to deal with this if you're building things entirely from scratch, such as
12 putting Python packages into another package format.
13
14 The key piece is ``flit_core``. This is a package which can build itself using
15 nothing except Python and the standard library. From an unpacked source archive,
16 you can make a wheel by running::
17
18 python -m flit_core.wheel
19
20 And then you can install this wheel with the ``bootstrap_install.py`` script
21 included in the sdist (or by unzipping it to the correct directory)::
22
23 # Install to site-packages for this Python:
24 python bootstrap_install.py dist/flit_core-*.whl
25
26 # Install somewhere else:
27 python bootstrap_install.py --installdir /path/to/site-packages dist/flit_core-*.whl
28
29 .. note::
30
31 This note only applies if you need to unbundle or unvendor dependencies.
32
33 ``flit_core`` unconditionally bundles the ``tomli`` TOML parser,
34 to avoid a dependency cycle for older versions of Python that don't include
35 the standard library :mod:`tomllib` module.
36
37 The ``tomli`` library is only used on Python 3.10 and older, meaning that
38 if you use Python 3.11 or newer you can simply remove the bundled ``tomli``.
39 Otherwise, you must special-case installing ``flit_core`` and/or ``tomli``
40 to resolve the dependency cycle between the two packages.
41
42 After ``flit_core``, I recommend that you get `installer
43 <https://pypi.org/project/installer/>`_ set up. You can use
44 ``python -m flit_core.wheel`` again to make a wheel, and then use installer
45 itself (from the source directory) to install it.
46
47 After that, you probably want to get `build <https://pypi.org/project/build/>`_
48 and its dependencies installed as the goal of the bootstrapping phase. You can
49 then use ``build`` to create wheels of any other Python packages, and
50 ``installer`` to install them.