{ "info": { "author": "Jason R. Coombs", "author_email": "jaraco@jaraco.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": ".. image:: https://img.shields.io/pypi/v/pip-run.svg\n :target: https://pypi.org/project/pip-run\n\n.. image:: https://img.shields.io/pypi/pyversions/pip-run.svg\n\n.. image:: https://img.shields.io/travis/jaraco/pip-run/master.svg\n :target: https://travis-ci.org/jaraco/pip-run\n\n.. image:: https://img.shields.io/appveyor/ci/jaraco/pip-run/master.svg\n :target: https://ci.appveyor.com/project/jaraco/pip-run/branch/master\n\n.. image:: https://readthedocs.org/projects/pip-run/badge/?version=latest\n :target: https://pip-run.readthedocs.io/en/latest/?badge=latest\n\n``pip-run`` provides on-demand dependency resolution,\nmaking packages available for the duration of an interpreter\nsession.\n\nIt replaces this series of commands (or their Windows equivalent)::\n\n $ virtualenv --python pythonX.X --system-site-packages $temp/env\n $ $temp/env/bin/pip install pkg1 pkg2 -r reqs.txt\n $ $temp/env/bin/python ...\n $ rm -rf $temp/env\n\nWith this single-line command::\n\n $ pythonX.X -m pip-run pkg1 pkg2 -r reqs.txt -- ...\n\nFeatures include\n\n- Allows declaration of dependencies at runtime.\n- Downloads missing dependencies and makes their packages available for import.\n- Installs packages to a special staging location such that they're not installed after the process exits.\n- Relies on pip to cache downloads of such packages for reuse.\n- Supersedes installed packages when required.\n- Relies on packages already satisfied [1]_.\n- Re-uses the pip tool chain for package installation.\n\n``pip-run`` is not intended to solve production dependency management, but does aim to address the other, one-off scenarios around dependency management:\n\n- build setup\n- test runners\n- just in time script running\n- interactive development\n- bug triage\n\n``pip-run`` is a compliment to Pip and Virtualenv and Setuptools, intended to more\nreadily address the on-demand needs and supersede some\nfeatures like ``setup_requires``.\n\n.. [1] Except when a requirements file is used.\n\nInstallation\n============\n\n``pip-run`` is meant to be installed in the system site packages\nalongside pip, though it can also be installed in a virtualenv.\n\nUsage\n=====\n\n- as script launcher\n- as runtime dependency context manager\n- as interactive interpreter in dependency context\n- as module launcher (akin to `python -m`)\n\nInvoke ``pip-run`` from the command-line using the console entry\nscript (simply ``pip-run``) or using the module executable (\n``python -m pip-run``). This latter usage is particularly convenient\nfor testing a command across various Python versions.\n\nParameters following pip-run are passed directly to ``pip install``,\nso ``pip-run numpy`` will install ``numpy`` (reporting any work done\nduring the install) and ``pip-run -q -r requirements.txt`` will quietly\ninstall all the requirements listed in a file called requirements.txt.\n\nFollowing the parameters to ``pip install``, one may optionally\ninclude a ``--`` after which any parameters will be passed\nto a Python interpreter in the context.\n\nExamples\n========\n\nThe `examples folder in this project\n`_\nincludes some examples demonstrating\nthe power and usefulness of the project. Read the docs on those examples\nfor instructions.\n\nIn many of these examples, the option ``-q`` is passed to ``pip-run``\nto suppress the output from pip.\n\nInteractive Interpreter\n-----------------------\n\n``pip-run`` also offers a painless way to run a Python interactive\ninterpreter in the context of certain dependencies::\n\n $ /clean-install/python -m pip-run -q boto\n >>> import boto\n >>>\n\n\nCommand Runner\n--------------\n\nNote that everything after the -- is passed to the python invocation,\nso it's possible to have a one-liner that runs under a dependency\ncontext::\n\n $ python -m pip-run -q requests -- -c \"import requests; print(requests.get('https://pypi.org/project/pip-run').status_code)\"\n 200\n\nAs long as ``pip-run`` is installed in each of Python environments\non the system, this command can be readily repeated on the other\npython environments by specifying the relevant interpreter::\n\n $ python2.7 -m pip-run ...\n\nor on Windows::\n\n $ py -2.7 -m pip-run ...\n\nScript Runner\n-------------\n\nLet's say you have a script that has a one-off purpose. It's either not\npart of a library, where dependencies are normally declared, or it is\nnormally executed outside the context of that library. Still, that script\nprobably has dependencies, say on `requests\n`_. Here's how you can use pip-run to\ndeclare the dependencies and launch the script in a context where\nthose dependencies have been resolved.\n\nFirst, add a ``__requires__`` directive at the head of the script::\n\n #!/usr/bin/env python\n\n __requires__ = ['requests']\n\n import requests\n\n req = requests.get('https://pypi.org/project/pip-run')\n print(req.status_code)\n\nThen, simply invoke that script with pip-run::\n\n $ python -m pip-run -q -- myscript.py\n 200\n\nThe format for requirements must follow `PEP 508 `_.\n\nNote that URLs specifiers are not supported by pip, but ``pip-run`` supports a\nglobal ``__dependency_links__`` attribute which can be used, for example, to\ninstall requirement from a project VCS URL::\n\n #!/usr/bin/env python\n\n __requires__ = ['foo==0.42']\n __dependency_links__ = ['git+ssh://git@example.com/repo.git#egg=foo-0.42']\n\n [...]\n\n``pip-run`` also recognizes a global ``__index_url__`` attribute. If present,\nthis value will supply ``--index-url`` to pip with the attribute value,\nallowing a script to specify a custom package index::\n\n #!/usr/bin/env python\n\n __requires__ = ['my_private_package']\n __index_url__ = 'https://my.private.index/'\n\n import my_private_package\n ...\n\nReplacing setup_requires\n------------------------\n\nFollowing the script example, you can make your setup.py file\ncompatible with ``pip-run`` by declaring your depenedencies in\nthe ``__requires__`` directive::\n\n #!/usr/bin/env python\n\n __requires__ = ['setuptools', 'setuptools_scm']\n\n import setuptools\n\n setuptools.setup(\n ...\n setup_requires=__requires__,\n )\n\nWhen invoked with pip-run, the dependencies will be assured before\nthe script is run, or if run with setuptools, the dependencies\nwill be loaded using the older technique, so the script is\nbackward compatible.\n\nReplacing tests_require\n-----------------------\n\nAlthough this example is included for completeness,\nbecause the technique is somewhat clumsy, the\nauthor currently recommends using ``tox`` for running\ntests except in extremely lean environments.\n\nYou can also replace tests_require. Consider a package that\nruns tests using ``setup.py test`` and relies on the\n``tests_require`` directive to resolve dependencies needed\nduring testing. Simply declare your dependencies in a\nseparate file, e.g. \"tests/requirements.txt\"::\n\n cat > tests/requiremenst.txt\n pytest\n\nFor compatibility, expose those same requirements as\ntests_require in setup.py::\n\n with io.open('tests/requirements.txt') as tr:\n tests_require = [\n \tline.rstrip()\n \tfor line in tr\n \tif re.match('\\w+', line)\n ]\n\n setuptools.setup(\n ...\n tests_require=tests_require,\n )\n\nThen invoke tests with pip-run::\n\n $ python -m pip-run -r tests/requirements.txt -- setup.py test\n\nWhile still supporting the old technique::\n\n $ python setup.py test\n\nSupplying parameters to Pip\n---------------------------\n\nIf you've been using ``pip-run``, you may have defined some requirements\nin the ``__requires__`` of a script, but now you wish to install those\nto a more permanent environment. pip-run provides a routine to facilitate\nthis case:\n\n $ python -m pip_run.read-deps script.py\n my_dependency\n\nIf you're on Unix, you may pipe this result directly to pip:\n\n $ pip install $(python -m pip_run.read-deps script.py)\n\nAnd since `pipenv `_ uses the same syntax,\nthe same technique works for pipenv:\n\n $ pipenv install $(python -m pip_run.read-deps script.py)\n\nHow Does It Work\n================\n\n``pip-run`` effectively does the following:\n\n- ``pip install -t $TMPDIR``\n- ``PYTHONPATH=$TMPDIR python``\n- cleanup\n\nFor specifics, see `pip_run.run()\n`_.\n\nLimitations\n===========\n\n- Due to limitations with ``pip``, ``pip-run`` cannot run with \"editable\"\n (``-e``) requirements.\n\n- ``pip-run`` uses a ``sitecustomize`` module to ensure that ``.pth`` files\n in the requirements are installed. As a result, any environment\n that has a ``sitecustomize`` module will find that module masked\n when running under ``pip-run``.\n\n\nIntegration\n===========\n\nThe author created this package with the intention of demonstrating\nthe capability before integrating it directly with pip in a command\nsuch as ``pip run``. After proposing the change, the idea was largely\nrejected in `pip 3971 `_.\n\nIf you would like to see this functionality made available in pip,\nplease upvote or comment in that ticket.\n\nVersioning\n==========\n\n``pip-run`` uses semver, so you can use this library with\nconfidence about the stability of the interface, even\nduring periods of great flux.\n\nTesting\n=======\n\nInvoke tests with ``tox``.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jaraco/pip-run", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pip-run", "package_url": "https://pypi.org/project/pip-run/", "platform": "", "project_url": "https://pypi.org/project/pip-run/", "project_urls": { "Homepage": "https://github.com/jaraco/pip-run" }, "release_url": "https://pypi.org/project/pip-run/5.3/", "requires_dist": [ "pip", "sphinx; extra == 'docs'", "jaraco.packaging (>=3.2); extra == 'docs'", "rst.linker (>=1.9); extra == 'docs'", "pytest (!=3.7.3,>=3.5); extra == 'testing'", "pytest-sugar (>=0.9.1); extra == 'testing'", "collective.checkdocs; extra == 'testing'", "pytest-flake8; extra == 'testing'" ], "requires_python": ">=2.7", "summary": "install packages and run Python with them", "version": "5.3" }, "last_serial": 4478671, "releases": { "5.0": [ { "comment_text": "", "digests": { "md5": "ccb783d8251bdaa2d9970d30cd09912b", "sha256": "d7912de93a3a777cf9b91e6cd7723e7821af041a95ca68fbad4fb5f8e939283f" }, "downloads": -1, "filename": "pip_run-5.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ccb783d8251bdaa2d9970d30cd09912b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 14173, "upload_time": "2018-11-05T23:18:17", "url": "https://files.pythonhosted.org/packages/01/cd/2280e739a5d563dfa241f14f72d5ad7a99d50e0b85881e408f2a759e36c6/pip_run-5.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5818f24af161eb8c2218dee4fa997f78", "sha256": "273b656b5d76b44287422f592327dd45f4bc92c63dad616ee3298b6a1ae407d0" }, "downloads": -1, "filename": "pip-run-5.0.tar.gz", "has_sig": false, "md5_digest": "5818f24af161eb8c2218dee4fa997f78", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 20722, "upload_time": "2018-11-05T23:18:19", "url": "https://files.pythonhosted.org/packages/74/6b/3655cf09be8c57aa7a321fa9740cf4e5859de32fde8d3b0cc3c470756c2b/pip-run-5.0.tar.gz" } ], "5.0.dev0": [ { "comment_text": "", "digests": { "md5": "cb0da2da78475270336ea1bf28298025", "sha256": "735d97f99358a9b33af742f2241b8037cfb58d10bc1a78065df76eaf4b9bd502" }, "downloads": -1, "filename": "pip_run-5.0.dev0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "cb0da2da78475270336ea1bf28298025", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 14243, "upload_time": "2018-11-05T20:11:16", "url": "https://files.pythonhosted.org/packages/e5/5d/beabcf4eb42469205d22b8dcdc8d252a9a6d13a8b2df0348c33874c25667/pip_run-5.0.dev0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a48966f4636cc9368a7e763ba69d56f6", "sha256": "6d4e1b0593b34f494661f3718338800451f56b4296a9ed39ab056d72b2826a03" }, "downloads": -1, "filename": "pip-run-5.0.dev0.tar.gz", "has_sig": false, "md5_digest": "a48966f4636cc9368a7e763ba69d56f6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 20901, "upload_time": "2018-11-05T20:11:17", "url": "https://files.pythonhosted.org/packages/43/41/2601f0ae8dc95125975e94cf4992ee645da4d7b315c24b3f6e2b0ca16995/pip-run-5.0.dev0.tar.gz" } ], "5.1": [ { "comment_text": "", "digests": { "md5": "b2d6758b94244d9aed78c04b7f5cb751", "sha256": "30fc95e2ea8a354d1b7ed5b55da7c68567de2af6cd5f58460526e47b121afa67" }, "downloads": -1, "filename": "pip_run-5.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b2d6758b94244d9aed78c04b7f5cb751", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 14531, "upload_time": "2018-11-06T17:10:26", "url": "https://files.pythonhosted.org/packages/94/f6/12b53ad00738c48ca3e37de80be256a647d2fa96fbef7ff16b1bea282e34/pip_run-5.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8fa6f8b9fe9e6489f597ab09cdd6ee34", "sha256": "1db6dad0f3a151d6a98fa39051b74a47bffc817ccda095540bb0585eb1ca0244" }, "downloads": -1, "filename": "pip-run-5.1.tar.gz", "has_sig": false, "md5_digest": "8fa6f8b9fe9e6489f597ab09cdd6ee34", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 21571, "upload_time": "2018-11-06T17:10:27", "url": "https://files.pythonhosted.org/packages/1c/0b/8fe8dd86d0b197baf7deedd2e10e6eb11a0c9c7b904a12cc3e3698aa1a18/pip-run-5.1.tar.gz" } ], "5.2": [ { "comment_text": "", "digests": { "md5": "71c144f7e070185eec47fdc4e59bd1ec", "sha256": "4a025e8d92b1796074cb9d1df3759b1a21da63bd7809795ba40b5bf7c574f7ed" }, "downloads": -1, "filename": "pip_run-5.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "71c144f7e070185eec47fdc4e59bd1ec", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 14580, "upload_time": "2018-11-12T18:20:41", "url": "https://files.pythonhosted.org/packages/3e/45/90deef335f918268a9c63b07fd06c410ee53dcb54519f2a2ffc7b55827d7/pip_run-5.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "617f9c455b8f6bd85769e08f5d03e0ca", "sha256": "c7671a9b6a4c5ff9429b08dd611855647f0af798b4a7557efcbbde35a8d8884c" }, "downloads": -1, "filename": "pip-run-5.2.tar.gz", "has_sig": false, "md5_digest": "617f9c455b8f6bd85769e08f5d03e0ca", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 21565, "upload_time": "2018-11-12T18:20:42", "url": "https://files.pythonhosted.org/packages/38/da/645786587f42cb5b9d00fd5510238f9424916df82d8e13dad5c1c8511405/pip-run-5.2.tar.gz" } ], "5.3": [ { "comment_text": "", "digests": { "md5": "181e7c6b49ed5dbecf0891d8254a6758", "sha256": "b5f74719e968c76db2495ffc7c88d25a89ffa36fac8518b60743ea8b0edf5f97" }, "downloads": -1, "filename": "pip_run-5.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "181e7c6b49ed5dbecf0891d8254a6758", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 14669, "upload_time": "2018-11-12T18:51:58", "url": "https://files.pythonhosted.org/packages/41/1f/1644445eba7b80abebc5b12e0d41cd2ed5120f4d26b8d0ef00bdad17e36b/pip_run-5.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "130dabec2c0ad3a3cd955abdf29f240e", "sha256": "bbef4d874ed5a68725d1bf1e51e95dbc5fb33c7274a6ebdd0e7d1a902c6ee6ab" }, "downloads": -1, "filename": "pip-run-5.3.tar.gz", "has_sig": false, "md5_digest": "130dabec2c0ad3a3cd955abdf29f240e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 21703, "upload_time": "2018-11-12T18:51:59", "url": "https://files.pythonhosted.org/packages/21/47/6a0cff8a5f5ef33fc89e1cdb41abca3e98d11a35af45204815dfb87916ac/pip-run-5.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "181e7c6b49ed5dbecf0891d8254a6758", "sha256": "b5f74719e968c76db2495ffc7c88d25a89ffa36fac8518b60743ea8b0edf5f97" }, "downloads": -1, "filename": "pip_run-5.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "181e7c6b49ed5dbecf0891d8254a6758", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 14669, "upload_time": "2018-11-12T18:51:58", "url": "https://files.pythonhosted.org/packages/41/1f/1644445eba7b80abebc5b12e0d41cd2ed5120f4d26b8d0ef00bdad17e36b/pip_run-5.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "130dabec2c0ad3a3cd955abdf29f240e", "sha256": "bbef4d874ed5a68725d1bf1e51e95dbc5fb33c7274a6ebdd0e7d1a902c6ee6ab" }, "downloads": -1, "filename": "pip-run-5.3.tar.gz", "has_sig": false, "md5_digest": "130dabec2c0ad3a3cd955abdf29f240e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 21703, "upload_time": "2018-11-12T18:51:59", "url": "https://files.pythonhosted.org/packages/21/47/6a0cff8a5f5ef33fc89e1cdb41abca3e98d11a35af45204815dfb87916ac/pip-run-5.3.tar.gz" } ] }