Skip to main content

Utilities to help make scripts

Project description

rv-script-utils

Script utilities to add in structured logging and support for healthchecks.io. See example of use in hello.py and in the example below.

from typing import Self

from rv_script_lib import ScriptBase


class HelloWorld(ScriptBase):

    PARSER_ARGPARSE_KWARGS = {
        "description": "Hello World",
    }

    def extraArgs(self: Self):

        self.parser.add_argument(
            "-m",
            "--message",
            type=str,
            dest="message",
            default="you forgot to add a message with -m/--message",
            help="What do you want to say?",
        )

    def runJob(self: Self):

        self.log.info("Hello from rv-script-utils!")

        try:
            raise RuntimeError("This is just a test")
        except Exception as e:
            self.log.exception(e)

        self.log.warning("Warning, just for fun")

        self.log.info(self.args.message)


if __name__ == "__main__":

    myscript = HelloWorld()
    myscript.run()

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

rv_script_utils-0.1.0.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

rv_script_utils-0.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file rv_script_utils-0.1.0.tar.gz.

File metadata

  • Download URL: rv_script_utils-0.1.0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for rv_script_utils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8f40ba210c133aecc26f1bbc9fcfea2fc2fc0b801796a77815bcca44dfaab80c
MD5 3fe00a136f4e1cabcd1f5db5b00a8b5a
BLAKE2b-256 59a15d83f57efd3074b17d49adc4697d91c165beaa74a044803be3973c877ed7

See more details on using hashes here.

Provenance

The following attestation bundles were made for rv_script_utils-0.1.0.tar.gz:

Publisher: python-package.yml on rveachkc/rv-script-utils

Attestations:

File details

Details for the file rv_script_utils-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rv_script_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82133bd1a4150ac3798fd0ff57df17857687dda082d3a96c066758c3c3e395b4
MD5 9fc39dd0b581e87475e4f7848064a796
BLAKE2b-256 118fabe273f26c26948036bcf0ec1f81d0432192ac8fcb3dad0b24862fa01f07

See more details on using hashes here.

Provenance

The following attestation bundles were made for rv_script_utils-0.1.0-py3-none-any.whl:

Publisher: python-package.yml on rveachkc/rv-script-utils

Attestations:

Supported by

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