Hello, I'm often using ArgumentParser in my projects, as well as its ability to read argument lists from files. However, the problem is that nested includes of such argument files have to specify paths relative to os.getcwd(), no matter where the file containing the include statement is located. Currently, this can be circumvented by always using absolute paths. But imho that is not a practical solution, due to the obvious portability issues it causes.
I suggest adding a new parameter to argparse.ArgumentParser that
controls the behaviour:
* fromfile_parent_relative_ - Whether to treat paths of included argument
files as relative to the location of the file they are specified in
(``True``) or to the current working directory (``False``)
(default: ``False``)
Doing so would allow users to choose between the two different strategies
while keeping backwards compatibility.
I made a pull request [1] which adds the functionality + docs to
demonstrate a possible solution.
What do you think about this enhancement?
Please note this is my first contribution to cpython. I now know that I
should have presented it to python-ideas before starting a pull request.
Sorry for doing it the wrong way around.
Best regards
Robert
[1] https://github.com/python/cpython/pull/1698
signature.asc
Description: PGP signature
_______________________________________________ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
