Skip to main content

No project description provided

Project description

Config CLI

Config_CLI is an extremely lightweight command line interface to your YAML configuration file. Just create a yaml config file, and config_CLI will add command line arguments to it automatically. Suppose you have a YAML file test.yaml:

outer:
    x: 0
    inner:
        y: 1
        eveninner:
            z: abc

then you can use it in the code main.py:

from config_cli import add_arguments
import yaml
from pathlib import Path
my_config_path = 'test.yaml'
conf = yaml.safe_load(Path(my_config_path).read_text())
conf = add_arguments(conf)
print(conf)

Now you can call main.py as follows:

python main.py --outer.x 2 --outer.inner.eveninner.z hello

Your program output will be:

{'outer': {'x': 2, 'inner': {'y': 1, 'eveninner': {'z': 'hello'}}}}

Alternatively if you want to pass the config file as a command line argument you can modify the code as follows:

from config_cli import add_arguments
conf = add_arguments()

Now you call main.py as :

python main.py --config test.yaml --outer.x 2 --outer.inner.eveninner.z hello

Project details


Download files

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

Source Distribution

yaml_config_override-0.1.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

yaml_config_override-0.1.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file yaml_config_override-0.1.1.tar.gz.

File metadata

  • Download URL: yaml_config_override-0.1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.9 Linux/5.15.0-60-generic

File hashes

Hashes for yaml_config_override-0.1.1.tar.gz
Algorithm Hash digest
SHA256 054947f511707cfdd54273bb2b0018651ebfd0b7615165f2559ef5295dfbb018
MD5 fc55f2db81520d87fd883bb9423677dd
BLAKE2b-256 4ccfcd4dd5090d8b55436f629143c3e799bc26c45c21115f6f7a2006f5146a99

See more details on using hashes here.

File details

Details for the file yaml_config_override-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: yaml_config_override-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.9 Linux/5.15.0-60-generic

File hashes

Hashes for yaml_config_override-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf5c43f797c82b0627fddd0000e8079efd34e67d1fd9b0c540f819b8ed7319c6
MD5 e0dbe96d7242488a0adc539d103da636
BLAKE2b-256 b55bbf144cf5fd256c3ca939b067187044ca53ae32cfaff20beec34d13b38ee0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page