Package for combining config and command-line args
Project description
Project description
config-args is a Python library for reading configuration from config files and command-line args.
Installation
pip install argumento
Usage
You can define configuration parameters both in config files and in command-line arguments.
Command-line args have higher priority: param values from command line overwrite values from config files.
Supported config file formats are:
- yaml (.yaml, .yml)
- toml (.toml)
- json (.json)
Basic example:
import argumento
cfg_filename = 'my_config.yaml'
args = argumento.create_parser(cfg_filename).parse()
If a parameter is required but is not set in config file, ?:
followed by type name is used instead of a value:
login: "?:str"
max_retries: "?:int"
ratio: "?:float"
ports: "?:list[int]"
fractions: "?:list[float]"
Supported data types are:
- str
- int
- float
- list[int]
- list[float]
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
argumento-1.0.5.tar.gz
(16.3 kB
view hashes)
Built Distribution
argumento-1.0.5-py3-none-any.whl
(16.8 kB
view hashes)
Close
Hashes for argumento-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc9a872cf8874872632c334e7abfb714660a500f8b98ddc62281cf55c1ab5e4c |
|
MD5 | 177b3f090d7b899b9cfc6f5d4872463d |
|
BLAKE2b-256 | f35c9bd2ca96bb627e5cefdcd50f466e4782cbbdc57435c335dc60114143f668 |