Skip to content

Commit c7b5e99

Browse files
authored
Merge branch 'main' into patch-2
2 parents c0216a6 + d6521f9 commit c7b5e99

8 files changed

Lines changed: 181 additions & 191 deletions

source/guides/distributing-packages-using-setuptools.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ If your project is pure Python then you'll be creating a
773773
If your project contains compiled extensions, then you'll be creating what's
774774
called a :ref:`*Platform Wheel* (see section below) <Platform Wheels>`.
775775

776-
.. note:: If your project also supports Python 2 _and_ contains no C extensions,
776+
.. note:: If your project also supports Python 2 *and* contains no C extensions,
777777
then you should create what's called a *Universal Wheel* by adding the
778778
following to your :file:`setup.cfg` file:
779779

@@ -782,7 +782,7 @@ called a :ref:`*Platform Wheel* (see section below) <Platform Wheels>`.
782782
[bdist_wheel]
783783
universal=1
784784
785-
Only use this setting if your project does not have any C extesions _and_
785+
Only use this setting if your project does not have any C extensions *and*
786786
supports Python 2 and 3.
787787

788788

source/guides/installing-stand-alone-command-line-tools.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ Installing stand alone command line tools
44
Many packages have command line entry points. Examples of this type of application are
55
`mypy <https://github.com/python/mypy>`_,
66
`flake8 <https://github.com/PyCQA/flake8>`_,
7-
`pipenv <https://github.com/pypa/pipenv>`_,and
7+
:ref:`pipenv`,and
88
`black <https://github.com/ambv/black>`_.
99

1010
Usually you want to be able to access these from anywhere,
1111
but installing packages and their dependencies to the same global environment
1212
can cause version conflicts and break dependencies the operating system has
1313
on Python packages.
1414

15-
`pipx <https://github.com/pipxproject/pipx>`_ solves this by creating a virtual
15+
:ref:`pipx` solves this by creating a virtual
1616
environment for each package, while also ensuring that package's applications
1717
are accessible through a directory that is on your ``$PATH``. This allows each
1818
package to be upgraded or uninstalled without causing conflicts with other
1919
packages, and allows you to safely run the program from anywhere.
2020

21-
.. Note:: pipx only works with Python 3.6+.
21+
.. note:: pipx only works with Python 3.6+.
2222

2323
``pipx`` is installed with ``pip``:
2424

@@ -110,4 +110,4 @@ To see the full list of commands ``pipx`` offers, run
110110
$ pipx --help
111111

112112
You can learn more about ``pipx`` at its homepage,
113-
https://github.com/pipxproject/pipx.
113+
https://github.com/pypa/pipx.

source/guides/installing-using-pip-and-virtual-environments.rst

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -19,46 +19,43 @@ update packages. You'll need to make sure you have the latest version of pip
1919
installed.
2020

2121

22-
Windows
23-
+++++++
24-
25-
The Python installers for Windows include pip. You should be able to access
26-
pip using:
22+
.. tab:: Unix/macOS
2723

28-
.. code-block:: bash
24+
Debian and most other distributions include a `python-pip`_ package, if you
25+
want to use the Linux distribution-provided versions of pip see
26+
:doc:`/guides/installing-using-linux-tools`.
2927

30-
py -m pip --version
31-
pip 9.0.1 from c:\python36\lib\site-packages (Python 3.6.1)
28+
You can also install pip yourself to ensure you have the latest version. It's
29+
recommended to use the system pip to bootstrap a user installation of pip:
3230

33-
You can make sure that pip is up-to-date by running:
31+
.. code-block:: bash
3432
35-
.. code-block:: bash
33+
python3 -m pip install --user --upgrade pip
3634
37-
py -m pip install --upgrade pip
35+
Afterwards, you should have the newest pip installed in your user site:
3836

37+
.. code-block:: bash
3938
40-
Linux and macOS
41-
++++++++++++++++
39+
python3 -m pip --version
40+
pip 9.0.1 from $HOME/.local/lib/python3.6/site-packages (python 3.6)
4241
43-
Debian and most other distributions include a `python-pip`_ package, if you
44-
want to use the Linux distribution-provided versions of pip see
45-
:doc:`/guides/installing-using-linux-tools`.
42+
.. _python-pip: https://packages.debian.org/stable/python-pip
4643

47-
You can also install pip yourself to ensure you have the latest version. It's
48-
recommended to use the system pip to bootstrap a user installation of pip:
44+
.. tab:: Windows
4945

