Skip to content

Commit 869d6ef

Browse files
authored
Update docs for modern setuptools (#21792)
Resolves #16551 Closes #21790
1 parent 60fa82e commit 869d6ef

1 file changed

Lines changed: 5 additions & 46 deletions

File tree

docs/source/installed_packages.rst

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -109,52 +109,24 @@ package directory. For example, here is a typical directory structure:
109109

110110
.. code-block:: text
111111
112-
setup.py
112+
pyproject.toml
113113
package_a/
114114
__init__.py
115115
lib.py
116116
py.typed
117117
118-
The ``setup.py`` file could look like this:
119-
120-
.. code-block:: python
121-
122-
from setuptools import setup
123-
124-
setup(
125-
name="SuperPackageA",
126-
author="Me",
127-
version="0.1",
128-
package_data={"package_a": ["py.typed"]},
129-
packages=["package_a"]
130-
)
131-
132118
Some packages have a mix of stub files and runtime files. These packages also
133119
require a ``py.typed`` file. An example can be seen below:
134120

135121
.. code-block:: text
136122
137-
setup.py
123+
pyproject.toml
138124
package_b/
139125
__init__.py
140126
lib.py
141127
lib.pyi
142128
py.typed
143129
144-
The ``setup.py`` file might look like this:
145-
146-
.. code-block:: python
147-
148-
from setuptools import setup
149-
150-
setup(
151-
name="SuperPackageB",
152-
author="Me",
153-
version="0.1",
154-
package_data={"package_b": ["py.typed", "lib.pyi"]},
155-
packages=["package_b"]
156-
)
157-
158130
In this example, both ``lib.py`` and the ``lib.pyi`` stub file exist. At
159131
runtime, the Python interpreter will use ``lib.py``, but mypy will use
160132
``lib.pyi`` instead.
@@ -166,27 +138,14 @@ had stubs for ``package_c``, we might do the following:
166138

167139
.. code-block:: text
168140
169-
setup.py
141+
pyproject.toml
170142
package_c-stubs/
171143
__init__.pyi
172144
lib.pyi
173145
174-
The ``setup.py`` might look like this:
175-
176-
.. code-block:: python
177-
178-
from setuptools import setup
179-
180-
setup(
181-
name="SuperPackageC",
182-
author="Me",
183-
version="0.1",
184-
package_data={"package_c-stubs": ["__init__.pyi", "lib.pyi"]},
185-
packages=["package_c-stubs"]
186-
)
187-
188146
The instructions above are enough to ensure that the built wheels
189-
contain the appropriate files. However, to ensure inclusion inside the
147+
contain the appropriate files, assuming sufficiently modern packaging
148+
(e.g. ``setuptools>=69``). However, to ensure inclusion inside the
190149
``sdist`` (``.tar.gz`` archive), you may also need to modify the
191150
inclusion rules in your ``MANIFEST.in``:
192151

0 commit comments

Comments
 (0)