Week 3: Renovating F2PY's frontend

Published: 07/06/2022

Reimplmenting F2PY's frontend with `argparse` library

What did I do this week?

This week I worked on re-implementing `f2py2e's` run_main() function in with `argparse` library. The aim is to split up one big f2py2e.py into 2 files. One file `f2pyarg.py` is responsible for parsing arguments file while other `service.py` deals with f2py core functionalities.

I have opened a draft PR here - https://github.com/numpy/numpy/pull/21923. I will continue to add my frontend contributions to this branch.

I have tried to be keep my distance from F2PY's core functionalities. These functions are convoluted with each other and a small change in one core functionality might break another.

What will I do next week?

Some upcoming goals are:- 

  • Implement run_main(). It is the function responsible for generating wrappers and .pyf files.
  • Implement run_compile() responsible for compiling and building shared libraries.
  • Decide and implement deprecation of flags. For ex. - `--f2py-wrapper-output`, `--skip-empty-wrappers`
  • Code cleanup. Will involve refactoring and deciding which flags belong to which subparser.

Did I get stuck anywhere?

It was difficult to integrate a new frontend to an existing and very old codebase. I kept getting stuck many times, but bebugged my way out of it. Currently some older tests are failing, but I think thats probably because of installation problems. Will look into it in the next meeting with my mentor Rogit Goswami.