Scope the scan to the project's own source - #127
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #127 +/- ##
========================================
Coverage 99.75% 99.75%
========================================
Files 31 31
Lines 2475 2478 +3
Branches 534 534
========================================
+ Hits 2469 2472 +3
Misses 5 5
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Restricts source scanning to reduce wrapper-generation overhead and avoid foreign files.
Changes:
- Prunes detected CMake build trees.
- Filters implementation files using module source locations.
Suppressed comments (1)
cppwg/info/package_info.py:356
source_locationsscopes where declarations/headers are wrapped; it is not an implementation-root contract (seeexamples/shapes/wrapper/package_info.yaml:81-83). With a conventionalinclude/foosource location and explicit instantiations undersrc/foo, this silently removes every relevant.cppand template discovery produces incomplete wrappers. Use an explicit implementation-source scope, or exclude known foreign/build trees without assuming.cppfiles are colocated with their headers.
cpp_files = [
filepath
for filepath in cpp_files
if any(location in Path(filepath).parents for location in locations)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
kwabenantim
force-pushed
the
125-scope-instantiation-scan
branch
from
August 13, 2026 18:31
2df4458 to
b8659f0
Compare
This comment was marked as outdated.
This comment was marked as outdated.
cppwg walks the source root for .cpp/.hpp and matches classes by
unqualified base name, so any same-named class from another tree under the
root is conflated with a wrapped class. For pychaste this happens in
practice: the build tree carries cppwg's own cells example (fetched under
_deps), whose Node/PottsMesh/... share base names with Chaste's, so their
differing explicit instantiations merged into the wrapped classes' data.
The generated output then depended on transient build-tree contents.
Two complementary bounds:
- Prune CMake build trees from the walk (a directory containing a
CMakeCache.txt is skipped wholesale). This is not gated on
source_locations, so every project gets it - build output and
dependencies vendored under the build tree are never collected as
source. An out-of-source build is assumed; in-source builds are not
supported.
- Scope the .cpp instantiation scan to the module source_locations, the
same directories that already bound which declarations are wrapped
(ModuleInfo.is_decl_in_source_path). This lets a project exclude a
same-named class in any other (non-build) tree under the source root. A
module with no source_locations wraps everything and leaves the scan
unrestricted. The source_locations docs are updated to note it now bounds
the instantiation scan too.
No-op for a clean single-tree project: shapes regenerates byte-identical
and the unit tests pass (with build-tree-exclusion and source_locations-
scoping cases added). For pychaste it removes the contamination; the only
change to the committed package is Node/PottsMesh instantiation ordering
(("1",) restored to the front), no set change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
log_unknown_classes rebuilt the per-module source_locations scope inline, duplicating PackageInfo._module_source_locations (added when the .cpp scan was scoped). Call the helper instead so the scope is computed in one place, shared by the instantiation scan, the auto-include type map and this logging. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
kwabenantim
force-pushed
the
125-scope-instantiation-scan
branch
from
August 14, 2026 09:14
b8659f0 to
e94c85f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supports #125
Restrict the scan to the project's real source
Changes:
source_locations. A module that wraps everything (nosource_locations) is left unrestricted.