-
Notifications
You must be signed in to change notification settings - Fork 284
Run stubtest to check stubs are complete
#1141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Joao-Dionisio
merged 10 commits into
scipopt:master
from
jonathanberthias:enable-stubtest
Dec 30, 2025
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1952d65
Fix mypy errors
jonathanberthias a2686e6
Generate stubtest allowlist
jonathanberthias 5083751
Split expected errors out of todo
jonathanberthias d7fe8ba
Move all stub-related files to stubs folder
jonathanberthias cda263c
Add workflow to check stubs
jonathanberthias 5607811
Simplify file names
jonathanberthias 6f9326f
Don't run ruff on everything
jonathanberthias 58c2d05
Revert error added for testing
jonathanberthias 813121c
Clarify requirements for stubtest
jonathanberthias 944b204
Run mypy in CI
jonathanberthias File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| name: Check type stubs | ||
| env: | ||
| version: 10.0.0 | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - "master" | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
| branches: | ||
| - "master" | ||
| workflow_dispatch: | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| stubtest: | ||
| if: (github.event_name != 'pull_request') || (github.event.pull_request.draft == false) | ||
| runs-on: ubuntu-24.04 | ||
| env: | ||
| PYTHON_VERSION: "3.14" | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Install dependencies (SCIPOptSuite) | ||
| run: | | ||
| wget --quiet --no-check-certificate "https://github.com/scipopt/scip/releases/download/v${{ env.version }}/scipoptsuite_${{ env.version }}-1+jammy_amd64.deb" | ||
| sudo apt-get update && sudo apt install -y ./scipoptsuite_${{ env.version }}-1+jammy_amd64.deb | ||
|
|
||
| - name: Setup python ${{ env.PYTHON_VERSION }} | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ env.PYTHON_VERSION }} | ||
|
|
||
| - name: Install mypy | ||
| run: | | ||
| python -m pip install mypy | ||
|
|
||
| - name: Install PySCIPOpt | ||
| run: | | ||
| export CFLAGS="-O0 -ggdb -Wall -Wextra -Werror -Wno-error=deprecated-declarations" # Debug mode. More warnings. Warnings as errors, but allow deprecated declarations. | ||
| python -m pip install . -v 2>&1 | tee build.log | ||
|
|
||
| - name: Run stubtest | ||
| run: stubs/test.sh | ||
|
|
||
| lint: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| FILES: src/pyscipopt/scip.pyi | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Install Ruff | ||
| uses: astral-sh/ruff-action@v3 | ||
| with: | ||
| args: "--version" | ||
|
|
||
| - name: Lint type stubs | ||
| run: ruff check ${{ env.FILES }} --extend-select PYI | ||
|
|
||
| - name: Format type stubs | ||
| run: ruff format ${{ env.FILES }} |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .*.__reduce_cython__ | ||
| .*.__setstate_cython__ | ||
| pyscipopt.scip.__test__ |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/bin/bash -e | ||
|
|
||
| # Test the stubs for pyscipopt using stubtest | ||
| # This checks that the type hints in the stubs are consistent with the actual implementation | ||
| # Prerequisite: install mypy in same environment as pyscipopt and put stubtest in PATH | ||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| stubtest \ | ||
| --allowlist "$SCRIPT_DIR/allowlist" \ | ||
| --allowlist "$SCRIPT_DIR/todo" \ | ||
| pyscipopt | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.