Skip to content

Python: Add create-extractor-pack.sh for Python#21683

Merged
tausbn merged 1 commit intomainfrom
tausbn/python-add-extractor-pack-build-script
Apr 10, 2026
Merged

Python: Add create-extractor-pack.sh for Python#21683
tausbn merged 1 commit intomainfrom
tausbn/python-add-extractor-pack-build-script

Conversation

@tausbn
Copy link
Copy Markdown
Contributor

@tausbn tausbn commented Apr 9, 2026

This allows us to build and test the extractor (for actual QL extraction -- not just the extractor unit tests) entirely from within the github/codeql repo, just as we do with Ruby. All that's needed is a --search-path argument that points to the repo root.

This allows us to build and test the extractor (for actual QL extraction
-- not just the extractor unit tests) entirely from within the
`github/codeql` repo, just as we do with Ruby. All that's needed is a
`--search-path` argument that points to the repo root.
@tausbn tausbn added the no-change-note-required This PR does not need a change note label Apr 9, 2026
@github-actions github-actions bot added the Python label Apr 9, 2026
@tausbn tausbn marked this pull request as ready for review April 9, 2026 15:35
@tausbn tausbn requested a review from a team as a code owner April 9, 2026 15:35
Copilot AI review requested due to automatic review settings April 9, 2026 15:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 repository-local script to build a Python extractor pack from source so extraction and QL tests can be run from within github/codeql using --search-path (mirroring the Ruby workflow).

Changes:

  • Introduce python/scripts/create-extractor-pack.sh to build tsg-python, generate python3src.zip, and assemble python/extractor-pack.
  • Package Python extractor tools/scripts, dbscheme files, and downgrades into the generated extractor pack.
Show a summary per file
File Description
python/scripts/create-extractor-pack.sh New script to build and assemble a local Python extractor pack for use via --search-path.

Copilot's findings

Comments suppressed due to low confidence (1)

python/scripts/create-extractor-pack.sh:34

  • make_zips.py already writes extractor/python3src.zip in the source directory before copying it to the provided output dir, so copying it back from $tmpdir is redundant. Consider dropping this cp and just use the zip generated in extractor/ (keeping the temp output dir only to avoid SameFileError in shutil.copy).
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT
(cd extractor && python3 make_zips.py "$tmpdir")
cp "$tmpdir/python3src.zip" extractor/python3src.zip
  • Files reviewed: 1/1 changed files
  • Comments generated: 1

# Generate python3src.zip from the Python extractor source.
# make_zips.py creates the zip in the source directory and then copies it to the
# given output directory. We use a temporary directory to avoid a same-file copy
# error, then move the zip back.
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

The comment says the zip is moved back, but the script actually copies it. Please update the comment to match the behavior (or switch to mv if that’s the intent).

This issue also appears on line 31 of the same file.

Suggested change
# error, then move the zip back.
# error, then copy the zip back.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@jketema jketema left a comment

Choose a reason for hiding this comment

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

This looks sensible.

Not enough to block merging this, but I would expect this to hold for some of the other extractors that live in this repo too. So, I wonder whether there's a more generic approach where we move some of our internal code over to this repo cc @github/code-scanning-engine-quality

@tausbn tausbn merged commit 6078df5 into main Apr 10, 2026
15 checks passed
@tausbn tausbn deleted the tausbn/python-add-extractor-pack-build-script branch April 10, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants