Skip to main content
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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minihydra_leviathan-1.0.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file minihydra_leviathan-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for minihydra_leviathan-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9e5aad3a365601c623ffff8deaae31ed187f7a941d93f777931ff1460a980eb
MD5 23f715ff282b0c3938302f046c4c8560
BLAKE2b-256 4159bfe0e278433fc35dcd76b1bb3e722a23d626b527f96b23b9a67114a863d2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 file

1.0.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page