Argparse_logging
This is a simple library to configure logging from command line argument when using argparse.
Without argparse_logging:
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument(
"--log-level",
default=logging.INFO,
type=lambda x: getattr(logging, x)),
help="Configure the logging level.",
)
args = parser.parse_args()
logging.basicConfig(level=args.log_level)
This is a bit annoying to copy paste in every program.
Instead you can use argparse_logging to get the following:
from argparse import ArgumentParser
from argparse_logging import add_log_level_argument
parser = ArgumentParser()
add_log_level_argument(parser)
args = parser.parse_args()
Deployment
You will need git, pipenv, python, pre-commit. Then you can set up your virtual environment:
$ git clone git@github.com:nanassito/argparse_logging.git
$ cd argparse_logging
$ pipenv update --dev
Do whatever changes you want. You can run the tests and linting with:
$ pipenv run py.test
$ pre-commit
Metadata
Release files for argparse-logging 2020.11.26
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| argparse_logging-2020.11.26.tar.gz | 2.9 kB | Without provenance | Details for argparse_logging-2020.11.26.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| argparse_logging-2020.11.26-py3-none-any.whl | Python 3 | none | any | Details for argparse_logging-2020.11.26-py3-none-any.whl |
Total release size: 5.7 kB
Release files / argparse_logging-2020.11.26.tar.gz
| Download URL | argparse_logging-2020.11.26.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43f2527ea4f43fc07c93c6f26bddb18e6c25ac33e3095b2ca1f09e1f8107ab96
|
|
BLAKE2b-256 checksum How to use checksums |
b18552a7ee13a298085b94516a3079132c2291fff8749c99b81ee69558616bda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0
|
Release files / argparse_logging-2020.11.26-py3-none-any.whl
| Download URL | argparse_logging-2020.11.26-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e861e9f78da497cdb7b5da5ffee7bc021157b62b53e0947f7573f69113275c4f
|
|
BLAKE2b-256 checksum How to use checksums |
d93c48341aacd4ea243fa01ba2506f557a3deef49efb070ac08de5519d22ea8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0
|
Security for argparse-logging 2020.11.26
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.