How to get arguments from ArgParser to write to a textfile so it can be read with fromfile_prefix_chars
Sumary I want a script to save all input arguments to a text file in such a format that I can re-run the script using fromfile_prefix_chars with that file. This is to allow for easy reproducability and store the arguments that were used to generate certain data. I have a very brittle and incomplete implementation. […]
How to explicitely list allowed keyword arguments in python for IDE support?
I’m using
ArgumentParser
in python and giving users the option to add their own functions to my script. For that, I’m giving them a function that generates data that gets used in argparse’s
add_argument()
function. I noticed that add_argument’s signature is
add_argument(self, *args, **kwargs)
but when looking at the documentation in vscode I can see all the different arguments it can get (action, nargs, const, default, etc.). How does python do it? As far as I know when you give the user **kwargs it is shown as **kwargs and that’s it.
How to determine 3 scenarios using argparse
How to determine 3 scenarios using the same switch -f in the same script using argparse, say script is called script.py