Skip to content

ENH: Add __f2py_numpy_version__ attribute to Fortran modules. - #16594

Merged
seberg merged 1 commit into
numpy:masterfrom
sturlamolden:f2py-version-fix2
Jun 18, 2020
Merged

seberg merged 1 commit into
numpy:masterfrom
sturlamolden:f2py-version-fix2

Conversation

@sturlamolden

Copy link
Copy Markdown
Contributor

The Fortran module now reports the version of NumPy associated with the f2py used for compilation. Closes gh-16525.

@sturlamolden sturlamolden changed the title add __f2py_numpy_version__ attribute ENH: Add __f2py_numpy_version__ attribute to Fortran modules. Jun 13, 2020
@sturlamolden

sturlamolden commented Jun 13, 2020 •

Copy link
Copy Markdown
Contributor Author

The purpose of this PR is to gracefully handle situations like this:

scipy/scipy#9658
#16513
scipy/scipy#12319

If we know the version of NumPy used for compilation (not the imported one) users of f2py (e.g. SciPy) can gracefully turn off workarounds for known f2py bugs, if we know the workaround to otherwise be detrimental. Not having the attribute __f2py_numpy_version__ is also informative because we then know the f2py version to be one that came prior to inclusion of this PR.

@sturlamolden

Copy link
Copy Markdown
Contributor Author

Ping @pv

@pv pv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mattip mattip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. @pv any last comments?

Comment thread numpy/f2py/rules.py Outdated
Comment thread numpy/f2py/rules.py Outdated
Comment thread numpy/f2py/rules.py Outdated
@sturlamolden

Copy link
Copy Markdown
Contributor Author

Finally it is green again 😅

@seberg

seberg commented Jun 18, 2020

Copy link
Copy Markdown
Member

Seems like everyone was happy with this decision, and the code looks good to me as well. Thanks @sturlamolden.

@seberg
seberg merged commit a69ce06 into numpy:master Jun 18, 2020
@charris charris mentioned this pull request Oct 10, 2020
20 tasks done
@charris charris changed the title ENH: Add __f2py_numpy_version__ attribute to Fortran modules. ENH: Add __f2py_numpy_version__ attribute to Fortran modules. Oct 20, 2020
charris added a commit to charris/numpy that referenced this pull request Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: f2py does not correctly report the f2py version in the docstrings of compiled extension modules

5 participants