Skip to content

Add native_extension category and perl cpanm package manager#108

Merged
andrew merged 3 commits into
mainfrom
native-extension-knowledge
Jul 9, 2026
Merged

Add native_extension category and perl cpanm package manager#108
andrew merged 3 commits into
mainfrom
native-extension-knowledge

Conversation

@andrew

@andrew andrew commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Adds a native_extension category with four detectors so consumers can tell when a project ships compiled code without re-implementing the marker checks:

  • ruby/mkmf.toml: extconf.rb at root or under ext/
  • python/cext.toml: setup.py/pyproject.toml declaring Extension(/ext_modules, or .pyx files
  • php/phpize.toml: config.m4 containing PHP_ARG_/PHP_NEW_EXTENSION (gated on php/c/cpp since a PECL repo is C source with no .php files)
  • node/node-gyp.toml: binding.gyp or node-gyp/node-addon-api/nan/bindings deps

Also adds perl/cpanm.toml so Perl repos get a package_managers entry; previously only Languages carried Perl.

native_extension added to CategoryOrder/CategoryLabels, one CONTRIBUTING row, README section regenerated. TestPerlProject and TestNativeExtensionProject cover the new detections plus a no-false-positive check against the plain ruby fixture.

Taxonomy role is build-tool for now; happy to switch once a native-extension role lands in oss-taxonomy. The *.gemspec .extensions content check isn't included since [detect.file_contains] doesn't glob; extconf.rb presence covers the same repos.

New native_extension category with four detectors:
  ruby/mkmf.toml       extconf.rb at root or under ext/
  python/cext.toml     setup.py/pyproject.toml declaring Extension/ext_modules, or .pyx files
  php/phpize.toml      config.m4 containing PHP_ARG_/PHP_NEW_EXTENSION
  node/node-gyp.toml   binding.gyp or node-gyp/node-addon-api/nan/bindings deps

perl/cpanm.toml gives Perl repos a package_managers entry (previously
only Languages carried Perl, so consumers keying on
package_managers[].name saw nothing).

phpize is gated on php/c/cpp ecosystems rather than php alone since a
PECL extension repo is C source with no .php files. Taxonomy role is
build-tool for now; a native-extension role in oss-taxonomy can follow.

Adds native_extension to CategoryOrder/CategoryLabels, one CONTRIBUTING
row, regenerates the README What it detects section, and adds
TestPerlProject and TestNativeExtensionProject with fixtures.
Refreshes the vendored terms.txt (picks up native-extension plus 28
other terms added upstream since the last sync) and switches the four
native_extension TOMLs from build-tool to native-extension.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new native_extension tool category to help consumers identify repositories that ship compiled/native code, and introduces a Perl cpanm package manager detector so Perl ecosystems appear under package_managers as well as languages.

Changes:

  • Added native_extension category and detectors for Ruby (mkmf), Python (setuptools Extension), PHP (phpize), and Node (node-gyp).
  • Added Perl cpanm tool definition so Perl repos can be discovered via package_managers.
  • Updated reporting/display metadata (category order/labels) and added fixtures/tests to cover the new detections.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
testdata/perl-project/script.pl Adds a minimal Perl source fixture for language detection.
testdata/perl-project/cpanfile Adds a Perl dependency manifest fixture to trigger cpanm detection.
testdata/native-ext-project/setup.py Python fixture declaring a native extension via Extension(...).
testdata/native-ext-project/package.json Node fixture to establish the node ecosystem.
testdata/native-ext-project/Gemfile Ruby fixture to establish the ruby ecosystem.
testdata/native-ext-project/foo.c C fixture to establish the c ecosystem (for PECL-style repos).
testdata/native-ext-project/ext/foo/extconf.rb Ruby native extension marker for mkmf detection.
testdata/native-ext-project/config.m4 PHP extension marker for phpize detection via macro content checks.
testdata/native-ext-project/binding.gyp Node native addon marker for node-gyp detection.
report/report.go Adds native_extension to display ordering and human-readable labels.
README.md Regenerates the “What it detects” section to include the new category/tools and cpanm.
knowledge/ruby/mkmf.toml Adds mkmf native-extension tool definition.
knowledge/python/cext.toml Adds setuptools Extension native-extension tool definition.
knowledge/php/phpize.toml Adds phpize native-extension tool definition gated by PHP macro content checks.
knowledge/perl/cpanm.toml Adds cpanm package manager tool definition for Perl.
knowledge/node/node-gyp.toml Adds node-gyp native-extension tool definition.
detect/detect_test.go Adds tests covering Perl cpanm and the new native_extension detectors.
CONTRIBUTING.md Documents the new native_extension category.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread knowledge/ruby/mkmf.toml Outdated
Comment thread knowledge/python/cext.toml Outdated
mkmf: rake compile works from the repo root regardless of where
extconf.rb lives (ext/<name>/ is the common case); the raw
ruby extconf.rb only works after cd'ing into the ext dir.
config.files now mirrors detect.files.

cext: add [commands] and [config] to match the other native_extension
entries.
@andrew andrew merged commit 64ca654 into main Jul 9, 2026
8 checks passed
@andrew andrew deleted the native-extension-knowledge branch July 9, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants