{ "info": { "author": "Tim Simpson", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "qtox\n====\n\n``qtox`` creates Bash scripts that simply run the same commands Tox would run but in parallel for each environment.\n\nThis can lead to a massive speed-up in your daily local workflow.\n\nBenchmarks\n----------\n\nI cloned the `Falcon web API framework `__, ran ``tox`` once, and commented out the script ``tools/clean.sh`` (which error'd out when the unit tests for Python 27 and 36 were run in parallel).\n\nFollowing that, here's the output of ``time tox`` took:\n\n.. code-block::\n\n real 1m9.746s\n user 1m18.527s\n sys 0m4.732s\n\n\nI then created a bash script using ``qtox -e pep8 py27 py36 docs > retox.sh``. Here's the output of ``time ./retox.sh``:\n\n.. code-block::\n\n real 0m40.326s\n user 1m28.318s\n sys 0m3.717s\n\n\nSo ``qtox``'s script ran in 57% the time.\n\nInstalling\n----------\n\n``qtox`` is available on PyPi.\n\nIf you use `pipsi `__ you can install it with:\n\n.. code-block::\n\n pipsi install qtox\n\nIf you're some kind of crazy person who likes polluting your global Python instance you can just call ``pip install qtox`` and I'll try not to judge you.\n\n.. note:: The version of tail on OSX doesn't have the ``--pid`` option, so you'll need to install it with ``brew install coreutils``. Scripts generated on osx call ``gtail`` instead of ``tail`` for this reason.\n\n\nWhy you shouldn't call Tox from your dev box\n--------------------------------------------\n\nTox is great for making sure tests run a truly isolated environment on a CI platform, but if you're just trying to run flake8 or the unit tests for the hundredth time today it can be overkill.\n\nTox appears to do a lot of house work before running even the simplest commands. Anecdotally, I've always noticed a huge speed improvement when I simply ran a command in the virtualenv tox set up (say, ``.tox/py27/bin/pytest mypkg``) versus when I invoked Tox directly (``tox -e py27``).\n\nThe speed savings were significant enough that I ended up writing Bash scripts to run the Tox commands and used that instead of Tox, which always ended up being faster according to `time `__. On the downside, these scripts obviously duplicated information already found in the ``tox.ini`` file and often became out of date.\n\nThe rise of truly amazing static analysis tools in Python such as `MyPy `__ exacerbate the problems I see running invoking Tox compared to manually crafting scripts. Tools like MyPy offer the most value when they're run continuously as development happens. However, because MyPy checks are often put in separate tox environment, it's easy for people focused on a different problem (say, fixing a unit test) to run only those environments for minutes or hours before they remember to check MyPy, and be left needing to fix a bunch of type errors after they're convinced they've already made their program work at runtime.\n\nThe best solution is to just run everything as often as possible. ``qtox`` enables this.\n\nHow to use qtox\n---------------\n\nImagine a tox file that:\n\n- formats your code with `Black `__\n- checks it with `Flake8 `__\n- checks it with MyPy\n- runs unit tests in Python 3.5 and 3.6\n\nNote: tox needs to run one time before ``qtox`` can be used, in order for qtox to determine if command line tools are present in the virtualenv's or if they should be checked for in the Tox's ``whitelist_externals`` setting. ``qtox`` doesn't replace Tox, it just lets you augment it with the ability to re-run it's commands faster.\n\n``qtox`` can be used to create a bash script like so:\n\n.. code-block:: bash\n\n qtox -e black pep8 mypy py35 p36 > retox.sh\n chmod +x retox.sh\n\n\nWhen this script will instantly launch five jobs in parallel and wait on the results in the order you specified (meaning you want the quicker jobs- such as black or flake8- to run first).\n\nAs it works it's way through the list, it shows the output of each job in real time. So in this example, blacks output would be seen as it happens, and when black finishes all of flake8's output that happened in the interim will be shown before it's current output is displayed, etc.\n\nIt does this by having every job redirect to a file. When it's time to consume the results of that job, ``tail`` is invoked in another job, which reads from the start of the file and follows it until the process writing to it dies.\n\nIf a job fails, all other subsequent jobs are simply killed without printing out their output. This keeps things simpler so you don't have to scroll back up to see what went wrong.\n\nIt's up to you to make sure the simpler jobs are put earlier in the list you give to ``qtox``. If you instead put the longer running jobs first, you'll have to wait for them to finish before seeing feedback from quicker tools such as flake8.\n\nMulti Tox Super Projects\n------------------------\n\n``qtox`` also supports creating bash scripts for multiple tox projects.\n\nUse the ``-c`` flag to specify a tox directory, then use ``-e`` like normal.\n\nSay you have two directories containing two Python projects, both using tox. One is called ``acme-lib``, and is a reusable library containing core business logic, while the other is ``acme-rest-api``, which uses ``acme-lib``. If you're working on both at the same time, you may want to simply run all of the Tox tests together, starting with Flake 8 and MyPy tests first.\n\nGenerating a bash script for that would look something like this:\n\n.. code-block:: bash\n\n qtox -c acme-lib -e pep8 mypy -c acme-rest-api -e pep8 mypy -c acme-lib -e pytest -c acme-rest-api -e pytest > retox.sh\n chmod +x ./retox.sh\n\nThe tasks that will be waited on / shown the progress for will be in this order:\n\n * acme-lib's pep8 and mypy checks\n * acme-rest-api's pep8 and mypy checks\n * acme-lib's pytest tests\n * acme-rest-api's pytest tests\n\nTo beat a dead horse, I'll reiterate that all of these tasks will start simultaneously, meaning the relatively expensive REST API unit tests will start running at the same time as everything else. The simpler checks will simply be waited on first.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "qtox", "package_url": "https://pypi.org/project/qtox/", "platform": "", "project_url": "https://pypi.org/project/qtox/", "project_urls": null, "release_url": "https://pypi.org/project/qtox/0.0.8/", "requires_dist": null, "requires_python": "", "summary": "Lets you re-run Tox commands faster and in parallel.", "version": "0.0.8" }, "last_serial": 4277555, "releases": { "0.0.3": [ { "comment_text": "", "digests": { "md5": "075310b1cc270697bfb0533d609906d9", "sha256": "0d6f57d247151b866921b96806e9534892a1cd2d8f8c772ef31ee3dd571c29ee" }, "downloads": -1, "filename": "qtox-0.0.3.tar.gz", "has_sig": false, "md5_digest": "075310b1cc270697bfb0533d609906d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5062, "upload_time": "2018-09-16T08:25:36", "url": "https://files.pythonhosted.org/packages/18/9e/0ceded91b720e4510a9131b744646fa3fc9accd93ac3ec370e467b2e4a36/qtox-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "4591b3b09a80ce481560a3186fb0ce4a", "sha256": "59aacbfca5072dd98de0c7f8c32ebd7f4d9bf0f1b2dfab7473d6d1a11b8cf280" }, "downloads": -1, "filename": "qtox-0.0.4.tar.gz", "has_sig": false, "md5_digest": "4591b3b09a80ce481560a3186fb0ce4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5092, "upload_time": "2018-09-16T08:29:35", "url": "https://files.pythonhosted.org/packages/16/0b/af8232e0ada80f17afe44ed2f7c6d23882f868b62eb1d469c2546d78bc36/qtox-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "18b2148f8fee8c5d8cbabd3d0700c363", "sha256": "21b054207c672c14aa84b80fa754044ea3b21c214b1571e5bc132d71ea980669" }, "downloads": -1, "filename": "qtox-0.0.5.tar.gz", "has_sig": false, "md5_digest": "18b2148f8fee8c5d8cbabd3d0700c363", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5522, "upload_time": "2018-09-16T08:54:08", "url": "https://files.pythonhosted.org/packages/b1/69/8cd9646d02e24b1fa15cfc4f0f6cdc73e249752eec8a1b9351c0d6f0fddf/qtox-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "226baf3c213e3e77dcd976e631d0c7af", "sha256": "016a2182d18a7ba4683a14d71b00b43ea78054ba9cc45018b1abcae77fec0b33" }, "downloads": -1, "filename": "qtox-0.0.6.tar.gz", "has_sig": false, "md5_digest": "226baf3c213e3e77dcd976e631d0c7af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5702, "upload_time": "2018-09-16T08:59:40", "url": "https://files.pythonhosted.org/packages/1d/73/8e7200e5f6c4efb2f0fecfe052fa9d59a084ed98a12e856f8071e216314b/qtox-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "71052cbd6e9039c72fb2ac741789f5ef", "sha256": "58d2d3e3f1203f7fa04dcf24d33c0d8db5419014fdf8487b11f4007f6e65be3f" }, "downloads": -1, "filename": "qtox-0.0.7.tar.gz", "has_sig": false, "md5_digest": "71052cbd6e9039c72fb2ac741789f5ef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5861, "upload_time": "2018-09-16T09:18:34", "url": "https://files.pythonhosted.org/packages/6d/b5/1386db1c506734b145590ab67ede40aca90914430d9c6fef460323ad260a/qtox-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "a7aed5d9a6a48e86ced1af94572c6398", "sha256": "e55f513c1a49e3d3b6100b250181005898f367ebd6f66497f18b7de5a87e6460" }, "downloads": -1, "filename": "qtox-0.0.8.tar.gz", "has_sig": false, "md5_digest": "a7aed5d9a6a48e86ced1af94572c6398", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7141, "upload_time": "2018-09-16T22:04:23", "url": "https://files.pythonhosted.org/packages/d9/57/dcc1728db077fe6d0d823065396ed8991a53c0ab5243bcf430b34a4f29a5/qtox-0.0.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a7aed5d9a6a48e86ced1af94572c6398", "sha256": "e55f513c1a49e3d3b6100b250181005898f367ebd6f66497f18b7de5a87e6460" }, "downloads": -1, "filename": "qtox-0.0.8.tar.gz", "has_sig": false, "md5_digest": "a7aed5d9a6a48e86ced1af94572c6398", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7141, "upload_time": "2018-09-16T22:04:23", "url": "https://files.pythonhosted.org/packages/d9/57/dcc1728db077fe6d0d823065396ed8991a53c0ab5243bcf430b34a4f29a5/qtox-0.0.8.tar.gz" } ] }