{ "info": { "author": "Alex Holmes", "author_email": "alex@alex-holmes.com", "bugtrack_url": null, "classifiers": [], "description": "Vorlauf\n=======\n\nWhat?\n-----\n\nVorlauf is a very minimal tool that helps you to create process pipelines (in\nthe shell sense). It also helps separate out the definition of a Process from\nthe running of a that process with a given stdin, stdout, and stderr.\n\nWhy?\n----\n\nBecause the subprocess api for chaining processes together is cumbersome and\nnot very well documented.\n\nHow?\n----\n\nThis library does basically nothing - it's implemented in fewer than 100 lines.\nThere are two classes available, ``Process`` and ``Pipeline``.\n\nProcess\n~~~~~~~\n\nThe ``Process`` class is passed args, cwd, and env, and is executed by calling\n``Process.run`` with optional ``stdin``, ``stdout``, and ``stderr`` parameters.\n\nBy removing the ``stdout``, ``stderr``, and ``stdin`` from the creation of the\n``Process`` class, we can create reusable ``Process`` definitions::\n\n critical_grepper = Process('grep', 'CRITICAL')\n\n syslog = open('/var/log/syslog', 'r')\n apachelog = open('/var/log/httpd/error.log', 'r')\n\n filtered = open('critical.log', 'w')\n\n for logfile in (syslog, apachelog):\n critical_grepper.run(stdin=logfile, stdout=filtered)\n\nPipeline\n~~~~~~~~\n\nThe ``Pipeline`` class stores a list of ``Process`` classes which, when run\nwith ``Pipeline.run`` with optional ``stdin`` and ``stdout``, pipes the\nprocesses together. If present, ``stdin`` is passed to the first process, and\nif present, ``stdout`` is passed to the last process.\n\nExample\n-------\n::\n\n from vorlauf import Pipeline, Process\n\n pipeline = Pipeline()\n pipeline.add(Process('cat', 'foo.txt'))\n pipeline.add(Process('grep', 'something'))\n pipeline.add(Process('uniq'))\n\n with open('new.txt', 'wb') as fd:\n pipeline.run(stdout=fd)\n\nAnd because of operator overloading built into the ``Process`` and ``Pipeline``\nclasses, this can be simplified as::\n\n from vorlauf import Process as P\n\n pipeline = P('cat', 'foo.txt') | P('grep', 'something') | P('uniq')\n with open('new.txt', 'wb') as fd:\n pipeline.run(stdout=fd)\n\nFinally, you could use the ``Process`` class to create reusable components::\n\n from vorlauf import Process\n\n class GPG(Process):\n\n def __init__(self, passphrase):\n super(GPG, self).__init__('gpg', '-c', '--passphrase', passphrase, '-')\n\n\n class MySQLDump(Process):\n\n def __init__(self, password, dbname, **kwargs):\n super(MySQLDump, self).__init__(\n 'mysqldump', '-u', 'root', '-p{}'.format(password), dbname\n )\n\n\n with open('mysql.dump', 'wb') as fd:\n pipeline = MySQLDump('loldongs', 'foo') | GPG('supersekrit')\n pipeline.run(stdout=fd)\n\n\nTests\n-----\n\nRun::\n\n virtualenv venv\n venv/bin/pip install -e .\n venv/bin/python test.py\n\n\nChangelog\n=========\n\n1.0.0 (2015-09-22)\n------------------\n\n- Initial release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "vorlauf subprocess pipe", "license": "Apache Software License", "maintainer": null, "maintainer_email": null, "name": "vorlauf", "package_url": "https://pypi.org/project/vorlauf/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/vorlauf/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/vorlauf/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "Lightweight tool for piping subprocess processes to each other", "version": "1.0.0" }, "last_serial": 1733049, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "191ea007b5106822f34643e127c227a9", "sha256": "dc9c12cad3c2aabfbc7587eda0f2beb4e3eb83e51f29f320562b2c38a82a8431" }, "downloads": -1, "filename": "vorlauf-1.0.0.tar.gz", "has_sig": false, "md5_digest": "191ea007b5106822f34643e127c227a9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3248, "upload_time": "2015-09-22T11:58:55", "url": "https://files.pythonhosted.org/packages/76/20/ff9e86c1db49ddf4f945e62e229b009a882935d9e1333346fea507e43ea5/vorlauf-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "191ea007b5106822f34643e127c227a9", "sha256": "dc9c12cad3c2aabfbc7587eda0f2beb4e3eb83e51f29f320562b2c38a82a8431" }, "downloads": -1, "filename": "vorlauf-1.0.0.tar.gz", "has_sig": false, "md5_digest": "191ea007b5106822f34643e127c227a9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3248, "upload_time": "2015-09-22T11:58:55", "url": "https://files.pythonhosted.org/packages/76/20/ff9e86c1db49ddf4f945e62e229b009a882935d9e1333346fea507e43ea5/vorlauf-1.0.0.tar.gz" } ] }