Context
setuptools-scm registers a setuptools.file_finders entry point that is always active when the package is installed — even for projects that don't use setuptools-scm for versioning. This entry point calls git_find_files() → _git_toplevel(), which runs bare git rev-parse and can walk up to an outer/unrelated git repository.
This was the root cause of #353 (building a non-git package inside an outer git repo), and while the worst symptom (creating a git archive of the wrong repo) is gone, the entry point can still silently return wrong file lists.
Current state
The modern setuptools-scm integration (ScmEggInfoMixin) already bypasses this entry point entirely when a workdir is available: it passes the validated workdir through to list_tracked_files(), which uses --git-dir pinning. So for projects that configure setuptools-scm, the entry point is redundant.
Remaining exposure
The entry point still fires when:
- setuptools-scm is installed in the build environment but the project being built doesn't configure it
- The CLI's
--query files path calls find_files() directly
- Any other consumer of
walk_revctrl() / setuptools.file_finders
Proposed timeline
- Next minor release: emit a deprecation warning when the
setuptools.file_finders entry point is invoked and no setuptools-scm configuration is found for the project being built
- Following major release: remove the entry point registration entirely
Alternatives to full removal
- Keep the entry point but add a
samefile guard in _git_toplevel so it returns None when the discovered toplevel doesn't match the requested path (prevents the outer-repo walk-up)
- Make the entry point a no-op unless an explicit opt-in is configured
Related: #353
Context
setuptools-scm registers a
setuptools.file_findersentry point that is always active when the package is installed — even for projects that don't use setuptools-scm for versioning. This entry point callsgit_find_files()→_git_toplevel(), which runs baregit rev-parseand can walk up to an outer/unrelated git repository.This was the root cause of #353 (building a non-git package inside an outer git repo), and while the worst symptom (creating a
git archiveof the wrong repo) is gone, the entry point can still silently return wrong file lists.Current state
The modern setuptools-scm integration (
ScmEggInfoMixin) already bypasses this entry point entirely when a workdir is available: it passes the validated workdir through tolist_tracked_files(), which uses--git-dirpinning. So for projects that configure setuptools-scm, the entry point is redundant.Remaining exposure
The entry point still fires when:
--query filespath callsfind_files()directlywalk_revctrl()/setuptools.file_findersProposed timeline
setuptools.file_findersentry point is invoked and no setuptools-scm configuration is found for the project being builtAlternatives to full removal
samefileguard in_git_toplevelso it returnsNonewhen the discovered toplevel doesn't match the requested path (prevents the outer-repo walk-up)Related: #353