-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FR] Default values for packages
and py_modules
#2887
Comments
I like the way you're thinking here - striving to reduce the amount of redundant information required to build a basic project. I too have this goal and in #2329 (comment), I describe some ideas I've had recently about a zero-config project. I imagine a world where one could have nothing more than a module or package and declaration of an appropriate backend and that's sufficient to build an installable package. In that world, the design above is problemmatic, because once the package discovery is dependent on the name, you can no longer infer the name from the packages discovered. And remember, the packages/modules are the essential contribution of the author. That is, the author must give the package a name for it to exist. In that case, it makes sense for Setuptools to derive the name of the distribution from the name of the Python package that it supplies. I'm thinking I'd like this package/module discovery to take a slightly different tack:
From there, if the discovery mechanism found exactly one module or package, use that as the default name for the distribution, unless specified. WDYT? |
I'd go one step further to support namespace packages. If a (series of) namespace package(s) is (are) discovered and it contains exactly one package/module, then the inferred name should be both the namespace package(s) and the sole child. |
Hi @jaraco, thank you very much for the comments. There is one point that I feel should be discussed: PEP 621. In PEP 621 the I have also seen other issues (#1580) discussing how some forms of auto discovery can be problematic. The advantage of matching |
Following up the discussion in pypa#2887 and pypa#2329, it seems that setuptools is moving towards more automatic discovery features. PackageFinder and PEP420PackageFinder are fundamental pieces of this puzzle and grouping together them togheter with the code implementing these new discovery features make a lot of sense.
Hi @jaraco, I implemented 2 PRs, one for the original proposal and one addressing your comments. Please feel free to consider my comments about PEP 621 and close the PR you find less appropriate. |
Following up the discussion in pypa#2887 and pypa#2329, it seems that setuptools is moving towards more automatic discovery features. PackageFinder and PEP420PackageFinder are fundamental pieces of this puzzle and grouping together them togheter with the code implementing these new discovery features make a lot of sense.
Following up the discussion in pypa#2887 and pypa#2329, it seems that setuptools is moving towards more automatic discovery features. PackageFinder and PEP420PackageFinder are fundamental pieces of this puzzle and grouping together them togheter with the code implementing these new discovery features make a lot of sense.
Following up the discussion in pypa#2887 and pypa#2329, it seems that setuptools is moving towards more automatic discovery features. PackageFinder and PEP420PackageFinder are fundamental pieces of this puzzle and grouping together them togheter with the code implementing these new discovery features make a lot of sense.
Following up the discussion in pypa#2887 and pypa#2329, it seems that setuptools is moving towards more automatic discovery features. PackageFinder and PEP420PackageFinder are fundamental pieces of this puzzle and grouping together them togheter with the code implementing these new discovery features make a lot of sense.
Disable package discovery, see: pypa/setuptools#2887. fix #27, fix #28
What's the problem this feature will solve?
The need for explicitly specifying
packages
andpy_modules
(together withpackage_dir
) is often criticized as a pitfall of setuptools.Describe the solution you'd like
Setuptools could rely on the existing metadata (
name
of the distribution) and the conventions of the ecosystem (namely the "flat layout", "src layout" or "single script layout") to fill the missing values.For example, given
name = my_package
insetup.cfg
(and the values forpackages
andpy_modules
are missing):my_package
exists, then it should be used as top-level package ("flat layout")src
exists, then it should be scanned for packages ("src layout")my_package.py
exists, then it is a single-module package.I believe that it is possible to make this change backward compatible, by only trying to find default values if both
packages
andpy_modules
are not given (this circumstance would usually create a distribution without packages/modules).Alternative Solutions
No response
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: