Skip to content

Annotate more straightforward APIs in the stubs - #1271

Merged
Joao-Dionisio merged 24 commits into
scipopt:masterfrom
jonathanberthias:typing/stub-annotations
Oct 14, 2026
Merged

Joao-Dionisio merged 24 commits into
scipopt:masterfrom
jonathanberthias:typing/stub-annotations

Conversation

@jonathanberthias

Copy link
Copy Markdown
Contributor

Quite a few methods and attributes still use Incomplete, even where the implementation makes their types fairly clear.

Following #1220, this is another batch of straightforward annotations: mostly getters, Model and LP methods, file paths, and matrix results. I also filled in concrete default values where possible.

Deprecated APIs now use @deprecated, and mypy checks for deprecated usage and unused ignores.

The commits are split by topic, so reviewing them individually might be easier.

Part of #1072

Comment thread src/pyscipopt/recipes/infeasibilities.py
Comment thread src/pyscipopt/scip.pyi
@Joao-Dionisio

Copy link
Copy Markdown
Member

Awesome work @jonathanberthias , thank you! I went through the changes (both myself and with an agent), and all seem to correct!

The stub test doesn't detect that new incomplete stubs are added, correct? Could we change this in a follow up PR?

@Joao-Dionisio
Joao-Dionisio self-requested a review October 14, 2026 12:57
@jonathanberthias

Copy link
Copy Markdown
Contributor Author

The stub test doesn't detect that new incomplete stubs are added, correct? Could we change this in a follow up PR?

Yes that's correct, but I'm a little hesitant to add that check. It would force every contributor to add precise type hints in the stubs, but some parts of the API are still very complicated to type correctly and the stubs are still incomplete (enums, plugins, some array operations, ...). And also I'm not sure every one using this library is comfortable adding type annotations. But it's your call, I can work on it if you think it's helpful.

@Joao-Dionisio

Copy link
Copy Markdown
Member

Makes perfect sense! One baby step at a time, then :)

@Joao-Dionisio
Joao-Dionisio added this pull request to the merge queue Oct 14, 2026
Merged via the queue into scipopt:master with commit 65f48ca Oct 14, 2026
7 checks passed
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