{ "info": { "author": "Bill Mill", "author_email": "bill.mill@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha" ], "description": "pub - the Python Utility Belt\r\n=============================\r\n\r\n``pub`` is a tool to help you automate those tasks you don't want to do\r\nmanually. It attempts to provide the cleanest, sanest interface for your\r\nbuilding, cleaning, and deploying needs.\r\n\r\nPub code is simply python code, allowing you to leverage the skills and\r\ntools you're already familiar with.\r\n\r\nSimply install ``pub``, save a ``pub.py`` file in a dir, and start\r\ncoding.\r\n\r\nHere's an example pub.py with two tasks, one to build a project and one\r\nto deploy it to a server:\r\n\r\n::\r\n\r\n from pub import task\r\n from pub.shortcuts import mkdir, cp, rsync\r\n\r\n @task\r\n def build():\r\n mkdir(\"build\")\r\n cp(\"src/binary\", \"build\")\r\n\r\n @task(\"build\")\r\n def deploy():\r\n rsync(\"build\", \"user@server:~\")\r\n\r\nThe pub.shortcuts module gives us handy shortcuts to access command-line\r\nfunctionality.\r\n\r\nThe ``deploy`` task depends on the ``build`` task, so calling\r\n``pub deploy`` will first run the build task, then deploy.\r\n\r\nInstallation\r\n------------\r\n\r\n``pip install pub``\r\n\r\nTasks\r\n-----\r\n\r\nThe ``task`` decorator in the pub module will be your code's main\r\ninterface to pub.\r\n\r\nYou may create a task with no arguments:\r\n\r\n::\r\n\r\n from pub import task\r\n\r\n @task\r\n def zomg():\r\n print \"omgbbq\"\r\n\r\nIf you run ``pub zomg`` on a pub.py file containing this function, you\r\nwill see \"omgbbq\" printed out.\r\n\r\nYou may also create a task with arguments. Each argument should be the\r\nname of another function. The functions in the argument list will all be\r\nexecuted before your task.\r\n\r\nFor example:\r\n\r\n::\r\n\r\n from pub import task\r\n\r\n @task\r\n def foo():\r\n print \"foo\"\r\n\r\n @task(\"foo\")\r\n def bar():\r\n print \"bar\"\r\n\r\n @task(\"foo\", \"bar\")\r\n def baz():\r\n print \"baz\"\r\n\r\nIf you run ``pub foo``, you will see \"foo\".\r\n\r\nIf you run ``pub bar``, you will see \"foo\" followed by \"bar\".\r\n\r\nIf you run ``pub baz``, you will see \"foo\" followed by \"bar\" followed by\r\n\"baz\".\r\n\r\nDependencies will be resolved left-to-right, meaning that there's an\r\nimplied dependency of each item in a dependency list on its left-hand\r\nneighbor. Be careful that you don't create a circular dependency like\r\nso:\r\n\r\n::\r\n\r\n from pub import task\r\n\r\n @task\r\n def foo():\r\n print \"foo\"\r\n\r\n @task(\"foo\")\r\n def bar():\r\n print \"bar\"\r\n\r\n @task(\"bar\", \"foo\")\r\n def baz():\r\n print \"baz\"\r\n\r\nIn this case, ``bar`` depends on ``foo`` by the definition of ``bar``,\r\nbut ``foo`` depends on ``bar`` by the definition of ``baz``. Pub will be\r\nconfused about this situation, and resolve it by quitting out with an\r\nerror.\r\n\r\nThere are two legal keywords you can use with the task decorator:\r\n``private`` and ``default``. ``private`` just means that ``pub -l``\r\nwon't list your task; if you have a ``pub.py`` file like:\r\n\r\n::\r\n\r\n from pub import task\r\n\r\n @task(private=True)\r\n def private_func(): pass\r\n\r\nand you run ``pub -l``, which normally lists all tasks, ``private_func``\r\nwill not be listed.\r\n\r\n``default`` marks the task as a default action. If you have a ``pub.py``\r\nlike:\r\n\r\n::\r\n\r\n from pub import task\r\n\r\n @task(default=True)\r\n def do_something(): print \"got here\"\r\n\r\nand run ``pub`` with no arguments, you should see \"got here\" printed.\r\n\r\nYou may mark any number of tasks as ``default``; they will all be run if\r\n``pub`` is invoked without arguments. While their dependency information\r\nwill never be ignored, there is no defined order in which they will be\r\nrun.\r\n\r\nTasks are documented simply by giving them docstrings. Given this\r\n``pub.py``:\r\n\r\n::\r\n\r\n from pub import task\r\n\r\n @task\r\n def gotit():\r\n \"\"\"You've got it!\"\"\"\r\n pass\r\n\r\n @task\r\n def noyou():\r\n \"\"\"I thought you had it.\"\"\"\r\n pass\r\n\r\nWe can see how they are displayed by pub:\r\n\r\n::\r\n\r\n $ pub -l\r\n gotit: You've got it!\r\n noyou: I thought you had it.\r\n\r\nShortcuts\r\n---------\r\n\r\nThe ``pub.shortcuts`` module builds on @kennethreitz's fine\r\n`envoy `_ module to provide a\r\nconvenient command-line interface for pub.\r\n\r\nYou can see all the commands that are available `in the\r\nsource `_,\r\nor you can make your own:\r\n\r\n::\r\n\r\n from pub.shortcuts import make_shortcut\r\n\r\n gcc = make_shortcut(\"gcc\")\r\n\r\n #then use it like so:\r\n gcc(\"-o guildenstern.exe rosencrantz.c\")\r\n\r\nThe invocation of the ``gcc`` funciton at the end will translate into\r\n``gcc -o guildenstern.exe rosencrantz.c`` and be run.\r\n\r\nWe can also use our shortcuts to inspect the input, output, and status\r\ncode of the command; the return value of a shortcut will be an\r\n`envoy `_ result. Check their\r\ndocumentation for specifics, but basically you can see its output with:\r\n\r\n::\r\n\r\n from pub.shortcuts import make_shortcut\r\n\r\n echo = make_shortcut(\"echo\")\r\n\r\n out = echo(\"A conspiracy of cartographers\")\r\n\r\n assert out.std_out == \"A conspiracy of cartographers\\n\"\r\n\r\nThe ``pub.shortcuts`` module also contains one utility function,\r\n``newer``. It simply accepts two arguments and returns True if the mtime\r\nof the first is newer than the mtime of the second. Its entire defintion\r\nfollows:\r\n\r\n::\r\n\r\n def newer(f1, f2):\r\n return stat(f1).st_mtime > stat(f2).st_mtime\r\n\r\nThe ``pub`` command\r\n-------------------\r\n\r\nThe pub command is best described by its ``--help`` output:\r\n\r\n::\r\n\r\n usage: pub [-h] [-l] [-f FILE] [task [task ...]]\r\n\r\n Python Utility Belt v0.0.4\r\n\r\n positional arguments:\r\n task the tasks to run\r\n\r\n optional arguments:\r\n -h, --help show this help message and exit\r\n -l list available tasks\r\n -f FILE, --pubfile FILE \r\n The file to use as a pubfile\r\n\r\nContributing\r\n------------\r\n\r\nPlease do! Patches and issues will be gladly accepted.\r\n\r\nTo run ``pub``'s tests, just run ``pub test``; you'll need to have\r\ninstalled `nose `_ first.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/llimllib/pub", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pub", "package_url": "https://pypi.org/project/pub/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pub/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/llimllib/pub" }, "release_url": "https://pypi.org/project/pub/0.0.4/", "requires_dist": null, "requires_python": null, "summary": "Python Utility Belt", "version": "0.0.4" }, "last_serial": 796787, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "063bfee2da5056bd3690921516bad266", "sha256": "67f704abab0ac2f8da70e1213d52a413e9f1dc4e807d8490625855ea97ed1fd5" }, "downloads": -1, "filename": "pub-0.0.1.tar.gz", "has_sig": false, "md5_digest": "063bfee2da5056bd3690921516bad266", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6166, "upload_time": "2012-04-03T01:50:55", "url": "https://files.pythonhosted.org/packages/01/9d/1ff9cab41843f6341553d6e5839ffcd0aa34c8993cf042956f9182601059/pub-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "467cfa26b41956781b72b267f9180c30", "sha256": "865f8622e6d3f8dd6080d2084a2881eb6369b76e550f6ad1b725850fef86112e" }, "downloads": -1, "filename": "pub-0.0.2.tar.gz", "has_sig": false, "md5_digest": "467cfa26b41956781b72b267f9180c30", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6177, "upload_time": "2012-04-03T01:54:33", "url": "https://files.pythonhosted.org/packages/74/7b/3ef187bd99c472bf7eeeda80d01964014b3cfe985353e6f3d57c96b78ce6/pub-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "65c26381efe8059895db9d5c6a8fa06c", "sha256": "5e9797a33ee860efbf771fa30b82bcc1aab8bead93346765d18ddd84d857a9d2" }, "downloads": -1, "filename": "pub-0.0.3.tar.gz", "has_sig": false, "md5_digest": "65c26381efe8059895db9d5c6a8fa06c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6220, "upload_time": "2012-04-03T15:44:03", "url": "https://files.pythonhosted.org/packages/83/cc/f0f3b399e5ff8812c6f5c51fd9246cea0f6404f6ad7fbcab5873cd28f44d/pub-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "172114feae371460c4cfa750fd4a591f", "sha256": "298c857b183681bd6c5d3d0735c75b79af3ccc02ea3086d6defe33095a6f8a43" }, "downloads": -1, "filename": "pub-0.0.4.tar.gz", "has_sig": false, "md5_digest": "172114feae371460c4cfa750fd4a591f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6234, "upload_time": "2012-04-03T16:54:53", "url": "https://files.pythonhosted.org/packages/fa/0c/ac75b8b7e69375331e00d4645484046e8b1f491c605782839d7e041d3ad9/pub-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "172114feae371460c4cfa750fd4a591f", "sha256": "298c857b183681bd6c5d3d0735c75b79af3ccc02ea3086d6defe33095a6f8a43" }, "downloads": -1, "filename": "pub-0.0.4.tar.gz", "has_sig": false, "md5_digest": "172114feae371460c4cfa750fd4a591f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6234, "upload_time": "2012-04-03T16:54:53", "url": "https://files.pythonhosted.org/packages/fa/0c/ac75b8b7e69375331e00d4645484046e8b1f491c605782839d7e041d3ad9/pub-0.0.4.tar.gz" } ] }