Helper Methods For argparse
Project description
efficient-args - Helper Methods For argparse
Provides some simple methods for setting up scripts / apps in a multi-environment context.
Usage
Installation:
pip install efficient-args
This library was created to be used with scripts / apps that operate in multiple environments
from efficient_args import FORMATTER, addBaseArgs, addListArgs, parseArgs, parseCmdLineList
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Example Command Parser", formatter_class=FORMATTER)
addBaseArgs(parser, addEnvironment=True)
addListArgs(parser, required=True, itemName="Words")
argDict = parseArgs(parser)
words = parseCmdLineList(argDict)
print(words)
Results in the output:
user@pc MINGW64 /efficient_args
23:50:45 (env) $ python examples/ex1.py -f tests/itemList.txt
{'environment': 'test', 'list': [], 'file': 'tests/itemList.txt'}
['x33', 'x88', 'x44']
Cloning For Development
Set up a virtual environment. Once an environment is set up, activate it and add dependencies with the following:
pip install -r requirements/dev.txt
The dev.txt file includes:
- BLACK, a code formatter, see notes at the bottom of this file for details
- build, which provides the support for the building of the package
To run tests:
python -m unittest discover -s tests/
Code Formatting
Code formatting is done using BLACK. BLACK allows almost no customization to how code is formatted with the exception of line length, which has been set to 119 characters.
Use the following to bulk format files:
black . -l 144
Creating A New Release
Please do the following when making a new release, most are documented above:
- Run tests
- Code format
- Be sure to update the change log and _metadata.json with version and notes
- git add, commit, and push changes
- run the following code to generate a wheel:
python -m build
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file efficient_args-1.3.0.tar.gz.
File metadata
- Download URL: efficient_args-1.3.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b7300721c9a24b86f9fa252116f25e4d22da6d8b896968f02aefb6e0f2e518e
|
|
| MD5 |
6b32cf3f1788c56f51641747d22a5a82
|
|
| BLAKE2b-256 |
b7abe26cdc82f43a95cfbbb44705e874acf7370532885b32a5c86ced23c38dd7
|
Provenance
The following attestation bundles were made for efficient_args-1.3.0.tar.gz:
Publisher:
publish.yml on joemarchionna/efficient_args
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
efficient_args-1.3.0.tar.gz -
Subject digest:
9b7300721c9a24b86f9fa252116f25e4d22da6d8b896968f02aefb6e0f2e518e - Sigstore transparency entry: 1244492588
- Sigstore integration time:
-
Permalink:
joemarchionna/efficient_args@692a6a114f8d9e3dfd1813302a1aadefdc279e13 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/joemarchionna
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@692a6a114f8d9e3dfd1813302a1aadefdc279e13 -
Trigger Event:
release
-
Statement type:
File details
Details for the file efficient_args-1.3.0-py3-none-any.whl.
File metadata
- Download URL: efficient_args-1.3.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e731c4b185a09d23095e64f5117a4b97d10b2efb83fdb24eb8b705144985217c
|
|
| MD5 |
90058e32e16f9978d1644af935c8f384
|
|
| BLAKE2b-256 |
960a8608df591d44e33d5c77b84334294ddcf5d7ba5edd003cad448f836ef9d1
|
Provenance
The following attestation bundles were made for efficient_args-1.3.0-py3-none-any.whl:
Publisher:
publish.yml on joemarchionna/efficient_args
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
efficient_args-1.3.0-py3-none-any.whl -
Subject digest:
e731c4b185a09d23095e64f5117a4b97d10b2efb83fdb24eb8b705144985217c - Sigstore transparency entry: 1244492630
- Sigstore integration time:
-
Permalink:
joemarchionna/efficient_args@692a6a114f8d9e3dfd1813302a1aadefdc279e13 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/joemarchionna
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@692a6a114f8d9e3dfd1813302a1aadefdc279e13 -
Trigger Event:
release
-
Statement type: