Skip to content

ENH: f2py: add --f2cmap option for specifying the name of .f2py_f2cmap - #15106

Merged
charris merged 4 commits into
numpy:masterfrom
pv:f2py-f2cmap
Dec 15, 2019
Merged

charris merged 4 commits into
numpy:masterfrom
pv:f2py-f2cmap

Conversation

@pv

@pv pv commented Dec 14, 2019 •

Copy link
Copy Markdown
Member

Previously, f2py loaded the type mappings from a file .f2py_f2cmap
in current directory, at import time.

Make the file name customizable by adding a --f2cmap command line
option, and postpone loading the file to f2py.run_main().

Restore the default type mapping in f2py.run_main() before
loading the customizations, so that multiple calls to f2py.run_main() do
not interfere with each other. (For example, numpy.distutils calls f2py
multiple times in the same process.)

Moreover, add documentation for the .f2py_f2cmap file (copypasted
from the old f2py FAQ on archive.org), and fix a race condition bug in
the f2py test suite which caused the tests to sometimes not be run
when using pytest-xdist.

cc @pearu

Closes: gh-15096

@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Dec 14, 2019
@charris charris added this to the 1.18.0 release milestone Dec 14, 2019
@charris

charris commented Dec 14, 2019

Copy link
Copy Markdown
Member

I've gone ahead and marked all the 64 bit updates for backport. Is that safe?

pv added 2 commits December 14, 2019 17:09
Previously, f2py loaded the type mappings from a file ``.f2py_f2cmap``
in current directory, at import time.

Make the file name customizable by adding a ``--f2cmap`` command line
option, and postpone loading the file to f2py.run_main().

Moreover, restore the default type mapping in f2py.run_main() before
loading the customizations, so that multiple calls to f2py.run_main() do
not interfere with each other. (For example, numpy.distutils calls f2py
multiple times in the same process.)
Distutils code needs to run in different temporary directories, probably
because they create `_configtest.c` files for compiler detection in the
current directory.
@pv

pv commented Dec 14, 2019 •

Copy link
Copy Markdown
Member Author

@charris: I think those things are now converged, and I don't think the changes break other things (I've been able to build Scipy with some modules converted to 64-bit BLAS with passing test suite, running on the 64-bit numpy). Of course, it's not fully optimal that it's so close to release deadline, and 64-bit BLAS/LAPACK CIs are not up yet.

@pv

pv commented Dec 14, 2019 •

Copy link
Copy Markdown
Member Author

Note that this PR doesn't need backport necessarily --- we can also just monkeypatch this in Scipy (to set f2py default integer sizes).

@charris

charris commented Dec 14, 2019

Copy link
Copy Markdown
Member

If it's safe, I'd just as soon have everything in 1.18.

@pv

pv commented Dec 14, 2019 •

Copy link
Copy Markdown
Member Author

AFAIK, this PR should be safe (e.g. --f2cmap in f2py_options works properly in scipy setup.py), and the change is fairly straightforward.

@mattip

mattip commented Dec 14, 2019

Copy link
Copy Markdown
Member

Should get a mention in the 1.18 release note.

@pv

pv commented Dec 14, 2019

Copy link
Copy Markdown
Member Author

Added release note fragment.

@charris
charris merged commit 740c7f5 into numpy:master Dec 15, 2019
@charris

charris commented Dec 15, 2019

Copy link
Copy Markdown
Member

Thanks Pauli.

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.

DOC: f2py: The configuration file ".f2py_f2cmap" is not documented.

3 participants