Skip to main content

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:

  1. Run tests
  2. Code format
  3. Be sure to update the change log and _metadata.json with version and notes
  4. git add, commit, and push changes
  5. run the following code to generate a wheel:
    python -m build

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

efficient_args-1.3.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

efficient_args-1.3.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

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

Hashes for efficient_args-1.3.0.tar.gz
Algorithm Hash digest
SHA256 9b7300721c9a24b86f9fa252116f25e4d22da6d8b896968f02aefb6e0f2e518e
MD5 6b32cf3f1788c56f51641747d22a5a82
BLAKE2b-256 b7abe26cdc82f43a95cfbbb44705e874acf7370532885b32a5c86ced23c38dd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for efficient_args-1.3.0.tar.gz:

Publisher: publish.yml on joemarchionna/efficient_args

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for efficient_args-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e731c4b185a09d23095e64f5117a4b97d10b2efb83fdb24eb8b705144985217c
MD5 90058e32e16f9978d1644af935c8f384
BLAKE2b-256 960a8608df591d44e33d5c77b84334294ddcf5d7ba5edd003cad448f836ef9d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for efficient_args-1.3.0-py3-none-any.whl:

Publisher: publish.yml on joemarchionna/efficient_args

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page