This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add Configuration file parser action
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Chris Nyland
Priority: normal Keywords: patch

Created on 2016-09-11 02:30 by Chris Nyland, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
ConfigFileAction.patch Chris Nyland, 2016-09-11 02:30 Patch of the changes made to the argparse.py module review
Messages (1)
msg275725 - (view) Author: Chris Nyland (Chris Nyland) * Date: 2016-09-11 02:30
I have recently developed a action for the argparse module that allows arguments to be read in from configuration files. It is different in functionality than the convert_arg_line_to_args in that the file path(s) is passed to the action and then opened. This allows a user to sub class the action and use which ever parser they chose. For a default option the action uses the built in configparser module. 

To implement it properly I had to adjust some of the code in the the parse functions of the ArgumentParser class. Namely I had to make the take_action function a method of the class so that it could be called by the action. I also had to make a few variables that were private to the function attributes of the class.

If the patch is accepted I would be willing to write some tests as well as documentation. This is my first time submitting a patch like this so any feed back would be appreciated. 

Adding it to the core library would seem to fit nicely into the batteries included idea of Python.
History
Date User Action Args
2022-04-11 14:58:36adminsetgithub: 72261
2016-09-11 02:30:34Chris Nylandcreate