@@ -156,8 +156,7 @@ all modules and packages meant for distribution are placed inside this
156
156
directory::
157
157
158
158
project_root_directory
159
- ├── pyproject.toml
160
- ├── setup.cfg # or setup.py
159
+ ├── pyproject.toml # AND/OR setup.cfg, setup.py
161
160
├── ...
162
161
└── src/
163
162
└── mypkg/
@@ -190,8 +189,7 @@ flat-layout
190
189
The package folder(s) are placed directly under the project root::
191
190
192
191
project_root_directory
193
- ├── pyproject.toml
194
- ├── setup.cfg # or setup.py
192
+ ├── pyproject.toml # AND/OR setup.cfg, setup.py
195
193
├── ...
196
194
└── mypkg/
197
195
├── __init__ .py
@@ -240,8 +238,7 @@ A standalone module is placed directly under the project root, instead of
240
238
inside a package folder::
241
239
242
240
project_root_directory
243
- ├── pyproject.toml
244
- ├── setup.cfg # or setup.py
241
+ ├── pyproject.toml # AND/OR setup.cfg, setup.py
245
242
├── ...
246
243
└── single_file_lib.py
247
244
@@ -293,7 +290,7 @@ then returns a list of ``str`` representing the packages it could find. To use
293
290
it, consider the following directory::
294
291
295
292
mypkg
296
- ├── setup.cfg # and/or setup.py, pyproject.toml
293
+ ├── pyproject.toml # AND/OR setup.cfg, setup.py
297
294
└── src
298
295
├── pkg1
299
296
│ └── __init__ .py
@@ -320,7 +317,7 @@ in ``src`` that start with the name ``pkg`` and not ``additional``:
320
317
[options.packages.find]
321
318
where = src
322
319
include = pkg*
323
- exclude = additional
320
+ # alternatively: ` exclude = additional*`
324
321
325
322
.. note::
326
323
`` pkg`` does not contain an `` __init__ .py`` file , therefore
@@ -334,8 +331,7 @@ in ``src`` that start with the name ``pkg`` and not ``additional``:
334
331
# ...
335
332
packages = find_packages(
336
333
where = ' src' ,
337
- include = [' pkg*' ],
338
- exclude = [' additional' ],
334
+ include = [' pkg*' ], # alternatively: `exclude=['additional*']`
339
335
),
340
336
package_dir = {" " : " src" }
341
337
# ...
@@ -353,8 +349,7 @@ in ``src`` that start with the name ``pkg`` and not ``additional``:
353
349
354
350
[tool.setuptools.packages.find]
355
351
where = [" src" ]
356
- include = [" pkg*" ]
357
- exclude = [" additional" ]
352
+ include = [" pkg*" ] # alternatively: `exclude = ["additional*"]`
358
353
namespaces = false
359
354
360
355
.. note::
@@ -412,7 +407,7 @@ Now, suppose you decide to package the ``foo`` part for distribution and start
412
407
by creating a project directory organized as follows::
413
408
414
409
foo
415
- ├── setup.cfg # and/or setup.py, pyproject.toml
410
+ ├── pyproject.toml # AND/OR setup.cfg, setup.py
416
411
└── src
417
412
└── timmins
418
413
└── foo
@@ -517,7 +512,7 @@ to `PEP 420 <https://www.python.org/dev/peps/pep-0420/>`_. It used to be more
517
512
cumbersome to accomplish the same result. Historically, there were two methods
518
513
to create namespace packages. One is the `` pkg_resources`` style supported by
519
514
`` setuptools`` and the other one being `` pkgutils`` style offered by
520
- `` pkgutils`` module in Python. Both are now considered deprecated despite the
515
+ `` pkgutils`` module in Python. Both are now considered * deprecated* despite the
521
516
fact they still linger in many existing packages. These two differ in many
522
517
subtle yet significant aspects and you can find out more on `Python packaging
523
518
user guide < https:// packaging.python.org/ guides/ packaging- namespace- packages/ > `_.
@@ -557,7 +552,7 @@ And your directory should look like this
557
552
.. code- block:: bash
558
553
559
554
foo
560
- ├── setup.cfg # and/or setup.py, pyproject.toml
555
+ ├── pyproject.toml # AND/OR setup.cfg, setup.py
561
556
└── src
562
557
└── timmins
563
558
├── __init__ .py
@@ -577,7 +572,7 @@ file contains the following:
577
572
578
573
__path__ = __import__ (' pkgutil' ).extend_path(__path__ , __name__ )
579
574
580
- The project layout remains the same and `` setup.cfg`` remains the same.
575
+ The project layout remains the same and `` pyproject.toml / setup.cfg`` remains the same.
581
576
582
577
583
578
----
0 commit comments