-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatic discovery of packages, py_modules and name (#2894)
It is desirable to have some configurations automatically derived. This is definitely possible for packages and py_modules, and (based on these two) also for name. This change adds a new class `setuptools.discovery.ConfigDiscovery` implementing the automatic discovery logic for packages, py_modules and name.
- Loading branch information
Showing
12 changed files
with
1,114 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Added automatic discovery for ``py_modules`` and ``packages`` | ||
-- by :user:`abravalheri`. | ||
|
||
Setuptools will try to find these values assuming that the package uses either | ||
the *src-layout* (a ``src`` directory containing all the packages or modules), | ||
the *flat-layout* (package directories directly under the project root), | ||
or the *single-module* approach (isolated Python files, directly under | ||
the project root). | ||
|
||
The automatic discovery will also respect layouts that are explicitly | ||
configured using the ``package_dir`` option. | ||
|
||
For backward-compatibility, this behavior will be observed **only if both** | ||
``py_modules`` **and** ``packages`` **are not set**. | ||
|
||
If setuptools detects modules or packages that are not supposed to be in the | ||
distribution, please manually set ``py_modules`` and ``packages`` in your | ||
``setup.cfg`` or ``setup.py`` file. | ||
If you are using a *flat-layout*, you can also consider switching to | ||
*src-layout*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Added automatic configuration for the ``name`` metadata | ||
-- by :user:`abravalheri`. | ||
|
||
Setuptools will adopt the name of the top-level package (or module in the case | ||
of single-module distributions), **only when** ``name`` **is not explicitly | ||
provided**. | ||
|
||
Please note that it is not possible to automatically derive a single name when | ||
the distribution consists of multiple top-level packages or modules. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
If you purposefully want to create an *"empty distribution"*, please be aware | ||
that some Python files (or general folders) might be automatically detected and | ||
included. | ||
|
||
Projects that currently don't specify both ``packages`` and ``py_modules`` in their | ||
configuration and have extra Python files and folders (not meant for distribution), | ||
might see these files being included in the wheel archive. | ||
|
||
You can check details about the automatic discovery behaviour (and | ||
how to configure a different one) in :doc:`/userguide/package_discovery`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.