Skip to content
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] The way to not overwrite but inherit DEFAULT_EXCLUDE when define find package exclude #3594

Closed
1 task done
yukihiko-shinoda opened this issue Sep 18, 2022 · 1 comment · Fixed by #3715 or #3836
Closed
1 task done
Labels
enhancement Needs Triage Issues that need to be evaluated for severity and status.

Comments

@yukihiko-shinoda
Copy link
Contributor

yukihiko-shinoda commented Sep 18, 2022

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
@yukihiko-shinoda yukihiko-shinoda added enhancement Needs Triage Issues that need to be evaluated for severity and status. labels Sep 18, 2022
@abravalheri
Copy link
Contributor

Hi @yukihiko-shinoda, thank you very much for bringing this topic to discussion.

I think it does make sense to add htmlcov to the list of directories ignored by default. If you would like to work on a PR for that I would be very happy to review.

In my opinion, however, it makes less sense to work on the inheritance of DEFAULT_EXCLUDE, the reason is that if the user is going to the trouble of customizing the list, it might make more sense to use include instead of exclude. For example, if you package is called mypkg, it may make more sense to use include = ["mypkg*"].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
2 participants