Skip to content

Commit

Permalink
Merge pull request #14 from pseeth/ps/omegaconf
Browse files Browse the repository at this point in the history
Small changes to make ArgBind play well with other config frameworks.
  • Loading branch information
pseeth authored Feb 26, 2024
2 parents f3fe70c + fde609a commit 13360c8
Show file tree
Hide file tree
Showing 27 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]
python-version: [3.12]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]
python-version: [3.12]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ dmypy.json
# Pyre type checker
.pyre/

scratch.py
scratch.*
4 changes: 3 additions & 1 deletion argbind/argbind.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ def parse_args(p=None, group: Union[list, str] = "default"):
used_args = [x.replace('--', '').split('=')[0] for x in sys.argv if x.startswith('--')]
used_args.extend(['args.save', 'args.load'])

args = vars(p.parse_args())
known, unknown = p.parse_known_args()
sys.argv = sys.argv[:1] + unknown
args = vars(known)
load_args_path = args.pop('args.load')
save_args_path = args.pop('args.save')
debug_args = args.pop('args.debug')
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name='argbind',
version='0.3.7',
version='0.3.8',
description='Simple way to bind function arguments to the command line.',
long_description=long_description,
long_description_content_type='text/markdown',
Expand All @@ -34,7 +34,7 @@
python_requires='>=3.5, <4',
install_requires=[
'pyyaml',
'docstring-parser'
'docstring-parser',
],
extras_require={
'tests': ['pytest', 'pytest-cov', 'torch', 'torchvision'],
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/bind_class/bind_class.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ usage: bind_class.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
[--Example.some_class_method.y EXAMPLE.SOME_CLASS_METHOD.Y]
[--Example.x EXAMPLE.X]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/bind_existing/with_argbind.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ usage: with_argbind.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
[--args.debug ARGS.DEBUG] [--MyClass.x MYCLASS.X]
[--my_func.x MY_FUNC.X]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/edge_cases/add_to_parser.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ usage: add_to_parser.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
positional arguments:
pos

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/edge_cases/pass_kw_as_pos_bug.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ usage: pass_kw_as_pos_bug.py [-h] [--args.save ARGS.SAVE]
[--args.load ARGS.LOAD] [--args.debug ARGS.DEBUG]
[--main.x MAIN.X] [--main.y MAIN.Y]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/groups/main.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ usage: main.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
[--args.debug ARGS.DEBUG] [--some_arg SOME_ARG]
[--data_dir DATA_DIR] [--save_path SAVE_PATH]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/hello_world/with_argbind.py.help
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
usage: with_argbind.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
[--args.debug ARGS.DEBUG] [--hello.name HELLO.NAME]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ usage: with_argbind_positional.py [-h] [--args.save ARGS.SAVE]
[--hello.notes HELLO.NOTES]
hello.name hello.email

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ usage: with_argbind_positional_pattern.py [-h] [--args.save ARGS.SAVE]
[--hello.notes HELLO.NOTES]
hello.name hello.email

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/hello_world/with_argparse.py.help
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
usage: with_argparse.py [-h] [--name NAME]

optional arguments:
options:
-h, --help show this help message and exit
--name NAME Who you're saying hello to.
2 changes: 1 addition & 1 deletion tests/regression/migration/argbind_script.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ usage: argbind_script.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
[--args.debug ARGS.DEBUG] [--arg2 ARG2] [--arg3 ARG3]
arg1

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/migration/argparse_script.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ usage: argparse_script.py [-h] [--arg2 ARG2] [--arg3 ARG3] arg1
positional arguments:
arg1 The first argument (positional)

optional arguments:
options:
-h, --help show this help message and exit
--arg2 ARG2 The second argument (keyword)
--arg3 ARG3 The third argument (keyword)
2 changes: 1 addition & 1 deletion tests/regression/mnist/with_argbind.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ usage: with_argbind.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
[--main.log_interval MAIN.LOG_INTERVAL]
[--main.save_model]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/mnist/with_argbind_and_refactor.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ usage: with_argbind_and_refactor.py [-h] [--args.save ARGS.SAVE]
[--main.no_cuda] [--main.seed MAIN.SEED]
[--main.save_model]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/mnist/with_argparse.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ usage: with_argparse.py [-h] [--batch-size N] [--test-batch-size N]

PyTorch MNIST Example

optional arguments:
options:
-h, --help show this help message and exit
--batch-size N input batch size for training (default: 64)
--test-batch-size N input batch size for testing (default: 1000)
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/multistage/multistage.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ usage: multistage.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
[--analyze.results_folder ANALYZE.RESULTS_FOLDER]
[--run.stages RUN.STAGES]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ usage: multistage_with_subcommands.py [-h] [--args.save ARGS.SAVE]
[--analyze.results_folder ANALYZE.RESULTS_FOLDER]
stage

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/nested_yaml/main.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ usage: main.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
[--func.arg2 FUNC.ARG2] [--func.arg3 FUNC.ARG3]
[--func.arg4 FUNC.ARG4]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/scoping/with_argbind.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ usage: with_argbind.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
[--args.debug ARGS.DEBUG]
[--dataset.folder DATASET.FOLDER]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/scoping/with_argparse.py.help
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
usage: with_argparse.py [-h] [--train_folder TRAIN_FOLDER]
[--val_folder VAL_FOLDER] [--test_folder TEST_FOLDER]

optional arguments:
options:
-h, --help show this help message and exit
--train_folder TRAIN_FOLDER
--val_folder VAL_FOLDER
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/typing/with_argbind.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ usage: with_argbind.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
[--func.list_str_arg FUNC.LIST_STR_ARG]
[--func.bool_arg] [--func.tuple_arg FUNC.TUPLE_ARG]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/without_prefix/without_prefix.py.help
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
usage: without_prefix.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
[--args.debug ARGS.DEBUG] [--name NAME]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/yaml/main.py.help
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ usage: main.py [-h] [--args.save ARGS.SAVE] [--args.load ARGS.LOAD]
[--func.arg2 FUNC.ARG2] [--func.arg3 FUNC.ARG3]
[--func.arg4 FUNC.ARG4] [--func.arg5 FUNC.ARG5]

optional arguments:
options:
-h, --help show this help message and exit
--args.save ARGS.SAVE
Path to save all arguments used to run script to.
Expand Down

0 comments on commit 13360c8

Please sign in to comment.