Skip to content

[FR] Default values for packages and py_modules #2887

Closed
@abravalheri

Description

@abravalheri

What's the problem this feature will solve?

The need for explicitly specifying packages and py_modules (together with package_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 in setup.cfg (and the values for packages and py_modules are missing):

  • if the directory my_package exists, then it should be used as top-level package ("flat layout")
  • if the directory src exists, then it should be scanned for packages ("src layout")
  • if the file 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 and py_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

  • I agree to follow the PSF Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions