Skip to content
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

Improve NumPy registration when assigning numpy to Param #3093

Merged
merged 3 commits into from
Jan 16, 2024

Conversation

jsiirola
Copy link
Member

Fixes # .

Summary/Motivation:

This resolves (for Pyomo) a weakness in the automated numpy type registration system (which is necessary after #3077 removed the mandatory import / registration of NumPy). This partially addresses #3091 (the remainder will need to be addressed within mpi-sppy).

Changes proposed in this PR:

  • Update NumericRange so that checking membership of a numpy type in the range will trigger numpy type registrations (through the normal check_if_numeric_type mechanism)
  • Add a test that ensures that assigning a numpy type to a Param will trigger numpy type registration

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.

@jsiirola jsiirola changed the title Improbve NumPy registration when assigning numpy to Param Improve NumPy registration when assigning numpy to Param Jan 16, 2024
Copy link

codecov bot commented Jan 16, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (98537e0) 88.26% compared to head (c299be0) 88.27%.
Report is 49 commits behind head on main.

Files Patch % Lines
pyomo/core/base/range.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3093   +/-   ##
=======================================
  Coverage   88.26%   88.27%           
=======================================
  Files         832      832           
  Lines       92451    92454    +3     
=======================================
+ Hits        81599    81610   +11     
+ Misses      10852    10844    -8     
Flag Coverage Δ
linux 85.96% <94.11%> (+0.45%) ⬆️
osx 75.51% <94.11%> (+<0.01%) ⬆️
other 86.14% <94.11%> (+0.45%) ⬆️
win 83.38% <94.11%> (+0.55%) ⬆️

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.

@jsiirola jsiirola merged commit 74beb7a into Pyomo:main Jan 16, 2024
33 checks passed
@jsiirola jsiirola deleted the improve-numpy-detection branch January 16, 2024 18:58
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