Skip to content

Commit 55e40b8

Browse files
authored
Merge branch 'main' into fix-sparse-operator-simplify
2 parents 551e3e3 + de21053 commit 55e40b8

156 files changed

Lines changed: 949 additions & 809 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gemini/config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Summary: configure Gemini Code Assist (https://codeassist.google/).
16+
# See https://github.com/marketplace/gemini-code-assist for more info.
17+
18+
have_fun: false
19+
code_review:
20+
disable: false
21+
comment_severity_threshold: HIGH
22+
max_review_comments: -1
23+
pull_request_opened:
24+
help: false
25+
summary: false
26+
code_review: true
27+
include_drafts: false
28+
ignore_patterns: []

.geminiignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Summary: tell Gemini CLI what it should or should not ignore. Takes precedence
16+
# over .gitignore (which Gemini CLI also reads), thus can be used to un-ignore
17+
# files that shouldn't be committed to git yet should be visible to Gemini. Also
18+
# used to ignore things usually in people's global .gitignore files.
19+
20+
# The next one (for Emacs versioned backups) _should_ be covered by *~ in our
21+
# .gitignore, but Gemini currently doesn't seem to interpret *~ that way.
22+
*.~*~

.git-blame-ignore-revs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
1-
# migrating to the black formatter
1+
# Usage: run the following command to configure git to use this file:
2+
#
3+
# git config blame.ignoreRevsFile .git-blame-ignore-revs
4+
#
5+
# This instructs `git-blame` to ignore certain commits, such as those that only
6+
# involve large refactoring or reformatting operations. The format of this file
7+
# is one full 40-character commit hash (SHA-1) per line. Blank lines and
8+
# comments (such as this) are allowed.
9+
10+
# Migrating to the black formatter.
211
5cd8b96e605039af1496b6ad97ea490ef2fa7b82
12+
13+
# Run check/format-incremental --all --apply.
14+
7f262ff9cc9eeb9b1b2d6a26c4acbfb7ab17063e

.github/workflows/ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ jobs:
150150
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
151151

152152
- name: Determine files changed by this ${{github.event_name}} event
153-
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
153+
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
154154
id: filter
155155
with:
156156
base: ${{env.base}}
@@ -342,7 +342,7 @@ jobs:
342342
run: echo '::add-matcher::.github/problem-matchers/pytest.json'
343343

344344
- name: Run pytest
345-
run: check/pytest
345+
run: check/pytest -m "not slow"
346346

347347
pytest:
348348
if: needs.changes.outputs.python == 'true' && (success() || failure())
@@ -433,7 +433,7 @@ jobs:
433433
run: echo '::add-matcher::.github/problem-matchers/pytest.json'
434434

435435
- name: Run pytest
436-
run: check/pytest
436+
run: check/pytest -m "not slow"
437437

438438
coverage:
439439
if: needs.changes.outputs.python == 'true'
@@ -563,7 +563,7 @@ jobs:
563563
# The next action simply fails if there are any unpinned actions.
564564
- name: Verify that all workflow actions have pinned versions
565565
# yamllint disable-line rule:line-length
566-
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@70c4af2ed5282c51ba40566d026d6647852ffa3e # v5.0.1
566+
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@ca46236c6ce584ae24bc6283ba8dcf4b3ec8a066 # v5.0.4
567567

568568
# If we didn't fail the previous check, go on to more time-consuming ones.
569569
- name: Install actionlint

.github/workflows/scorecard-scanner.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373

7474
- name: Upload results to code-scanning dashboard
7575
# yamllint disable rule:line-length
76-
uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6
76+
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
7777
with:
7878
sarif_file: scorecard-results.sarif
7979

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ htmlcov/
6767
nosetests.xml
6868
coverage.xml
6969
*.cover
70+
*,cover
7071
.hypothesis/
7172

7273
# Sphinx documentation

.osv-scanner.toml

Lines changed: 0 additions & 56 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ we use.
6969

7070
where `YOUR_BRANCH_NAME` is the name of your new branch.
7171

72+
### git configuration
73+
74+
The following command will set up large refactoring revisions to be ignored,
75+
when using `git blame`:
76+
77+
```bash
78+
git config blame.ignoreRevsFile .git-blame-ignore-revs
79+
```
80+
81+
Note that if you are using PyCharm, you might have to use the command _Restart
82+
& Invalidate Caches) to have the change be picked up.
83+
7284
### Development environment installation
7385

