Skip to main content

argparse-env - argparse with environment

Use this package when you want to be able to set arguments wither at the command line or through environment variables.

from argparse_env import EnvArgumentParser

parser = EnvArgumentParser(env_prefix="MYAPP")
parser.add_argument
>>> from argparse_env import EnvArgumentParser
>>> parser = EnvArgumentParser(env_prefix='MYAPP')
>>> parser.add_argument("--hello", type=str, default="Alex" help="Say hello to.")
>>> parser.parse_args(["--hello", "Jane"])
Namespace(hello='Jane')
>>> parser.parse_args([])
Namespace(hello=Alex)
>>> import os
>>> os.environ["MYAPP_HELLO"] = "Jim"
>>> parser.parse_args([])
Namespace(hello='Jim')
>>> parser.parse_args(["--hello", "Jane"])
Namespace(hello='Jane')

argparse Feature Support

There are some extras added to the class to support argparse features from environment variables.

nargs

Provide arguments with nargs != 1 using a comma-separated list in an environment variable.

MYAPP_NARGS_MANY=arg1,arg2,arg3

store true/false

Use true, 1, or on for True or false, 0, or off for False.

MYAPP_STORE_FALSE=false
MYAPP_STORE_FALSE=off
MYAPP_STORE_TRUE=true
MYAPP_STORE_TRUE=1

Metadata

Release files for argparse-env 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for argparse-env 0.1.2
File Size Uploaded Provenance Actions
argparse_env-0.1.2.tar.gz 2.8 kB Without provenance Details for argparse_env-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for argparse-env 0.1.2
File Interpreter ABI Platform Actions
argparse_env-0.1.2-py3-none-any.whl Python 3 none any Details for argparse_env-0.1.2-py3-none-any.whl

Total release size: 6.0 kB

Release files / argparse_env-0.1.2.tar.gz

Download URL argparse_env-0.1.2.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
da5465ecbe4f38c16a2613757a1a9ce829b9d2549c4630f88b29567264d05cf5
BLAKE2b-256 checksum
How to use checksums
258e0eca49661e571ceb3f70383563299a148d7b58b7532565abe52679258e81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Release files / argparse_env-0.1.2-py3-none-any.whl

Download URL argparse_env-0.1.2-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc5b78bfb59b4f8eeac08b6baa1d7b8bea82ad104dd03d2fada132cc322b8dc5
BLAKE2b-256 checksum
How to use checksums
279eaa7e625979e27a7b6a9b56bade768b888663eed30b1b92bbb47be03c25d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.2

Security for argparse-env 0.1.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page