{ "info": { "author": "Oliver Tonnhofer", "author_email": "", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python" ], "description": "scriptine - Python shell scripting made easy\n============================================\n\n:Author: Oliver Tonnhofer \n\nIntroduction\n~~~~~~~~~~~~\n\nThe primary goal of ``scriptine`` is to make it easy to write shell scripts\nwith python.\n\nScriptine does two things to solve this goal:\n\n* Make it easy to create scripts and commands.\n* Make it easy to work with files, directories and other shell commands.\n\nTo create commands with scriptine, you just create a normal python function for each command of your script and scriptine handles the rest. It creates command line option parser and calls the right function with the right options.\n\nThe second part of scriptine is a bunch of convenience classes and functions that make it easy to work with files, directories and other shell commands.\nIt abstracts the different python modules like `os`, `os.path`, `shutil` and `subprocess` and offers a simple and easy to use interface. `scriptine` comes with an enhanced version of Jason Orendorff's path module.\n\n\nFeatures\n--------\n\n* Easy command creation. Each command is just a function.\n\n * Automatic option parsing\n * Automatic help text (``--help``)\n* Log handling (with ``-v``, ``--verbose`` and ``-q``, ``--quiet`` handling)\n* Testing scripts in `dry-mode`. All destructive functions/methods are wrapped and will\n not be called when the ``-n`` or ``--dry-run`` option is set.\n* Easy execution of other shell scripts.\n* Convenient working with files and directories.\n\n\nExample\n-------\n\nHere is a small example script::\n\n import scriptine\n\n def example_command(name, countdown=False, repeat=10):\n \"\"\"Show how scriptine works.\"\"\"\n if countdown:\n for i in range(repeat, 0, -1):\n print i,\n print 'Hello, %s!' % name\n\n if __name__ == '__main__':\n scriptine.run()\n\nUsage of our small script::\n\n % python test.py\n Usage: test.py command [options]\n\n Options:\n -h, --help show this help message and exit\n\n Commands:\n example Show how scriptine works.\n % python test.py example Pete\n Hello, Pete!\n % python test.py example Pete --countdown --repeat 5\n 5 4 3 2 1 Hello, Pete!\n\n\nA more complex example::\n\n from scriptine import run, path, log\n from scriptine.shell import call\n\n def to_png_command(dirname, outdir='out', extension='jpeg'):\n \"\"\"\n Convert all files with extension in dirname to .png.\n Only convert if result does not exists or is older.\n\n :param dirname: where to search for images\n :param outdir: where to store the results\n :param extension: file extension to convert\n \"\"\"\n outdir = path(outdir)\n if not outdir.exists(): outdir.makedirs()\n log.mark('converting %s/*.%s to %s/*.png', dirname, extension, outdir)\n for f in path(dirname).files('*.'+extension):\n outfile = outdir / f.namebase + '.png'\n if not outfile.exists() or f.newer(outfile):\n call(['convert', f, outfile])\n\n if __name__ == '__main__':\n run()\n\nThe help text::\n\n % python convert.py to-png --help\n Usage: test.py to-png [options] dirname\n\n Convert all files with extension in dirname to .png. Only\n convert if result does not exists or is older.\n\n Required arguments:\n dirname: where to search for images\n\n Options:\n -h, --help show this help message and exit\n --outdir=out where to store the results\n --extension=jpeg file extension to convert\n -n, --dry-run don't actually do anything\n -v, --verbose be more verbose\n -q, --quiet be more silent\n\nAnd the result::\n\n % python convert.py to-png ~/images/ --extension gif\n ---> converting /Users/olt/images/*.gif to out/*.png\n % python convert.py to-png ~/images/ --extension gif -v\n ---> converting /Users/olt/images/*.gif to out/*.png\n INFO: call ['convert', '/Users/olt/images/foo.gif', 'out/foo.png']\n INFO: call ['convert', '/Users/olt/images/bar.gif', 'out/foo.png']\n\nDocumentation\n~~~~~~~~~~~~~\n\nThe documentation can be found at http://packages.python.org/scriptine/\n\nDevelopment\n~~~~~~~~~~~\n\nFollow the development at https://github.com/olt/scriptine Comments and bug fixes are welcomed.\n\n\nChangelog\n~~~~~~~~~\n\n0.2.0 (2013-04-10)\n * improve handling of binary data in write_bytes\n * fixed path.isdir on windows\n * add path.ensure_dir\n\n0.2.0a3 (2009-11-16)\n * new command.cmd function for scripts with only one command\n * added command.autocmds as a replacement for run\n\n0.2.0a2 (2009-11-11)\n * fixed missing files in MANIFEST.in\n\n0.2.0a1 (2009-11-09)\n * renamed path.getcwd to path.cwd\n * converted properties to methods for values that might\n change (e.g. size, mtimes, etc)\n * add path.newer method\n\n0.1.0 (2009-11-05)\n * first release", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bouke-nederstigt/scriptine", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "scriptinep3", "package_url": "https://pypi.org/project/scriptinep3/", "platform": "", "project_url": "https://pypi.org/project/scriptinep3/", "project_urls": { "Homepage": "https://github.com/bouke-nederstigt/scriptine" }, "release_url": "https://pypi.org/project/scriptinep3/0.3.1/", "requires_dist": null, "requires_python": "", "summary": "python shell scripts made easy - scriptine Ported to python 3", "version": "0.3.1" }, "last_serial": 3212251, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "b1061443cc9f88ac359edac53da125df", "sha256": "25defedbb4cdae657592b98eec1f32512d90d246403e4393ffc8e601b636282e" }, "downloads": -1, "filename": "scriptinep3-0.3.0.tar.gz", "has_sig": false, "md5_digest": "b1061443cc9f88ac359edac53da125df", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30889, "upload_time": "2017-09-29T06:51:10", "url": "https://files.pythonhosted.org/packages/f7/40/85b53a674104df7da964ba39222e17626700d275d9fd318670e5f0392786/scriptinep3-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "f906a5ab61e13471a81af10d755cc22e", "sha256": "0bc3898cb18cdcc7dc70543b42d3329ebbca7e19593cea7d70f9a3646befa498" }, "downloads": -1, "filename": "scriptinep3-0.3.1.tar.gz", "has_sig": false, "md5_digest": "f906a5ab61e13471a81af10d755cc22e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30767, "upload_time": "2017-09-29T07:00:01", "url": "https://files.pythonhosted.org/packages/6b/9f/b057032ba5a56dae66510bb02aa89b7cded5030e0f43f08c6806b48e84d8/scriptinep3-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f906a5ab61e13471a81af10d755cc22e", "sha256": "0bc3898cb18cdcc7dc70543b42d3329ebbca7e19593cea7d70f9a3646befa498" }, "downloads": -1, "filename": "scriptinep3-0.3.1.tar.gz", "has_sig": false, "md5_digest": "f906a5ab61e13471a81af10d755cc22e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30767, "upload_time": "2017-09-29T07:00:01", "url": "https://files.pythonhosted.org/packages/6b/9f/b057032ba5a56dae66510bb02aa89b7cded5030e0f43f08c6806b48e84d8/scriptinep3-0.3.1.tar.gz" } ] }