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.2.1.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rv_script_utils-0.2.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rv_script_utils-0.2.1.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for rv_script_utils-0.2.1.tar.gz
Algorithm Hash digest
SHA256 81acaf7a692808b894386e911220541aadb12b4e17918f4c33e375c8aae9b4cd
MD5 97926b82dbe6b4a14b53a882252f73b0
BLAKE2b-256 bc81b3588d3b00879e2de878cc9e8f45de7dcdf9c1a95165528ab5d3f85315b1

See more details on using hashes here.

Provenance

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

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for rv_script_utils-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d770b9bc680dcbc7b6eb91a7137ad581f213019893a4f19837cb45c06eb6e78d
MD5 131b968fc8f55fe0d96b3685a800e7ef
BLAKE2b-256 197ddbc8a4bfbcaf9ed0015f283dfa520604dfe7b7450ae3efb9d7882013d0b7

See more details on using hashes here.

Provenance

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

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

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