7486
Please refer to the section _Developer install_ of the [installation

check/all

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2025 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# This script is modeled in part on Cirq's check/all script.
18+
19+
declare -r usage="\
20+
Usage: ${0##*/} [--help] [--only-changed-files] [--apply-format-changes] [BASE_REV]
21+
22+
If the first argument given on the command line is the option --help or -h,
23+
this program prints usage information and then exits.
24+
25+
With no arguments, this runs multiple checks on the code base. These tests
26+
are based on the programs in the checks/ subdirectory.
27+
28+
If --apply-format-changes is specified, the flag --apply will be passed to
29+
check/format-incremental to apply the format changes suggested by the
30+
formatter.
31+
32+
You can specify a base git revision to compare against (i.e., to use when
33+
determining whether or not a file is considered to have changed). If given,
34+
the argument BASE_REV is passed on to tests that can use it, such as
35+
check/pytest-and-incremental-coverage."
36+
37+
set -eo pipefail -o errtrace
38+
shopt -s inherit_errexit
39+
40+
# Get the working directory to the repo root.
41+
thisdir=$(dirname "${BASH_SOURCE[0]:?}")
42+
repo_dir=$(git -C "${thisdir}" rev-parse --show-toplevel)
43+
cd "${repo_dir}"
44+
45+
function error() {
46+
echo >&2 "ERROR: ${*}"
47+
}
48+
49+
# ~~~~ Parse the CLI arguments and gather some data ~~~~
50+
51+
declare -a rev=()
52+
declare -a apply_arg=()
53+
declare only_changed=""
54+
for arg in "$@"; do
55+
case "${arg}" in
56+
-h | --help)
57+
echo "${usage}"
58+
exit 0
59+
;;
60+
--apply-format-changes)
61+
apply_arg=( "--apply" )
62+
shift
63+
;;
64+
--only-changed-files)
65+
only_changed="true"
66+
shift
67+
;;
68+
-*)
69+
error "Invalid option '${arg}'"
70+
error "See '$0 --help' for the list of supported options."
71+
exit 1
72+
;;
73+
*)
74+
if ! rev=( "$(git rev-parse --verify --end-of-options "${arg}^{commit}")" ); then
75+
error "No revision '${arg}'"
76+
exit 1
77+
fi
78+
;;
79+
esac
80+
done
81+
82+
# ~~~~ Run the tests ~~~~
83+
84+
declare -a errors=()
85+
86+
function run() {
87+
echo "Running $* ..."
88+
"$@" || errors+=( "$* failed" )
89+
echo
90+
}
91+
92+
if [[ -n "${only_changed}" ]]; then
93+
run check/format-incremental "${rev[@]}" "${apply_arg[@]}"
94+
run check/pylint-changed-files "${rev[@]}"
95+
else
96+
run check/format-incremental "${rev[@]}" "${apply_arg[@]}" --all
97+
run check/pylint "${rev[@]}"
98+
fi
99+
run check/mypy
100+
run check/pytest-and-incremental-coverage "${rev[@]}"
101+
run check/shellcheck
102+
103+
# ~~~~ Summarize the results and exit with a status code ~~~~
104+
105+
declare exit_code=0
106+
echo
107+
echo "Done."
108+
if [[ "${#errors[@]}" == 0 ]]; then
109+
echo "All checks passed."
110+
else
111+
error "Some checks failed."
112+
printf " %s\n" "${errors[@]}"
113+
exit_code=1
114+
fi
115+
116+
exit "${exit_code}"

check/shellcheck

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ IFS=$'\n' read -r -d "" -a our_shell_scripts < <(
5454
declare -a required_shell_scripts
5555
required_shell_scripts=(
5656
# items below must be sorted
57+
check/all
5758
check/format-incremental
5859
check/mypy
5960
check/pylint
61+
check/pylint-changed-files
6062
check/pytest
63+
check/pytest-and-incremental-coverage
6164
)
6265

6366
scripts_not_found=$(comm -13 \

0 commit comments

Comments
 (0)