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.2.0.tar.gz (5.7 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.2.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file efficient_args-1.2.0.tar.gz.

File metadata

  • Download URL: efficient_args-1.2.0.tar.gz
  • Upload date:
  • Size: 5.7 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.2.0.tar.gz
Algorithm Hash digest
SHA256 503e42a6e5bc28f8eabcde19d3e4484480aa9f7ce1fc7bdbf054fd30b34bd9c5
MD5 6f088fe4cee8d3d8592c10af3377a488
BLAKE2b-256 ff31272e9b375e5accae4df29755bff0fdbc7dfb7ff887b6dcb953de72911d5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for efficient_args-1.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: efficient_args-1.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f28a4de904d03b9751a7110bd45aac495180cd1bbcd897be400070c1ca88969a
MD5 7bb80314e6f1c4f47fde173f63e9cc26
BLAKE2b-256 9d04465c7d75968e5f5cda209699b3abc641f3b8ffa7890357b89c6a820a138c

See more details on using hashes here.

Provenance

The following attestation bundles were made for efficient_args-1.2.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