console script boilerplate
some boilerplate stuff for console scripts. inspired by now unmaintained pyCLI.
decorate your main function and register it in your setup.py as console_scripts
entry_point [1]. the function will receive an app object as argument.
you get:
- pythons
ArgumentParser KeyboardInterruptis catchedSIGTERMis handled, so that context managers will exit properly- logging helper
exit_handler and sigterm_handler may be customized.
[1] https://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation
example
from csboilerplate import cli_app
@cli_app(name=__name__)
def main(app):
app.logging_config(log_level=app.args.debug)
# do your stuff
main.argparser.add_argument('-d', '--debug', action='count', default=0,
help='lower logging threshold, may be used twice')
dev env
checkout git and:
virtualenv .env -p python3
. .env/bin/activate
pip install -e .[dev]
Metadata
Release files for csboilerplate 0.1.0
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 |
|---|---|---|---|---|
| csboilerplate-0.1.0.tar.gz | 7.8 kB | Without provenance | Details for csboilerplate-0.1.0.tar.gz |
Release files / csboilerplate-0.1.0.tar.gz
| Download URL | csboilerplate-0.1.0.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d3921a2a682d7471d27c72b796909ac33db99a42dcc9fa02e80d782ae41d79a4
|
|
BLAKE2b-256 checksum How to use checksums |
5a58c638e4c756a9ab27f8b3a7e18a507882d7037fdfed1261a77c3ce5a07906
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for csboilerplate 0.1.0
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.