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"
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
YAML file
flags:
- dest: filename
help: positional args
type: str
required: true
- default: string-type-arguments
dest: str_arg
help: string type args
option_strings:
- --str_arg
- -sa
type: str
- const: true
default: false
dest: bool_arg
help: bool type args
nargs: 0
option_strings:
- --bool_arg
- -ba
type: bool
- default: 8
dest: int_arg
help: int type args
option_strings:
- --int_arg
- -ia
type: int
- default: 0.1
dest: float_arg
help: float type args
option_strings:
- --float_arg
- -fa
type: float
- default:
- 1
- 2
- 3
- 4
dest: list_arg
help: list type args
nargs: +
option_strings:
- --list_arg
- -la
type: int
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.5 2024-4-14
Metadata
Release files for bibiflags 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bibiflags-0.1.5.tar.gz | 45.8 kB | Without provenance | Details for bibiflags-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bibiflags-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for bibiflags-0.1.5-py3-none-any.whl |
Total release size: 54.5 kB
Release files / bibiflags-0.1.5.tar.gz
| Download URL | bibiflags-0.1.5.tar.gz |
|---|---|
| Size | 45.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7099e0b117542fd82f04aea29d89a8dfa1f18b35200ab9d2ed3729e7521581bb
|
|
BLAKE2b-256 checksum How to use checksums |
66b42a1c8c9c05544d4d272d0de25ace6affecbfb42039e52a800fd319296c03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.13.3 CPython/3.8.16 Windows/10
|
Release files / bibiflags-0.1.5-py3-none-any.whl
| Download URL | bibiflags-0.1.5-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3baae7599be91b9b833af71d51df852b1e84ec4e255399124c52332c6a9d83c8
|
|
BLAKE2b-256 checksum How to use checksums |
c2c02ebfa2f39923dcdf8c626416c862cb482f8935784627bd7f7ebc975a4844
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.13.3 CPython/3.8.16 Windows/10
|
Security for bibiflags 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.