minihydra-leviathan

A lightweight sys-arg manager.


Keywords
sys, args, hyperparams, command, line, artificial, intelligence, machine, learning, deep, reinforcement, image, classification
License
MIT
Install
pip install minihydra-leviathan==1.0.1

Documentation

logo
pip install minihydra-leviathan

Reading in args

# run.py

from minihydra import just_args

args = just_args()

print(args, '\n')
print(args.hello)
print(args.number)
print(args.goodbye.cruel)
> python run.py hello=world number=42 goodbye.cruel='[world]'

{'hello': 'world', 'number': 42, {'goodbye': {'cruel': ['world']}}}

world
42
[world]

Via yaml

# path/to/args.yaml

hello: world
number: 42
goodbye:
  cruel: 
    - world
# run.py

from minihydra import just_args

args = just_args(source='path/to/args.yaml')

print(args, '\n')
print(args.hello)
print(args.number)
print(args.goodbye.cruel)
> python run.py number=43

{'hello': 'world', 'number': 43, {'goodbye': {'cruel': ['world']}}}

world
43
[world]

As a decorator

# run.py

from minihydra import get_args

@get_args(source='path/to/args.yaml')
def main(args):
    print(args)

if __name__ == '__main__':
    main()
> python run.py

{'hello': 'world', 'number': 42, {'goodbye': {'cruel': ['world']}}}

Advanced

Further features include literals, function calls, instantiation, imports, interpolation, custom grammars, expanding module and yaml search paths, project directory inference, instantiation tinkering-syntax inference, portals, and pseudonyms.

For deeper documentation, please consider sponsoring.

logo

Licensed under the MIT license.