Skip to content

fix: add logging for file inclusion #1110

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

Merged
merged 3 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/about/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Fixes:

- Improve `.gitignore` iteration speed by @silversquirl in #1103
- Warn on 3.13.4 on Windows by @henryiii in #1104
- Add debug logging explaining why a file is included/excluded by @henryiii in
#1110

Documentation:

Expand Down
19 changes: 18 additions & 1 deletion src/scikit_build_core/build/_file_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

import pathspec

from scikit_build_core.format import pyproject_format
from .._logging import logger
from ..format import pyproject_format

if TYPE_CHECKING:
from collections.abc import Generator, Sequence
Expand Down Expand Up @@ -72,19 +73,31 @@ def each_unignored_file(
for p in all_paths:
# Always include something included
if include_spec.match_file(p):
logger.debug("Including {} because it is explicitly included.", p)
yield p
continue

# Always exclude something excluded
if user_exclude_spec.match_file(p):
logger.debug(
"Excluding {} because it is explicitly excluded by the user.", p
)
continue

# Ignore from global ignore
if global_exclude_spec.match_file(p):
logger.debug(
"Excluding {} because it is explicitly excluded by the global ignore.",
p,
)
continue

# Ignore built-in patterns
if builtin_exclude_spec.match_file(p):
logger.debug(
"Excluding {} because it is excluded by the built-in ignore patterns.",
p,
)
continue

# Check relative ignores (Python 3.9's is_relative_to workaround)
Expand All @@ -93,6 +106,10 @@ def each_unignored_file(
for np, nex in nested_excludes.items()
if dirpath == np or np in dirpath.parents
):
logger.debug(
"Excluding {} because it is explicitly excluded by nested ignore.",
p,
)
continue

yield p
Loading
Loading