[options.packages.find_namespace] should be [options.packages.find] in package discovery guide
See original GitHub issueIn https://setuptools.readthedocs.io/en/latest/userguide/package_discovery.html#using-find-namespace-or-find-namespace-packages, the docs say
[options.packages.find_namespace]
where = src
That fails with
distutils.errors.DistutilsOptionError: Unsupported distribution option section: [options.packages.find_namespace]
[options.packages.find]
where = src
actually works.
Filing this as a doc issue, but maybe that option should work the way it’s documented?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Package Discovery and Namespace Packages - Setuptools
Setuptools provides powerful tools to handle package discovery, including support for namespace packages. Normally, you would specify the packages to be ...
Read more >Package Discovery and Namespace Package
Setuptools provide powerful tools to handle package discovery, including support for namespace ... [options] packages = find: #or packages = find_namespace:.
Read more >python setuptools setup.cfg: Including main- and subpackages ...
Both of these allowed me to import all modules from the src package and src.subpkg . [options] packages=find: and the other doesn't use...
Read more >Packaging namespace packages
This is recommended for new packages that need to support Python 2 and 3 and installation via both pip and python setup.py install...
Read more >Frequently Asked Questions - PyScaffold
Can I use PyScaffold ≥ 3 to develop a Python package that is Python 2 & 3 ... PyScaffold strongly recommends all packages...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m now using
find_namespace
in most of my packages (those not supporting Python 2) based on jaraco/skeleton.The description of
options.packages.find_namespace
is also found in https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html so at least two locations in documentation are expecting it to work.I did a little searching of the code and found a few things.
options.packages.find
will work correctly according the the code. Both options.packages.find and options.packages.find_namespace sections are parsed inConfigOptionsHandler._parse_packages
inconfig.py
when the corresponding package value (package = 'find[_namespace]'
) is parsed.So it’s actually expected that the
[options.packages.find]
form will be used.The actual error occurs because the
options.packages
sections are parsed twice; once in the previously mentioned area and again when the the parser reaches the section. At this point the parser does a lookup of the method based on the option name. It finds the correspondingoptions.packages.find
method,_parse_section_find
, ignoring the result. However, there is no corresponding_parse_section_find_namespace
method for theoptions.packages.find_namespace
section which leads to the error.I suppose the real question at this time is cosmetic. Should the code be updated to match the documentation or the other way around?
– Update – Updating to use
options.packages.find_namespace
could lead to a breaking change depending on how it’s implemented.