Skip to content

[KNITRO] Improve type hints#3827

Merged
blnicho merged 3 commits intoPyomo:mainfrom
eminyouskn:knitro-typing
Feb 4, 2026
Merged

[KNITRO] Improve type hints#3827
blnicho merged 3 commits intoPyomo:mainfrom
eminyouskn:knitro-typing

Conversation

@eminyouskn
Copy link
Copy Markdown
Contributor

Fixes # .

Summary/Motivation:

As part of #3788, this PR follows the suggested type hints for the Knitro module.

Changes proposed in this PR:

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.44%. Comparing base (2beb531) to head (42eb075).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3827      +/-   ##
==========================================
+ Coverage   89.43%   89.44%   +0.01%     
==========================================
  Files         904      904              
  Lines      105382   105378       -4     
==========================================
+ Hits        94246    94258      +12     
+ Misses      11136    11120      -16     
Flag Coverage Δ
builders 29.06% <100.00%> (+<0.01%) ⬆️
default 83.57% <100.00%> (?)
expensive 35.54% <100.00%> (?)
linux 86.76% <100.00%> (-2.43%) ⬇️
linux_other 86.76% <100.00%> (+0.01%) ⬆️
osx 82.90% <100.00%> (-0.01%) ⬇️
win 84.98% <100.00%> (-0.01%) ⬇️
win_other 84.98% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mrmundt
Copy link
Copy Markdown
Contributor

mrmundt commented Jan 29, 2026

@eminyouskn - None of the Jenkins failures are your fault. We are having issues with BARON/GAMS on Jenkins.

Copy link
Copy Markdown
Contributor

@mrmundt mrmundt left a comment

Choose a reason for hiding this comment

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

Is it becoming a "new python standard" to move from Optional(Blah, Blah) to Blah | Blah?

@eminyouskn
Copy link
Copy Markdown
Contributor Author

@mrmundt I think starting with Python 3.10, the vertical bar (|) replaces Union. Since Optional[T] is just Union[T, None], it’s replaced by T | None as well.

@mrmundt
Copy link
Copy Markdown
Contributor

mrmundt commented Feb 3, 2026

@eminyouskn - Neat neat. Since we have dropped Python 3.9 support then, this is fine!

Can of worms: We have never defined a type hinting standard in Pyomo... (not volunteering)

@github-project-automation github-project-automation bot moved this from Todo to Reviewer Approved in Pyomo 6.10 Feb 3, 2026
@blnicho blnicho merged commit 739e072 into Pyomo:main Feb 4, 2026
63 of 65 checks passed
@github-project-automation github-project-automation bot moved this from Reviewer Approved to Done in Pyomo 6.10 Feb 4, 2026
@eminyouskn eminyouskn deleted the knitro-typing branch February 4, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants