-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
ENH: Implement f2py2e
with argparse
#21923
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
Open
NamamiShanker
wants to merge
115
commits into
numpy:main
Choose a base branch
from
NamamiShanker:f2py_front
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
115 commits
Select commit
Hold shift + click to select a range
e8ff86e
ENH: Start refactoring f2py front-end
HaoZeke 1c6867e
ENH: Start using logging
8000
HaoZeke 60740fd
ENH: Add more options for the new front-end
HaoZeke 84890bf
ENH: Half the f2py options
HaoZeke b1d132f
ENH: Switch to using f2pyarg
HaoZeke bb0d5ec
ENH: Add f2py frontend stuff
HaoZeke e3136d4
FIX: f2pyarg --build-dir create directory if not present
NamamiShanker 9fd7869
MAINT: Move f2pyarg helpers to service
NamamiShanker 2cb37e3
FIX: Fix incorrect imports in f2pyarg service
NamamiShanker fe68428
MAINT: f2py check if input f2cmap file exists
NamamiShanker 6d02396
MAINT: Fix --wrap-functions docs
NamamiShanker eb972f2
MAINT: f2pyarg Remove unnecessary flags
NamamiShanker 9f5bdcb
MAINT: f2pyarg remove unnecessary flags
NamamiShanker 7445850
MAINT: f2pyarg fix default values
NamamiShanker f035afa
FIX: f2pyarg transfer -h flag to generate_wrappers parser
NamamiShanker 6d4a6d9
ENH: f2pyarg add file segregation method
NamamiShanker 8b28a9b
ENH: Create temp dir for null builddir value
NamamiShanker f2e01c7
ENH: Chop callcrackfortran and move it to service. Add other helpers.
NamamiShanker f1e1b64
ENH: Initial f2pyarg main arg process function
NamamiShanker 12a8d36
FIX: fix imports
NamamiShanker 3413132
FIX: Set default verbosity to true like f2py2e
NamamiShanker 8a2959b
MAINT: Remove unneccessary imports
NamamiShanker 1299e5f
ENH: Handle overwrite-signature flag
NamamiShanker 24a5c1a
ENH: update auxfuncs
NamamiShanker f5d61ca
ENH: Segregate pyf files
NamamiShanker 8d76ee5
MAINT: Refactoring
NamamiShanker 615b13e
MAINT: Rename _parse_postlist to _check_postlist
NamamiShanker 744880c
Revert "ENH: update auxfuncs"
NamamiShanker 2c2e7b7
FIX: Accept array of debug options rather that boolean flag
NamamiShanker 9e3eaea
FIX: Default module name and default build directories
NamamiShanker 7e0b754
MAINT: Fix typo and send pyf files to generate_files
NamamiShanker 5990ffc
ENH: Send all required options to rules file
NamamiShanker 4e79176
MAINT: Refactoring service
NamamiShanker 56b7533
MAINT: Refactor for -c flag
NamamiShanker cdea12a
FIX: Change -c flag default val
NamamiShanker 681c36a
ENH: Remove alternative macro flags for easier handling
NamamiShanker fdc859e
ENH: Add action class to process macros
NamamiShanker 833e1cd
FIX: BoolAction string has no contains method error
NamamiShanker a261527
FIX: NPDLinkHelper setattr failure
NamamiShanker b3efb75
ENH: Add initial -c flag handling
NamamiShanker f218993
ENH: Add get_f2py_modulename function from np.distutils
NamamiShanker 50232a6
FIX: _check_postlist verbosity error
NamamiShanker 0204071
FIX: Change module_name to module
NamamiShanker 7633678
FIX: Parse skip and only arguments
NamamiShanker e689a74
FIX: Segregate and return path of input files
NamamiShanker b82aa0d
FIX: data type of f77flags and f90flags
NamamiShanker e49b91a
FIX: Return signature file
NamamiShanker 3ac82ae
MAINT: Refactor file segregation
NamamiShanker c1e7353
ENH: Support for -include<header> flag
NamamiShanker a9b056d
MAINT: Refactor wrapper generation settings
NamamiShanker 2e415bd
FIX: Import f2py2e rather than f2py for run_main
NamamiShanker a95db5e
ENH: Generate comp flagsfrom parser namespace
NamamiShanker 0ab3cb3
ENH: Add f2pyarg distutils compilation
NamamiShanker 18809d9
FIX: link_resource default value
NamamiShanker 3328d80
ENH: Add util file for f2py
NamamiShanker fc09d11
MAINT: Minor refactoring
NamamiShanker 74a0fd8
FIX: Import f2py2e instead of f2py
NamamiShanker 37ce8be
MAINT: Remove unused imports
NamamiShanker 019c0e8
ENH: Use context manager for build_dir management
NamamiShanker 8bbbc99
MAINT: Remove whitespaces
NamamiShanker 2fb6ef6
FIX: Return after generating signature
NamamiShanker e690a50
FIX: Return string path of files
NamamiShanker 7a3bf4f
FIX: Remove sneaky breakpoint
NamamiShanker ec0149c
MAINT: Remove unused build_dir function
NamamiShanker e58a3e3
FIX: Processing macros
NamamiShanker 9829afb
FIX: f2cmap flag picking up positional args
NamamiShanker 0c0a8fd
FIX: Print f2py version
NamamiShanker 8b647aa
TST: Add f2pyarg modules to public api list
NamamiShanker 39523e8
ENH: Add f2cmap support to f2pyarg compilation
NamamiShanker 8d26dfb
ENH: Add typing support
NamamiShanker faf6044
ENH: Add typing support to f2pyarg
NamamiShanker 073c1eb
FIX: Typing in f2py service file
NamamiShanker 6ee477e
MAINT: Remove unnecessary imports
NamamiShanker 818996f
FIX: Add pyf.src file support to f2pyarg
NamamiShanker b24509b
FIX: Remove os.path dependency from f2pyarg
NamamiShanker 0606f6c
FIX: Remove os.path dependency from f2py service
NamamiShanker 7fb2af1
FIX: Replace os.path with pathlib.Path
NamamiShanker a81091b
FIX: Typing
NamamiShanker 6e00457
MAINT: Use boolean values instead of integers
NamamiShanker 98f9b6e
MAINT: Refactorings
NamamiShanker b774d68
MAINT: Remove unnecessary comments
NamamiShanker f57e191
FIX: set_dependecies_dist potential bug
NamamiShanker eeaac5d
MAINT: Rename regex variables as module constants
NamamiShanker 5d9f32a
MAINT: Replace os.path with pathlib.Path
NamamiShanker 8307d1f
MAINT: Typing and pathlib related refactoring
NamamiShanker ee6f638
FIX: Passing rem to f2pyflags_dist
NamamiShanker 8d89d65
FIX: Always convert f2cmap_file to Path type
NamamiShanker 9596d42
MAINT: Apply changes from code review
NamamiShanker b93e054
MAINT: No need to use try..finally
NamamiShanker 0d7da60
FIX: Return full path string
NamamiShanker 83f84ce
FIX: Print name of PosiPath type variable
NamamiShanker 4e1fcd4
MAINT: Refactorings from code review
NamamiShanker 523d41f
MAINT: Refactorings from code review
NamamiShanker 99d59db
FIX: Typing errors
NamamiShanker b181708
FIX: Replace builtin types with typing
NamamiShanker 0a18b55
MAINT: Add docstring to explain open_build_dir
NamamiShanker b489d88
ENH: Add temporary comments
NamamiShanker 3c69667
ENH: Use builtin types in place of typing
NamamiShanker 9323b91
BUG: Seperate paths by colon
NamamiShanker 3b04931
MAINT: Sort by alphabetical order
NamamiShanker 8a23d37
MAINT: Fix typo
NamamiShanker e528972
ENH: Add custom string flags parsing
NamamiShanker df65a2e
FIX: Flag nargs
NamamiShanker e0637df
MAINT: Correct docstring
NamamiShanker c81e90b
BUG: "--noopt" flag bugfix
NamamiShanker 3ac23f8
MAINT: Return Path object of tempdir
NamamiShanker 0b2c031
BUG: Lower C wrapper defs by default for less buggy imports
NamamiShanker c910d6b
BUG: Read module name from pyf file without -c
NamamiShanker a35027e
Revert "BUG: Read module name from pyf file without -c"
NamamiShanker 263e3f9
BUG: Change default value of lower flag
NamamiShanker 9ef6974
BUG: Change default module name
NamamiShanker 9e8756c
MAINT: Set Default empty gen False
NamamiShanker 78b9b98
BUG: Get module name from postlist
NamamiShanker 8ce9426
BUG: Shift files to the end of sys.argv
NamamiShanker 5aa96cd
BUG: f2pyarg sort args fix
NamamiShanker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
ENH: Start refactoring f2py front-end
- Loading branch information
commit e8ff86e3c1e6dd1ff8405892d90c4c1a62d23685
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/env python3 | ||
|
||
""" | ||
argparse front-end to f2py | ||
|
||
The concept is based around the idea that F2PY is overloaded in terms of | ||
functionality: | ||
|
||
1. Creating the wrapper `.c` files | ||
2. Generating `.pyf` signature files | ||
3. Compilation helpers | ||
a. This essentially means `numpy.distutils` for now | ||
|
||
The three functionalities are largely independent of each other, hence the | ||
implementation in terms of subparsers | ||
""" | ||
|
||
import argparse | ||
|
||
|
||
parser = argparse.ArgumentParser( | ||
prog="f2py", | ||
description="""This program generates a Python C/API file | ||
(<modulename>module.c) that contains wrappers for given fortran | ||
functions so that they can be called from Python. With the -c | ||
option the corresponding extension modules are built.""", | ||
add_help=False, | ||
) | ||
|
||
build_helpers = parser.add_argument_group("build helpers") | ||
generate_wrappers = parser.add_argument_group("wrappers and signature files") | ||
|
||
# Common # | ||
########## | ||
|
||
parser.add_argument( | ||
"Fortran Files", | ||
metavar="<fortran files>", | ||
type=str, | ||
nargs="*", | ||
help="""Paths to fortran/signature files that will be scanned for | ||
<fortran functions> in order to determine their signatures.""", | ||
) | ||
|
||
parser.add_argument("--2d-numpy", default=True, help="Use f2py with Numeric support") | ||
|
||
# Wrappers/Signatures # | ||
####################### | ||
|
||
generate_wrappers.add_argument( | ||
# TODO: Seriously consider scrapping this naming convention | ||
"-h", | ||
"--hint-signature", | ||
type=str, | ||
nargs=1, | ||
help="""Write signatures of the fortran routines to file <filename> and | ||
exit. You can then edit <filename> and use it instead of | ||
<fortran files>. If <filename>==stdout then the signatures | ||
are printed to stdout.""", | ||
) | ||
|
||
parser.add_argument("--help", action="store_true", help="Print the help") | ||
|
||
|
||
def process_args(args): | ||
if args.help: | ||
parser.print_help() | ||
elif getattr(args, "Fortran Files"): | ||
print("BOOM") | ||
else: | ||
parser.print_usage() | ||
|
||
|
||
if __name__ == "__main__": | ||
args = parser.parse_args() | ||
process_args(args) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.