scription


Namescription JSON
Version 0.86.26 PyPI version JSON
download
home_pagehttps://github.com/ethanfurman/scription.git
Summarysimple script parameter parser
upload_time2024-02-22 02:59:15
maintainer
docs_urlNone
authorEthan Furman
requires_python
licenseBSD License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            scription

light-weight library to enhance command-line scripts; includes conversion of
parameters to specified data types, parameter checking, basic input/output with
users, support for suid [1], sending email, executing sub-programs, and having
sub-commands within a script


decorators

  - Script:  sets global variables and/or parameters for Commands; the decorated
    function will be called by Main/Run before any specified Command

  - Command:  marks function as a subcommand for the script (e.g. add, delete,
    list, etc.); if no subcommand is specified on the command-line, scription
    will look for a Command with the same name as the script

  - Alias:  registers other names for Commands (e.g. delete / remove / kill)


functions

  - Main:  if the importing module's __name__ is __main__, call Run() (this
    allows for importing the script as a module)

  - Run:  unconditionally attempts to run the Script function (if any) and the
    Command found on the command-line

  Main() or Run() should be the last thing in the script


classes

  - Spec:  can be used when defining the command-line parameters (can also just
    use tuples)


helper functions/classes

  - abort: quits immediately by raising SystemExit

  - Execute:  class for executing other programs; uses subprocess.Popen by
    default, but if `pty=True` is specified then `pty.fork` will be used
    (handy for programs that only accept input from a pty)

  - get_response:  function for displaying text and getting feedback

  - help: quits immediately, but adds a reference to --help in the quit message

  - log_exception:  logs an exception with logging.logger

  - mail: rudimentary mail sender

  - OrmFile:  lightweight orm -- supports str, int, float, date, time,
    datetime, bool, and path (which defaults to str); custom data types can
    also be specified

  - print: wrapper around print that adds a 'verbose_level' keyword (default: 1);
    default verbosity is 0 (so print does nothing), but can be increased using
    -v, -vv, --verbose, or --verbose=2 (in Python 2 the script must use
    'from __future__ import print_function' to use scription's print)

  - user_ids:  context manager useful for suid scripts -- all actions taken
    within the context are run as the user/group specified


features

  - extra parameters defined by Script are global, and can be accessed from any
    function or Command

  - 'module' is a namespace inserted into the script

  - 'script_command' is the Command selected from the command line (useful when
    one needs to call the subcommand directly from a main() function)

  - 'script_command_name' is the name of the script_command

  - 'script_verbosity' is the level of verboseness selected (defaults to 0)

  - 'script_name' is the name of the script

  - builtin options are:  --help, --verbose (-v or -vv), --version, --all-versions
    --version attempts to display the version of the main package in use
    --all-versions attempts to display the versions of any imported packages

  - command-line is decoded to unicode under Python 2 (Python 3 does this for us)


[1] I use the suid-python program, available at http://selliott.org/python/suid-python.c



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ethanfurman/scription.git",
    "name": "scription",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Ethan Furman",
    "author_email": "ethan@stoneleaf.us",
    "download_url": "https://files.pythonhosted.org/packages/25/00/6111136526ed54a66c1e9d756693ecc9ab9320baf467ddd885c3345e3f0d/scription-0.86.26.tar.gz",
    "platform": null,
    "description": "scription\n\nlight-weight library to enhance command-line scripts; includes conversion of\nparameters to specified data types, parameter checking, basic input/output with\nusers, support for suid [1], sending email, executing sub-programs, and having\nsub-commands within a script\n\n\ndecorators\n\n  - Script:  sets global variables and/or parameters for Commands; the decorated\n    function will be called by Main/Run before any specified Command\n\n  - Command:  marks function as a subcommand for the script (e.g. add, delete,\n    list, etc.); if no subcommand is specified on the command-line, scription\n    will look for a Command with the same name as the script\n\n  - Alias:  registers other names for Commands (e.g. delete / remove / kill)\n\n\nfunctions\n\n  - Main:  if the importing module's __name__ is __main__, call Run() (this\n    allows for importing the script as a module)\n\n  - Run:  unconditionally attempts to run the Script function (if any) and the\n    Command found on the command-line\n\n  Main() or Run() should be the last thing in the script\n\n\nclasses\n\n  - Spec:  can be used when defining the command-line parameters (can also just\n    use tuples)\n\n\nhelper functions/classes\n\n  - abort: quits immediately by raising SystemExit\n\n  - Execute:  class for executing other programs; uses subprocess.Popen by\n    default, but if `pty=True` is specified then `pty.fork` will be used\n    (handy for programs that only accept input from a pty)\n\n  - get_response:  function for displaying text and getting feedback\n\n  - help: quits immediately, but adds a reference to --help in the quit message\n\n  - log_exception:  logs an exception with logging.logger\n\n  - mail: rudimentary mail sender\n\n  - OrmFile:  lightweight orm -- supports str, int, float, date, time,\n    datetime, bool, and path (which defaults to str); custom data types can\n    also be specified\n\n  - print: wrapper around print that adds a 'verbose_level' keyword (default: 1);\n    default verbosity is 0 (so print does nothing), but can be increased using\n    -v, -vv, --verbose, or --verbose=2 (in Python 2 the script must use\n    'from __future__ import print_function' to use scription's print)\n\n  - user_ids:  context manager useful for suid scripts -- all actions taken\n    within the context are run as the user/group specified\n\n\nfeatures\n\n  - extra parameters defined by Script are global, and can be accessed from any\n    function or Command\n\n  - 'module' is a namespace inserted into the script\n\n  - 'script_command' is the Command selected from the command line (useful when\n    one needs to call the subcommand directly from a main() function)\n\n  - 'script_command_name' is the name of the script_command\n\n  - 'script_verbosity' is the level of verboseness selected (defaults to 0)\n\n  - 'script_name' is the name of the script\n\n  - builtin options are:  --help, --verbose (-v or -vv), --version, --all-versions\n    --version attempts to display the version of the main package in use\n    --all-versions attempts to display the versions of any imported packages\n\n  - command-line is decoded to unicode under Python 2 (Python 3 does this for us)\n\n\n[1] I use the suid-python program, available at http://selliott.org/python/suid-python.c\n\n\n",
    "bugtrack_url": null,
    "license": "BSD License",
    "summary": "simple script parameter parser",
    "version": "0.86.26",
    "project_urls": {
        "Homepage": "https://github.com/ethanfurman/scription.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7cb826b80b6f0e1434c46cf9ea45c99526f4f1b0acaf74618b0d69a64be09ac4",
                "md5": "e96de440d645f1cd800cd3f5b9a32857",
                "sha256": "518c7f98c2f2fd3c91d32958f4810af36aa3a4bc84414c93aa9d844dcde1e305"
            },
            "downloads": -1,
            "filename": "scription-0.86.26-py2-none-any.whl",
            "has_sig": false,
            "md5_digest": "e96de440d645f1cd800cd3f5b9a32857",
            "packagetype": "bdist_wheel",
            "python_version": "py2",
            "requires_python": null,
            "size": 65428,
            "upload_time": "2024-02-22T02:59:11",
            "upload_time_iso_8601": "2024-02-22T02:59:11.296179Z",
            "url": "https://files.pythonhosted.org/packages/7c/b8/26b80b6f0e1434c46cf9ea45c99526f4f1b0acaf74618b0d69a64be09ac4/scription-0.86.26-py2-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af14c5a55ec4f5a62ecb39a5e1ee10b2977c38236c67c2b1f32371395b5aa20d",
                "md5": "2bed4c10ecf64a6ffa134e758632fc79",
                "sha256": "b60aa3cdfca45a9eb64227261e06eda1e6958110e9b519d846914ee62debcd74"
            },
            "downloads": -1,
            "filename": "scription-0.86.26-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2bed4c10ecf64a6ffa134e758632fc79",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 65428,
            "upload_time": "2024-02-22T02:59:18",
            "upload_time_iso_8601": "2024-02-22T02:59:18.523157Z",
            "url": "https://files.pythonhosted.org/packages/af/14/c5a55ec4f5a62ecb39a5e1ee10b2977c38236c67c2b1f32371395b5aa20d/scription-0.86.26-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25006111136526ed54a66c1e9d756693ecc9ab9320baf467ddd885c3345e3f0d",
                "md5": "b41ec6c46cf5c1793814bf3d9dffc7d6",
                "sha256": "232653aaf742a45703fad0b2666198010917fc5a949299ccdb1d81d72b872669"
            },
            "downloads": -1,
            "filename": "scription-0.86.26.tar.gz",
            "has_sig": false,
            "md5_digest": "b41ec6c46cf5c1793814bf3d9dffc7d6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 65911,
            "upload_time": "2024-02-22T02:59:15",
            "upload_time_iso_8601": "2024-02-22T02:59:15.075599Z",
            "url": "https://files.pythonhosted.org/packages/25/00/6111136526ed54a66c1e9d756693ecc9ab9320baf467ddd885c3345e3f0d/scription-0.86.26.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-22 02:59:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ethanfurman",
    "github_project": "scription",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "scription"
}
        
Elapsed time: 0.17816s