Add fully automatic argparse argument saving with ArgumentParser - #36
Draft
joey-kilgore with Copilot wants to merge 3 commits into
Draft
joey-kilgore with Copilot wants to merge 3 commits into
joey-kilgore with Copilot wants to merge 3 commits into
Conversation
…rguments Co-authored-by: joey-kilgore <22432499+joey-kilgore@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add autosave for command line arguments in argparse
Add saveArgs() to automatically persist argparse CLI arguments
Nov 20, 2025
Owner
|
@copilot The hope was to do this automatically so that when we call parser.parse_args() to automatically save that args to file? is there a way to handle this? |
Co-authored-by: joey-kilgore <22432499+joey-kilgore@users.noreply.github.com>
Author
Yes! I've implemented fully automatic saving. Now you can use Two ways to use it: Option 1 - Set simTag globally: from SimLogger import SimLogger
SimLogger.setSimTag('myExperiment')
parser = SimLogger.ArgumentParser()
parser.add_argument('--learning_rate', type=float, default=0.001)
args = parser.parse_args() # Automatically saved!Option 2 - Pass simTag to parser: parser = SimLogger.ArgumentParser(simTag='myExperiment')
args = parser.parse_args() # Automatically saved!No need to call Implemented in commit cb97827. |
Copilot
AI
changed the title
Add saveArgs() to automatically persist argparse CLI arguments
Add fully automatic argparse argument saving with ArgumentParser
Nov 21, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Users frequently forget to save command-line arguments when using argparse, making it difficult to reproduce scientific experiments.
Changes
SimLogger.ArgumentParserclass - Custom ArgumentParser that automatically saves arguments whenparse_args()is called (fully automatic!)setSimTag()function - Sets global simulation tag for automatic savingsaveArgs()function - Manual saving option that acceptssimTagand argparseNamespace, converts to dict, persists via pickle, and logs each argument individuallyUsage
Fully Automatic (Recommended)
Alternatively, pass
simTagdirectly to the parser:Manual Saving
Loading Saved Arguments
Arguments are logged individually:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.