A tool that makes creating command line flags super easy.
Similar to argparse, switching is no problem at all! You can even use the FlagParserExtended as if it were a normal ArgumentParser for full integration with existing arguments.
Install with:
pip install ezflags
Here’s a simple example:
# main.py
import ezflags
parser = ezflags.FlagParser()
parser.add_flag('--flag', '-f', value=True, help="A demo flag.")
flags = parser.parse_flags()
print(flags.flag)
To integrate with ArgumentParser:
from ezflags.ext import FlagParserExtended
parser = FlagParserExtended()
parser.add_flag('--flag', '-f', value=True, help="A demo flag.")
parser.add_argument('--arg', '-a', help="A demo argument.")
args = parser.parse_args() # Flags are included, too!
print(args.flag)
print(args.arg)
This can be invoked as such:
python main.py --flag
# With ArgumentParser()
python main.py --flag --arg arg
View the full documentation here.
Supports
Supports Python 3.6 and up.
License
MIT license. See the LICENSE file for more details.
Release files for ezflags 1.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ezflags-1.4.2.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ezflags-1.4.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.1 kB
Release files / ezflags-1.4.2.tar.gz
| Download URL | ezflags-1.4.2.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2621362e3d7c16a804b8bb5bcdd380225587321fe71c975416521f063938e4e5
|
|
BLAKE2b-256 checksum How to use checksums |
e6c78859a4e76d193998fa3fff749295842bcf720751ea08bca530a3a2a4bbd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1
|
Release files / ezflags-1.4.2-py3-none-any.whl
| Download URL | ezflags-1.4.2-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
147eba0d3cb619c809489c1efe580d5b12e321c9f24ebb9b5aabb4c6c2674a12
|
|
BLAKE2b-256 checksum How to use checksums |
031bedefcea90f8b4b1f2c80485e61fddba0b5b59bace6a742b8fbd25f617bd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1
|