Import YAML configs into Arguments for Python
Project description
bibiflags is a python tool to import YAML configs into Arguments for Python .
It provides 2 ways to use it:
- Parse all Arguments from YAML: see example .
- Merge Arguments form YAML and existing argparse.ArgumentParser: see example .
Getting Started
Requirements and Installation
- Python version >= 3.8
- libaries:
- "PyYAML>=6.0.1"
- "OmegaConf>=2.3.0"
- "loguru>=0.7.2"
pip install bibiflags
Install from source via:
pip install git+https://github.com/bibiparrot/bibiflags.git
Or clone the repository and install with the following commands:
git clone git@github.com:bibiparrot/bibiflags.git
cd bibiflags
pip install -e .
Usage
Parse all Arguments from YAML
from pathlib import Path
from bibiflags import BibiFlags
if __name__ == '__main__':
flags = BibiFlags(root=str(Path(__file__).parent))
print(flags.parameters)
Merge Arguments form YAML and existing argparse.ArgumentParser
from pathlib import Path
from bibiflags import BibiFlags
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("echo", action='store_true')
flags = BibiFlags(argparser=parser,
root=str(Path(__file__).parent),
app_name='main')
print(flags.parameters)
Changelog
Version 0.1.2 2024-4-10
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
bibiflags-0.1.2.tar.gz
(44.8 kB
view hashes)
Built Distribution
Close
Hashes for bibiflags-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac544c46426da09a5d8cefc490ae1427fa215ea1be0aa5d0cf8e99601991080a |
|
MD5 | 59241df92c423bfe8d50aed2859cd6f2 |
|
BLAKE2b-256 | 28033acc295ca390e9f32f673fff88e168b12d782432ed3d480bb34804d18f8b |