# F2PY frontend Study **f2py2e.py** - **scaninoutline()** - Command line parsing is done by iteratively reading CL options, modifying flag variables, and removing CL options from `sys.argv` array. - **main()** : - Root function - Checks for some dependency flags first. - If `-c` flag present --> `run_compile()` method - `run_compile()` method parses command line seperately from `scaninputline()` - For all other flag handling, `run_main()` handles it. - **run_main()** : - Handles all flags except (-c). - Uses `scaninputline()` to parse CL and get files and options - options include verbosity, skip and include functions, latex and rest docs, build paths and include paths - `auxfuncs.options = options` [here](https://github.com/NamamiShanker/numpy/blob/acfc1cc1d177e06002d87a10185dda1ef3192662/numpy/f2py/f2py2e.py#L439) - [L440](https://github.com/NamamiShanker/numpy/blob/acfc1cc1d177e06002d87a10185dda1ef3192662/numpy/f2py/f2py2e.py#L440)`capi_maps.load_f2cmap_file(options['f2cmap_file'])` Is this line used to convert Fortran code to dictionaries? Also what is f2cmap file? - [name=Rohit] This is used to do type matching, i.e. `real*8`-->`double` - Callcrackfortran looks complicated, need [name=Rohit Goswami]'s help in figuring out code after [L441](https://github.com/NamamiShanker/numpy/blob/acfc1cc1d177e06002d87a10185dda1ef3192662/numpy/f2py/f2py2e.py#L441) - [name=Rohit] This is used to convert to the nested dictionary - [name=Namami] Move callcrackfortran to `crackfortran.py` - Possible bug, [L470](https://github.com/NamamiShanker/numpy/blob/acfc1cc1d177e06002d87a10185dda1ef3192662/numpy/f2py/f2py2e.py#L470) variable `i` is not defined. +1 - [name=Rohit] --> `plist['block']` instead of `postlist[i]['block']` - **buildmodules(postlist)** - Creates C wrapper to be compiled and used in Python. - Invoked with `-m` flag is present? - `run_compile()` --> should be implemented with `argparse` subparsers, and so there shouldn't be any need to parse the commandline again # Things to do - [x] Non `distutils` tests - [x] Pull request for the [L470] bug - [ ] Classify functions as `distutils` needed, and if yes, `meson` equivalents - e.g. `--fcompiler` is used to choose a compiler (fortran) --> `meson` will set the `FC` environment variable - [x] Look at the `argparse` structure --> https://github.com/numpy/numpy/pull/20056/files - [x] Consider the workflow options - [x] Within NumPy --> - [ ] Out of tree, e.g. https://github.com/HaoZeke/f2py_skel