Skip to content

[FR] The way to not overwrite but inherit DEFAULT_EXCLUDE when define find package exclude #3594

@yukihiko-shinoda

Description

@yukihiko-shinoda

What's the problem this feature will solve?

Setuptools users become able to omit redundant definition when they want to add exclude directory or file in flat-layout.
And they also become able to manage many packages because they can reduce toils of maintain pyproject.toml in each project.

pyproject.toml when exclude as same as DEFAULT_EXCLUDE by tool.setuptools.packages.find.exclude
[tool.setuptools.packages.find]
where = ["."]
exclude = [
  # Additional ecludsion from Setuptools default.
  "htmlcov",
  # Setuptools default.
  # see:
  # - setuptools/discovery.py at 92ebeed732b08ac29576634ad4814b9efd07bb37 · pypa/setuptools
  #   https://github.com/pypa/setuptools/blob/92ebeed732b08ac29576634ad4814b9efd07bb37/setuptools/discovery.py
  # FlatLayoutPackageFinder
  "ci",
  "ci.*",
  "bin",
  "bin.*",
  "doc",
  "doc.*",
  "docs",
  "docs.*",
  "documentation",
  "documentation.*",
  "manpages",
  "manpages.*",
  "news",
  "news.*",
  "changelog",
  "changelog.*",
  "test",
  "test.*",
  "tests",
  "tests.*",
  "unit_test",
  "unit_test.*",
  "unit_tests",
  "unit_tests.*",
  "example",
  "example.*",
  "examples",
  "examples.*",
  "scripts",
  "scripts.*",
  "tools",
  "tools.*",
  "util",
  "util.*",
  "utils",
  "utils.*",
  "python",
  "python.*",
  "build",
  "build.*",
  "dist",
  "dist.*",
  "venv",
  "venv.*",
  "env",
  "env.*",
  "requirements",
  "requirements.*",
  # ---- Task runners / Build tools ----
  "tasks",  # invoke
  "tasks.*",  # invoke
  "fabfile",  # fabric
  "fabfile.*",  # fabric
  "site_scons",  # SCons
  "site_scons.*",  # SCons
  # ---- Other tools ----
  "benchmark",
  "benchmark.*",
  "benchmarks",
  "benchmarks.*",
  "exercise",
  "exercise.*",
  "exercises",
  "exercises.*",
  # ---- Hidden directories/Private packages ----
  "[._]*",
  # FlatLayoutModuleFinder
  "setup",
  "setup.*",
  "conftest",
  "conftest.*",
  "test",
  "test.*",
  "tests",
  "tests.*",
  "example",
  "example.*",
  "examples",
  "examples.*",
  "build",
  "build.*",
  # ---- Task runners ----
  "toxfile",
  "toxfile.*",
  "noxfile",
  "noxfile.*",
  "pavement",
  "pavement.*",
  "dodo",
  "dodo.*",
  "tasks",
  "tasks.*",
  "fabfile",
  "fabfile.*",
  # ---- Other tools ----
  "[Ss][Cc]onstruct",  # SCons
  "[Ss][Cc]onstruct.*",  # SCons
  "conanfile",  # Connan: C/C++ build tool
  "conanfile.*",  # Connan: C/C++ build tool
  "manage",  # Django
  "manage.*",  # Django
  "benchmark",
  "benchmark.*",
  "benchmarks",
  "benchmarks.*",
  "exercise",
  "exercise.*",
  "exercises",
  "exercises.*",
  # ---- Hidden files/Private modules ----
  "[._]*",
]

cf. Package Discovery and Namespace Packages - setuptools 65.3.0.post20220826 documentation

Describe the solution you'd like

For example, adds parameter additional_exclude which inherits DEFAULT_EXCLUDE .

Alternative Solutions

Alternative Solution A

(If it can) User rename target directory with starting . .
Because Setuptools ignore by DEFAULT_EXCLUDE .
However, directory starting with . behaves as hidden by system.
It's intension isn't always same as excluding when build.

Alternative Solution B

Setuptools adds directory to exclude when user report in GitHub Issues.
However, Setuptools shouldn't cover every tools because there are infinite minor tools.

Additional context

In my case, I would to exclude htmlcov directory additionally which is dump of coverage.
see: Command line usage — Coverage.py 6.3.2 documentation

Code of Conduct

  • I agree to follow the PSF Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.enhancement
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions