chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:22:52 +08:00
commit 9d4c7d16ba
528 changed files with 740585 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
name: Bug Report
description: Report incorrect behavior in the shap library
title: "BUG: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: Thanks for taking the time to fill out this bug report!
- type: textarea
id: problem
attributes:
label: Issue Description
description: Please describe the issue.
validations:
required: true
- type: textarea
id: example
attributes:
label: Minimal Reproducible Example
description: |
Please provide a minimal, self-contained example that reproduces the issue.
placeholder: |
import shap
...
render: python
validations:
required: true
- type: markdown
attributes:
value: |
**Note**: without a working Minimal Reproducible Example, the maintainers will not be able to help you and your issue will be closed!
Your example should be:
1. **Minimal**: Use as little code as possible that still produces the same problem.
2. **Self-contained**: Provide all minimal imports, data and code needed to reproduce the problem.
3. **Verifiable**: Test the example to make sure it reproduces the problem.
See [Matt's guide](https://matthewrocklin.com/minimal-bug-reports) for further information on how to write helpful bug reports.
- type: textarea
id: traceback
attributes:
label: Traceback
description: Copy & paste the traceback of the error (if relevant).
placeholder: |
Traceback (most recent call last):
File "/shap/__init__.py", line 4, in <module>
import foo
NameError: name 'foo' is not defined
render: shell
- type: textarea
id: expected-behavior
attributes:
label: Expected Behavior
description: Please describe or show a code example of the expected behavior.
- type: checkboxes
id: checks
attributes:
label: Bug report checklist
options:
- label: I have checked that this issue has not already been reported.
required: true
- label: I have confirmed this bug exists on the [latest release](https://github.com/shap/shap/releases) of shap.
required: true
- label: I have confirmed this bug exists on the [master branch](https://github.com/shap/shap/blob/master/CONTRIBUTING.md#installing-from-the-master-branch) of shap.
- label: I'd be interested in making a PR to fix this bug
- type: textarea
id: version
attributes:
label: Installed Versions
description: What version of the shap library are you using?
validations:
required: true
+8
View File
@@ -0,0 +1,8 @@
# For reference, see
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/
blank_issues_enabled: true # In future, may disable to force use of standardised issue forms
contact_links:
- name: Discussions and Q&A
url: https://github.com/shap/shap/discussions
about: Ask general questions about shap and get help from other users
@@ -0,0 +1,40 @@
name: Feature Request
description: Suggest an idea for shap
title: "ENH: "
labels: [enhancement]
body:
- type: markdown
attributes:
value: Thanks for taking the time to fill out this feature request form!
- type: textarea
id: description
attributes:
label: Problem Description
description: >
Please describe what problem the feature would solve (e.g. "I wish I could
use shap to ..."), and how the new feature would be used. Use pseudo-code if relevant.
validations:
required: true
- type: textarea
id: alternative
attributes:
label: Alternative Solutions
description: >
Please describe any alternative solutions (existing functionality, workarounds,
3rd party packages, etc.) that would satisfy the feature request.
- type: textarea
id: context
attributes:
label: Additional Context
description: >
Please provide any relevant GitHub issues, code examples or references
that help describe and support the feature request.
- type: checkboxes
id: checks
attributes:
label: Feature request checklist
options:
- label: I have checked the issue tracker for duplicate issues.
required: true
- label: I'd be interested in making a PR to implement this feature
+12
View File
@@ -0,0 +1,12 @@
## Overview
Closes #XXXX <!--Add issue number here, or delete as appropriate-->
Description of the changes proposed in this pull request:
## Checklist
- [ ] All [pre-commit checks](https://pre-commit.com/#install) pass.
- [ ] Unit tests added (if fixing a bug or adding a new feature)
+13
View File
@@ -0,0 +1,13 @@
codecov:
notify:
after_n_builds: 7
wait_for_ci: yes
coverage:
range: 70..90
comment:
require_changes: true
after_n_builds: 7
ignore:
# Ignore coverage on vendored code
- "shap/plots/colors/_colorconv.py"
- "shap/explainers/other/_maple.py"
+12
View File
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/javascript/"
schedule:
interval: "monthly"
groups:
# Group all minor and patch updates in a single PR
js-minor:
update-types:
- "minor"
- "patch"
+26
View File
@@ -0,0 +1,26 @@
changelog:
exclude:
labels:
- skip-changelog
authors:
- dependabot
- pre-commit-ci
categories:
- title: Breaking changes
labels:
- BREAKING
- title: Added
labels:
- enhancement
- title: Fixed
labels:
- bug
- title: Documentation
labels:
- documentation
- title: Maintenance
labels:
- ci
- title: Other Changes
labels:
- "*"
+51
View File
@@ -0,0 +1,51 @@
# Dummy release workflow to reserve the "shap-gpu" name on PyPI and TestPyPI.
# Each job builds an sdist (no CUDA/C compilation) with the name overridden to
# "shap-gpu" and a placeholder version, then publishes via trusted publishing.
name: release
on:
workflow_dispatch:
jobs:
publish-pypi:
runs-on: ubuntu-latest
# Only publish tagged releases to PyPI
if: startsWith(github.ref, 'refs/tags')
environment: pypi
permissions:
id-token: write # for PyPI trusted publishing
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # setuptools_scm needs full history/tags
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Override package name to shap-gpu
run: sed -i 's/^name = "shap"/name = "shap-gpu"/' pyproject.toml
- name: Build sdist
env:
SETUPTOOLS_SCM_PRETEND_VERSION: "0.0.1.dev0"
run: uv build --sdist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-testpypi:
runs-on: ubuntu-latest
environment: testpypi
permissions:
id-token: write # for TestPyPI trusted publishing
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # setuptools_scm needs full history/tags
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Override package name to shap-gpu
run: sed -i 's/^name = "shap"/name = "shap-gpu"/' pyproject.toml
- name: Build sdist
env:
SETUPTOOLS_SCM_PRETEND_VERSION: "0.0.1.dev0"
run: uv build --sdist
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
+188
View File
@@ -0,0 +1,188 @@
name: Build wheels
on:
release:
types: [published]
# Enable manual run
workflow_dispatch:
jobs:
# we need this test since we run into 403 errors on MacOS, see GH #4179
prepare_data:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies for dataset download
run: |
uv pip install --system . --group download-datasets
- name: Pre-download datasets
run: python tests/datasets_to_cache.py
- name: Create unified cache directory
run: |
mkdir -p /tmp/test_data_cache
cp -r ~/scikit_learn_data /tmp/test_data_cache/ || true
cp -r shap/cached_data /tmp/test_data_cache/ || true
ls -la /tmp/test_data_cache/
- name: Upload cached datasets
uses: actions/upload-artifact@v4
with:
name: test-data-cache
path: /tmp/test_data_cache
retention-days: 1
build_wheels:
name: Build ${{ matrix.os }} wheels
needs: [prepare_data]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-14, macos-15-intel, windows-latest]
runs-on: ${{ matrix.os }}
steps:
# Ensure all git tags are present so version number is extracted.
# https://github.com/actions/checkout/issues/1471
# Careful: the "fetch-tags" option to the checkout action is broken
# when the workflow is triggered by a tag!
# https://github.com/actions/checkout/issues/1467
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --tags
- name: Download pre-cached datasets
uses: actions/download-artifact@v4
with:
name: test-data-cache
path: ${{ runner.temp }}/test_data_cache
- name: Install libomp (macOS)
if: runner.os == 'macOS'
run: |
brew install libomp
# Set DYLD_LIBRARY_PATH to avoid OpenMP conflicts, see https://github.com/unit8co/darts/pull/3050
_libomp_path=$(brew --prefix libomp 2>/dev/null)/lib
echo "DYLD_LIBRARY_PATH=$_libomp_path:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
unset _libomp_path
- name: "Install uv"
uses: astral-sh/setup-uv@v7
- name: Build wheels
uses: pypa/cibuildwheel@v3.2.1
env:
CIBW_ARCHS_LINUX: ${{ contains(matrix.os, '-arm') && 'aarch64' || 'x86_64' }}
CIBW_ARCHS_MACOS: ${{ matrix.os == 'macos-14' && 'arm64' || 'x86_64' }}
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
CIBW_MUSLLINUX_AARCH64_IMAGE: musllinux_1_2
# Pass the cache location to cibuildwheel tests
CIBW_BEFORE_TEST: |
python -c "import os, shutil; cache_path = os.environ.get('CACHE_PATH', '${{ runner.temp }}/test_data_cache'); home = os.path.expanduser('~'); sklearn_cache = os.path.join(home, 'scikit_learn_data'); os.makedirs(sklearn_cache, exist_ok=True); shutil.copytree(os.path.join(cache_path, 'scikit_learn_data'), sklearn_cache, dirs_exist_ok=True) if os.path.exists(os.path.join(cache_path, 'scikit_learn_data')) else None"
CIBW_TEST_COMMAND_MACOS: |
python -c "import shap, os, shutil; cache_path = '${{ runner.temp }}/test_data_cache'; shap_cache = os.path.join(os.path.dirname(shap.__file__), 'cached_data'); os.makedirs(shap_cache, exist_ok=True); shutil.copytree(os.path.join(cache_path, 'cached_data'), shap_cache, dirs_exist_ok=True) if os.path.exists(os.path.join(cache_path, 'cached_data')) else None" && pytest -v {project}/tests --import-mode=append
CIBW_TEST_COMMAND_LINUX: |
python -c "import shap, os, shutil; cache_path = '${{ runner.temp }}/test_data_cache'; shap_cache = os.path.join(os.path.dirname(shap.__file__), 'cached_data'); os.makedirs(shap_cache, exist_ok=True); shutil.copytree(os.path.join(cache_path, 'cached_data'), shap_cache, dirs_exist_ok=True) if os.path.exists(os.path.join(cache_path, 'cached_data')) else None" && pytest -v {project}/tests --import-mode=append
CIBW_TEST_COMMAND_WINDOWS: |
python -c "import shap, os, shutil; cache_path = r'${{ runner.temp }}\test_data_cache'; shap_cache = os.path.join(os.path.dirname(shap.__file__), 'cached_data'); os.makedirs(shap_cache, exist_ok=True); shutil.copytree(os.path.join(cache_path, 'cached_data'), shap_cache, dirs_exist_ok=True) if os.path.exists(os.path.join(cache_path, 'cached_data')) else None" && pytest -v {project}/tests --import-mode=append
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: bdist_files_${{ matrix.os }}
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
# Ensure all git tags are present so version number is extracted.
# https://github.com/actions/checkout/issues/1471
# Careful: the "fetch-tags" option to the checkout action is broken
# when the workflow is triggered by a tag!
# https://github.com/actions/checkout/issues/1467
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --tags
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build sdist (pep517)
run: |
uv build --sdist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist_files
path: dist/*.tar.gz
publish_test_pypi:
name: Publish wheels to TestPyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/shap
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: bdist_files_*
merge-multiple: true
- uses: actions/download-artifact@v4
with:
name: sdist_files
path: dist
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
repository-url: https://test.pypi.org/legacy/
publish_pypi:
name: Publish wheels to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# Only publish tagged releases to PyPI
if: startsWith(github.ref, 'refs/tags')
environment:
name: pypi
url: https://pypi.org/p/shap
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: bdist_files_*
merge-multiple: true
- uses: actions/download-artifact@v4
with:
name: sdist_files
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
+88
View File
@@ -0,0 +1,88 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
paths:
- "shap/**"
- "javascript/**"
- "tests/**"
- "data/**"
- ".github/workflows/codeql-analysis.yml"
- "**.py"
- "**.js"
- "**.cc"
- "**.cu"
- "**.h"
- "**.cpp"
schedule:
- cron: '16 9 * * 1'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'javascript', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build python package
run: uv build
# ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
+40
View File
@@ -0,0 +1,40 @@
name: notebooks
on:
push:
branches:
- master
pull_request:
branches:
- master
paths:
- "shap/**"
- "notebooks/**"
- ".github/workflows/run_notebooks.yml"
- "scripts/**"
- "pyproject.toml"
- "CMakeLists.txt"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Cancel only PR intermediate builds
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
run_notebooks:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: |
uv pip install --system . --group test --group plots --group nbtest
- name: Run notebooks
run: |
python scripts/run_notebooks_timeouts.py
+210
View File
@@ -0,0 +1,210 @@
name: tests
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
paths:
- "shap/**"
- "tests/**"
- "data/**"
- "javascript/**" # Include JS changes that affect bundle.js
- ".github/workflows/run_tests.yml"
- "pyproject.toml"
- "CMakeLists.txt"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Cancel only PR intermediate builds
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
# we need this test since we run into 403 errors on MacOS, see GH #4179
prepare_data:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies for dataset download
run: |
uv pip install --system . --group download-datasets
- name: Pre-download datasets
run: python -P tests/datasets_to_cache.py
- name: Create unified cache directory
run: |
mkdir -p /tmp/test_data_cache
cp -r ~/scikit_learn_data /tmp/test_data_cache/ || true
cp -r shap/cached_data /tmp/test_data_cache/ || true
ls -la /tmp/test_data_cache/
- name: Upload cached datasets
uses: actions/upload-artifact@v4
with:
name: test-data-cache
path: /tmp/test_data_cache
retention-days: 1
run_tests:
needs: prepare_data
strategy:
matrix:
os: ["ubuntu-latest"]
# The total number of matrix jobs should match codecov.yml `after_n_builds`.
python-version: ["3.12",
"3.13",
"3.14"
]
extras: ["test"]
include:
# Test on windows/mac, just one job each
- os: windows-latest
python-version: "3.13"
extras: "test"
- os: macos-latest
python-version: "3.13"
extras: "test"
# Run tests with only the core dependencies, to ensure we
# cover the latest version of numpy/pandas. See GH dsgibbons#46
- os: ubuntu-latest
python-version: "3.13"
extras: "test-core"
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
js:
- 'javascript/**'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# Build JavaScript bundle if JS files have changed
- name: Set up Node.js
if: steps.filter.outputs.js == 'true'
uses: actions/setup-node@v3
with:
node-version: lts/Hydrogen
- name: Build JavaScript bundle conditionally
if: steps.filter.outputs.js == 'true'
shell: bash
run: |
cd javascript
npm ci
npm run build
cp build/bundle.js ../shap/plots/resources/bundle.js
- name: Install libomp (macOS)
if: runner.os == 'macOS'
run: |
brew install libomp
# Set DYLD_LIBRARY_PATH to avoid OpenMP conflicts, see https://github.com/unit8co/darts/pull/3050
_libomp_path=$(brew --prefix libomp 2>/dev/null)/lib
echo "DYLD_LIBRARY_PATH=$_libomp_path:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
unset _libomp_path
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
# Do regular install NOT editable install: see GH #3020
run: |
uv pip install --system . --group ${{matrix.extras}} --group plots
- name: Download pre-cached datasets
uses: actions/download-artifact@v4
with:
name: test-data-cache
path: /tmp/test_data_cache
- name: Restore datasets to correct locations
shell: bash
run: |
# Restore sklearn data
if [ "$RUNNER_OS" == "Windows" ]; then
cp -r /d/tmp/test_data_cache/scikit_learn_data ~/scikit_learn_data || true
else
cp -r /tmp/test_data_cache/scikit_learn_data ~/scikit_learn_data || true
fi
# Restore shap cached data to the installed package location
SHAP_CACHE_DIR=$(python -P -c "import shap, os; print(os.path.join(os.path.dirname(shap.__file__), 'cached_data'))")
mkdir -p "$SHAP_CACHE_DIR"
if [ "$RUNNER_OS" == "Windows" ]; then
cp -r /d/tmp/test_data_cache/cached_data/* "$SHAP_CACHE_DIR/" 2>/dev/null || true
else
cp -r /tmp/test_data_cache/cached_data/* "$SHAP_CACHE_DIR/" 2>/dev/null || true
fi
echo "Sklearn data:"
ls -la ~/scikit_learn_data/ 2>/dev/null || echo "No sklearn data"
echo "Shap cache data:"
ls -la "$SHAP_CACHE_DIR" 2>/dev/null || echo "No shap data"
- name: Test with pytest
# Ensure we avoid adding current working directory to sys.path:
# - Use "pytest" over "python -m pytest"
# - Use "append" import mode rather than default "prepend"
run: >
pytest --durations=20
--cov --cov-report=xml
--mpl-generate-summary=html --mpl-results-path=./mpl-results
--import-mode=append
- name: Upload mpl test report
if: failure()
uses: actions/upload-artifact@v4
with:
name: mpl-results-${{ matrix.python-version }}-${{ runner.os }}-${{ matrix.extras }}
path: mpl-results/
if-no-files-found: ignore
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
test_oldest_supported_numpy:
# Package is built with numpy 2.X
# This job is recommended by https://numpy.org/doc/stable/dev/depending_on_numpy.html#numpy-2-0-specific-advice
# The "oldest supported numpy" is determined by SPEC 0:
# https://scientific-python.org/specs/spec-0000/
name: run tests (oldest supported numpy)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: |
uv pip install --system numpy==2.0 . --group test-core --group plots
- name: Test with pytest
run: pytest --durations=20 --import-mode=append
run_mypy:
# Run mypy on the latest Python version
name: run mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: |
uv pip install --system . --group test-core
- name: Run mypy
run: mypy shap tests
+59
View File
@@ -0,0 +1,59 @@
name: 'Close stale issues and PRs'
# See CONTIBUTING.md : "Issue Triage"
# See also: https://github.com/shap/shap/discussions/3051
on:
schedule:
# Run at 2:30 AM every day
- cron: '30 2 * * *'
# Enable manual run
workflow_dispatch:
permissions:
actions: write # Workaround for https://github.com/actions/stale/issues/1090
issues: write
pull-requests: write
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
# See discussion on generous time limits:
# https://github.com/shap/shap/discussions/3051
days-before-stale: 730 # 2 years
days-before-close: 90 # 3 months
stale-issue-message: "This issue has been inactive for two years, so it's
been automatically marked as 'stale'.
\n\n
We value your input! If this issue is still relevant, please leave a
comment below. This will remove the 'stale' label and keep it open.
\n\n
If there's no activity in the next 90 days the issue will be closed."
stale-pr-message: "We appreciate your contribution! This Pull Request has
been inactive for two years, so it's been automatically marked as 'stale'.
\n\n
Please leave a comment if you would still like the PR to remain open, and
the 'stale' label will be removed.
\n\n
Otherwise, if there is no activity in the next 90 days the PR will be
closed."
close-issue-message: "This issue has been automatically closed due to lack of
recent activity.
\n\n
Your input is important to us! Please feel free to open a new issue if the
problem persists or becomes relevant again."
close-pr-message: "This PR has been automatically closed due to a lack of
recent activity.
\n\n
We welcome your contributions! If your patch is still relevant, please
don't hesitate to open a new PR."
stale-issue-label: stale
stale-pr-label: stale
# If an issue or PR is marked with the "todo" label, never mark it as stale.
exempt-issue-labels: todo
exempt-pr-labels: todo
operations-per-run: 500
# Process the oldest issues first:
ascending: true
+47
View File
@@ -0,0 +1,47 @@
# Ensure that the javascript package can be built with webpack
# Runs on any PRs that modify the javascript directory
# Also verifies that the built bundle matches the committed bundle
name: test_js
on:
push:
branches:
- master
pull_request:
branches:
- master
paths:
- "javascript/**"
jobs:
build-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: lts/Hydrogen
- run: npm ci
working-directory: ./javascript
- run: npm run build
working-directory: ./javascript
- run: npm run test
working-directory: ./javascript
# Check if the built bundle matches the committed bundle (ignoring whitespace)
- name: Compare built bundle with committed bundle
run: |
# Normalize whitespace in both files for comparison
# Remove empty lines and all whitespace, then compare
sed '/^[[:space:]]*$/d; s/[[:space:]]//g' javascript/build/bundle.js | tr -d '\n' > /tmp/new_bundle_normalized.js
sed '/^[[:space:]]*$/d; s/[[:space:]]//g' shap/plots/resources/bundle.js | tr -d '\n' > /tmp/committed_bundle_normalized.js
if diff -q /tmp/new_bundle_normalized.js /tmp/committed_bundle_normalized.js > /dev/null; then
echo "✅ Bundle matches the committed version"
else
echo "❌ Built bundle differs from committed version"
echo "The bundle.js file needs to be updated."
echo "Run: cd javascript && npm run build && cp build/bundle.js ../shap/plots/resources/bundle.js"
exit 1
fi