@@ -21,14 +21,14 @@ To create this project locally, create the following file structure:
2121.. code-block :: text
2222
2323 packaging_tutorial
24- └── example_pkg
25- └── __init__.py
26-
24+ └── src
25+ └── example_pkg
26+ └── __init__.py
2727
2828 Once you create this structure, you'll want to run all of the commands in this
2929tutorial within the top-level folder - so be sure to ``cd packaging_tutorial ``.
3030
31- :file: `example_pkg/__init__.py ` is required to import the directory as a package,
31+ :file: `src/ example_pkg/__init__.py ` is required to import the directory as a package,
3232and can simply be an empty file.
3333
3434.. _Python documentation for packages and modules :
@@ -46,12 +46,13 @@ project's root directory - you will add content to them in the following steps.
4646
4747 packaging_tutorial
4848 ├── LICENSE
49- ├── README.md
50- ├── example_pkg
51- │ └── __init__.py
5249 ├── pyproject.toml
50+ ├── README.md
5351 ├── setup.cfg
5452 ├── setup.py # optional, needed to make editable pip installs work
53+ ├── src
54+ │ └── example_pkg
55+ │ └── __init__.py
5556 └── tests
5657
5758
@@ -142,9 +143,13 @@ an escape hatch when absolutely necessary.
142143 Operating System :: OS Independent
143144
144145 [options]
146+ package_dir =
147+ = src
145148 packages = find:
146149 python_requires = >= 3.6
147150
151+ [options.packages.find]
152+ where = src
148153
149154 There are a `variety of metadata and options
150155 <https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html> `_
@@ -252,7 +257,8 @@ an escape hatch when absolutely necessary.
252257 " License :: OSI Approved :: MIT License" ,
253258 " Operating System :: OS Independent" ,
254259 ],
255- packages = setuptools.find_packages(),
260+ package_dir = {" " : " src" },
261+ packages = setuptools.find_packages(where = " src" ),
256262 python_requires = " >=3.6" ,
257263 )
258264
0 commit comments