{ "info": { "author": "Ryosuke Ito", "author_email": "rito.0305@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: System :: Shells", "Topic :: Utilities" ], "description": "backquotes\n==========\n\n.. image:: https://img.shields.io/travis/manicmaniac/backquotes/master.svg\n :target: https://travis-ci.org/manicmaniac/backquotes\n\n.. image:: https://img.shields.io/codeclimate/github/manicmaniac/backquotes.svg\n :target: https://codeclimate.com/github/manicmaniac/backquotes\n\n.. image:: https://img.shields.io/coveralls/manicmaniac/backquotes/master.svg\n :target: https://coveralls.io/github/manicmaniac/backquotes\n\n.. image:: https://img.shields.io/pypi/v/backquotes.svg\n :target: https://pypi.python.org/pypi/backquotes/\n\n.. image:: https://img.shields.io/pypi/pyversions/backquotes.svg\n :target: https://pypi.python.org/pypi/backquotes/\n\nIntroduction\n------------\n\n``backquotes`` brings (Perl / Ruby)'s shell invocation syntax to Python.\n\n``backquotes`` is experimental module by now,\nusing it in a serious program is not recommended.\n\nSyntax\n------\n\nFirstly, remember to import ``backquotes`` module.\n\n.. code:: python\n\n import backquotes\n\nBasic\n-----\n\nYou can use similar syntax to Perl / Ruby.\n\n.. code:: python\n\n import backquotes\n print(`date`)\n\nPipes and redirections\n----------------------\n\nYes, you can use pipes, redirections too.\n\n.. code:: python\n\n import backquotes\n print(`ls | tr [a-z] [A-Z]`.splitlines())\n\nLocal variables substitution\n----------------------------\n\nTo bring local variables in Python code to shell command,\nuse Perl-like variables substitution.\n\n.. code:: python\n\n import backquotes\n spam = 'spam'\n print(`echo $spam`)\n\n``$$`` is substituted to a literal ``$``.\n\n.. code:: python\n\n import backquotes\n print(`echo $$PATH`)\n\nUsage\n-----\n\nRuntime-preprocessing\n^^^^^^^^^^^^^^^^^^^^^\n\nYou can use runtime-preprocessing only in Python 2.\nThis works transparently when you import ``backquotes``.\n\n.. warning::\n\n Python 3 raises `SyntaxError` on a backquote character before evaluate the first line.\n So you CANNOT use runtime-preprocessing.\n\n.. code:: python\n\n #!/usr/bin/env python\n import backquotes\n print(`date`)\n\nSave as ``date.py``, and run it as usual.\n\n.. code:: sh\n\n python date.py\n\nYou will see the result of ``date`` command.\n\nRuntime-preprocessing sometimes causes ``SyntaxError`` before preprocessing starts,\nespecially with complex commands invocation.\nYou can avoid this error by using single-quotes just inside the backquotes.\n\n.. code:: python\n\n print(`'for file in *; do echo $file; done'`)\n\nExecute `backquotes` module\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nRun ``python`` with ``-m backquotes`` option to invoke ``backquotes`` as a script.\n``backquotes`` compiles a plain Python code and execute it.\n\n.. note::\n\n This works both in Python 2 / 3.\n\n.. code:: sh\n\n python -m backquotes date.py\n\nYou can pass arguments to the script.\n\n.. code:: sh\n\n python -m backquotes date.py 2015 10 31\n\nPreprocess Python code\n^^^^^^^^^^^^^^^^^^^^^^\n\nRun ``python`` with ``-m backquotes -E`` option to only preprocess the given source file\nand print to stdout.\n\n.. warning::\n\n Preprocessed python code is almost the same as the original code semantically,\n but whitespaces are moved by the preprocessor.\n\n.. note::\n\n This works both in Python 2 / 3.\n\n.. code:: sh\n\n mkdir dist\n python -m backquotes -E date.py > dist/date.py\n python dist/date.py\n\n\nRestrictions\n------------\n\n- ``backquotes`` does not work in Python REPL. Import it in REPL causes warnings.\n- a module which imports ``backquotes`` does not work when it is imported.\n\nInstall\n-------\n\n.. code:: sh\n\n pip install backquotes\n\nor\n\n.. code:: sh\n\n git clone https://github.com/manicmaniac/backquotes.git\n cd backquotes\n python setup.py install\n\nor\n\n.. code:: sh\n\n wget https://raw.githubusercontent.com/manicmaniac/backquotes/master/backquotes.py", "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/manicmaniac/backquotes", "keywords": "backquote shell syntax perl ruby sh bash", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "backquotes", "package_url": "https://pypi.org/project/backquotes/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/backquotes/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/manicmaniac/backquotes" }, "release_url": "https://pypi.org/project/backquotes/0.0.3/", "requires_dist": null, "requires_python": null, "summary": "shell command invocation with backquotes, like Perl, Ruby.", "version": "0.0.3" }, "last_serial": 1798579, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "a57d6d72d402be26b3ee0e449bf6e929", "sha256": "ab2ebb3a36838ebcb6b78d51b60add1e8d52cf16cd3ce0c5114e4a81b53427f0" }, "downloads": -1, "filename": "backquotes-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a57d6d72d402be26b3ee0e449bf6e929", "packagetype": "bdist_wheel", "python_version": "2.6", "requires_python": null, "size": 6701, "upload_time": "2015-10-31T18:26:02", "url": "https://files.pythonhosted.org/packages/3e/2a/be44eb32a3e46437c28cd129f39afd3fd8a1e332a802064913e85a03bc99/backquotes-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb4c7233aea08e8dc19faae951a026c0", "sha256": "0af01f63634b0af95acf5eea943df4c76b1cb741f4a5309058e6926871f189b0" }, "downloads": -1, "filename": "backquotes-0.0.1.tar.gz", "has_sig": false, "md5_digest": "eb4c7233aea08e8dc19faae951a026c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6658, "upload_time": "2015-10-31T18:25:55", "url": "https://files.pythonhosted.org/packages/65/23/7792a0654c2bffc296b197dff974cceaa1ab82822d51f87bd44782e84bb9/backquotes-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "0978076f09790b89a21c512c4e4a0ea1", "sha256": "24489ea2ea8a1f4247318cf511297fbb83e996d1da254d3d8b57c5b87d6990dd" }, "downloads": -1, "filename": "backquotes-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0978076f09790b89a21c512c4e4a0ea1", "packagetype": "bdist_wheel", "python_version": "2.6", "requires_python": null, "size": 6609, "upload_time": "2015-11-01T12:37:37", "url": "https://files.pythonhosted.org/packages/fd/bd/4d30b725de88c03695ce8e7bfe585af834a181c097d53c0190bc4ffc5ec4/backquotes-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ca132bcd5475beeea8006298cf10a917", "sha256": "e670ea665a443f019aad3a336dd66dea35e86e51750a890808a3b00a1d82cff8" }, "downloads": -1, "filename": "backquotes-0.0.2.tar.gz", "has_sig": false, "md5_digest": "ca132bcd5475beeea8006298cf10a917", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6520, "upload_time": "2015-11-01T12:37:31", "url": "https://files.pythonhosted.org/packages/13/fd/990faa33c1a31a4acb75fe6266e3b396c4240734ef06f1c88bbb535e5000/backquotes-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "e180b1681afe83a64c3849b48731c6c3", "sha256": "e7d8eccbed926ee9dcad1040e7fafd3c18a139570ba91ca4504f6a60f0875ddd" }, "downloads": -1, "filename": "backquotes-0.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "e180b1681afe83a64c3849b48731c6c3", "packagetype": "bdist_wheel", "python_version": "2.6", "requires_python": null, "size": 6715, "upload_time": "2015-11-03T03:02:40", "url": "https://files.pythonhosted.org/packages/0e/7b/5adad1f4d3bc868278471ed23661fe6af749761244d623158c13a07c3391/backquotes-0.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fd7f4e64fec9f1bef27276f746bce64e", "sha256": "25f19bfd62d6f2d6d07e18217f29f1931c00283ae40582ed149cf69c536e0c52" }, "downloads": -1, "filename": "backquotes-0.0.3.tar.gz", "has_sig": false, "md5_digest": "fd7f4e64fec9f1bef27276f746bce64e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6800, "upload_time": "2015-11-03T03:02:06", "url": "https://files.pythonhosted.org/packages/88/f8/6965c541c38ee6110ab9cd186fff73bff6cea7b879d77f313da8bb40c39b/backquotes-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e180b1681afe83a64c3849b48731c6c3", "sha256": "e7d8eccbed926ee9dcad1040e7fafd3c18a139570ba91ca4504f6a60f0875ddd" }, "downloads": -1, "filename": "backquotes-0.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "e180b1681afe83a64c3849b48731c6c3", "packagetype": "bdist_wheel", "python_version": "2.6", "requires_python": null, "size": 6715, "upload_time": "2015-11-03T03:02:40", "url": "https://files.pythonhosted.org/packages/0e/7b/5adad1f4d3bc868278471ed23661fe6af749761244d623158c13a07c3391/backquotes-0.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fd7f4e64fec9f1bef27276f746bce64e", "sha256": "25f19bfd62d6f2d6d07e18217f29f1931c00283ae40582ed149cf69c536e0c52" }, "downloads": -1, "filename": "backquotes-0.0.3.tar.gz", "has_sig": false, "md5_digest": "fd7f4e64fec9f1bef27276f746bce64e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6800, "upload_time": "2015-11-03T03:02:06", "url": "https://files.pythonhosted.org/packages/88/f8/6965c541c38ee6110ab9cd186fff73bff6cea7b879d77f313da8bb40c39b/backquotes-0.0.3.tar.gz" } ] }