Skip to main content

Boilerplate for Python scripting

Project description

Scripting is a boilerplate library for one-off Python scripts when you don’t have an IDE or the like to work with. It was primarily designed for Windows where scripts can be run via double-click, but it (probably) works just as well in a variety of situations.

Here’s an example what a script might look like pre-Scripting:

import traceback


def do_something():
    ...
    return 200

if __name__ == '__main__':  # Run as script
    try:  # Exceptions will close the terminal window
        print(do_something())
    except Exception:
        traceback.print_exc()  # Debug
    finally:
        input()  # Keep the window open

If all you’re writing is a simple script and don’t want to deal with extensive error handling, chances are you’ll end up with something like the above. If you write such scripts often, however, the amount of boilerplate adds up and quickly becomes tedious to maintain.

Post-Scripting:

import scripting


@scripting.main
def do_something():
    ...
    return 200

Scripting takes care of exception handling, output formatting, and maintaining the terminal window for you so that you can focus on getting your script done in the shortest amount of time possible.

Installation

$ pip install python-scripting

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

python-scripting-0.1.0.zip (9.1 kB view details)

Uploaded Source

File details

Details for the file python-scripting-0.1.0.zip.

File metadata

File hashes

Hashes for python-scripting-0.1.0.zip
Algorithm Hash digest
SHA256 ff125e90f2ce0aace342aa9447be013db07eb195959b750b6466e377725b937a
MD5 b2247fada742b9cc11705e7bafab8eb8
BLAKE2b-256 a85afb4a07d851a33695c3158a00e4aa8d902e087df1cc5f94a900c994938cb5

See more details on using hashes here.

Supported by

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