50-
.. code-block:: bash
46+
The Python installers for Windows include pip. You should be able to access
47+
pip using:
5148

52-
python3 -m pip install --user --upgrade pip
49+
.. code-block:: bash
5350
54-
Afterwards, you should have the newest pip installed in your user site:
51+
py -m pip --version
52+
pip 9.0.1 from c:\python36\lib\site-packages (Python 3.6.1)
5553
56-
.. code-block:: bash
54+
You can make sure that pip is up-to-date by running:
5755

58-
python3 -m pip --version
59-
pip 9.0.1 from $HOME/.local/lib/python3.6/site-packages (python 3.6)
56+
.. code-block:: bash
6057
61-
.. _python-pip: https://packages.debian.org/stable/python-pip
58+
py -m pip install --upgrade pip
6259
6360
6461
Installing virtualenv
@@ -75,17 +72,18 @@ Using virtualenv allows you to avoid installing Python packages globally
7572
which could break system tools or other projects. You can install virtualenv
7673
using pip.
7774

78-
On macOS and Linux:
7975

80-
.. code-block:: bash
76+
.. tab:: Unix/macOS
8177

82-
python3 -m pip install --user virtualenv
78+
.. code-block:: bash
8379
84-
On Windows:
80+
python3 -m pip install --user virtualenv
8581
86-
.. code-block:: bash
82+
.. tab:: Windows
83+
84+
.. code-block:: bash
8785
88-
py -m pip install --user virtualenv
86+
py -m pip install --user virtualenv
8987
9088
9189
@@ -105,17 +103,17 @@ To create a virtual environment, go to your project's directory and run
105103
venv. If you are using Python 2, replace ``venv`` with ``virtualenv``
106104
in the below commands.
107105

108-
On macOS and Linux:
106+
.. tab:: Unix/macOS
109107

110-
.. code-block:: bash
108+
.. code-block:: bash
111109
112-
python3 -m venv env
110+
python3 -m venv env
113111
114-
On Windows:
112+
.. tab:: Windows
115113

116-
.. code-block:: bash
114+
.. code-block:: bash
117115
118-
py -m venv env
116+
py -m venv env
119117
120118
The second argument is the location to create the virtual environment. Generally, you
121119
can just create this in your project and call it ``env``.
@@ -134,33 +132,34 @@ need to *activate* it. Activating a virtual environment will put the
134132
virtual environment-specific
135133
``python`` and ``pip`` executables into your shell's ``PATH``.
136134

137-
On macOS and Linux:
135+
.. tab:: Unix/macOS
138136

139-
.. code-block:: bash
137+
.. code-block:: bash
140138
141-
source env/bin/activate
139+
source env/bin/activate
142140
143-
On Windows::
141+
.. tab:: Windows
142+
143+
.. code-block:: text
144144
145-
.\env\Scripts\activate
145+
.\env\Scripts\activate
146146
147147
You can confirm you're in the virtual environment by checking the location of your
148148
Python interpreter, it should point to the ``env`` directory.
149149

150-
On macOS and Linux:
151-
152-
.. code-block:: bash
150+
.. tab:: Unix/macOS
153151

154-
which python
155-
.../env/bin/python
152+
.. code-block:: bash
156153
157-
On Windows:
154+
which python
155+
.../env/bin/python
158156
159-
.. code-block:: bash
157+
.. tab:: Windows
160158

161-
where python
162-
.../env/bin/python.exe
159+
.. code-block:: text
163160
161+
where python
162+
...\env\Scripts\python.exe
164163
165164
As long as your virtual environment is activated pip will install packages into that
166165
specific environment and you'll be able to import and use packages in your

source/guides/packaging-binary-extensions.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,18 @@ guide includes an introduction to writing a
240240
Building binary extensions
241241
==========================
242242

243+
Building extensions for multiple platforms
244+
------------------------------------------
245+
246+
If you plan to distribute your extension, you should provide
247+
:term:`wheels <Wheel>` for all the platforms you intend to support. For most
248+
extensions, this is at least one package per Python version times the number of
249+
OS and architectures you support. These are usually built on continuous
250+
integration (CI) systems. There are tools to help you build highly
251+
redistributable binaries from CI; these include :ref:`cibuildwheel` and
252+
:ref:`multibuild`.
253+
254+
243255
Binary extensions for Windows
244256
-----------------------------
245257

0 commit comments

Comments
 (0)