@@ -54,8 +54,8 @@ Create the following file structure locally:
54
54
The directory containing the Python files should match the project name. This
55
55
simplifies the configuration and is more obvious to users who install the package.
56
56
57
- :file: `__init__.py ` is required to import the directory as a package,
58
- even if as is our case for this tutorial that file is empty.
57
+ :file: `__init__.py ` is recommended to import the directory as a regular package,
58
+ even if as is our case for this tutorial that file is empty [ #namespace-packages ]_ .
59
59
60
60
:file: `example.py ` is an example of a module within the package that could
61
61
contain the logic (functions, classes, constants, etc.) of your package.
@@ -535,3 +535,15 @@ some things you can do:
535
535
:ref: `pdm `, and :ref: `poetry `.
536
536
* Read :pep: `517 ` and :pep: `518 ` for background and details on build tool configuration.
537
537
* Read about :doc: `/guides/packaging-binary-extensions `.
538
+
539
+
540
+ ----
541
+
542
+ .. rubric :: Notes
543
+
544
+ .. [#namespace-packages ]
545
+ Technically, you can also create Python packages without an ``__init__.py `` file,
546
+ but those are called :doc: `namespace packages </guides/packaging-namespace-packages >`
547
+ and considered an **advanced topic ** (not covered in this tutorial).
548
+ If you are only getting started with Python packaging, it is recommended to
549
+ stick with *regular packages * and ``__init__.py `` (even if the file is empty).
0 commit comments