Welcome to pip-run documentation!#

For Enterprise

Professional support for pip-run is available as part of the Tidelift Subscription. Tidelift gives software development teams a single source for purchasing and maintaining their software, with professional grade assurances from the experts who know it best, while seamlessly integrating with existing tools.

Learn more Request a Demo

pip_run.run(args=None)#

Main entry point for pip-run.

pip_run.commands.intercept(args)#

Detect certain args and intercept them.

pip_run.commands.parse_script_args(args)#

Separate the command line arguments into arguments for pip and arguments to Python.

>>> parse_script_args(['foo', '--', 'bar'])
(['foo'], ['bar'])
>>> parse_script_args(['foo', 'bar'])
(['foo', 'bar'], [])
pip_run.deps.load(*args)#
pip_run.deps.pkg_installed(spec)#
class pip_run.deps.suppress(*exceptions)#

Bases: suppress, ContextDecorator

A version of contextlib.suppress with decorator support.

>>> @suppress(KeyError)
... def key_error():
...     {}['']
>>> key_error()
pip_run.deps.with_prereleases(spec)#

Allow prereleases to satisfy the spec.

class pip_run.launch.PathReader#

Bases: object

pip_run.launch.inject_sitecustomize(target)#

Create a sitecustomize file in the target that will install the target as a sitedir.

pip_run.launch.read_lines(path)#
pip_run.launch.with_path(target, params)#

Launch Python with target on the path and params

pip_run.launch.with_path_overlay(target, params)#

Overlay Python with target on the path and params

class pip_run.scripts.Dependencies(iterable=(), /)#

Bases: list

index_url = None#
params()#
class pip_run.scripts.DepsReader(script)#

Bases: object

Given a Python script, read the dependencies it declares. Does not execute the script, so expects __requires__ to be assigned a static list of strings.

read()#
>>> DepsReader("__requires__=['foo']").read()
['foo']
>>> DepsReader(r"__requires__='foo\nbar\n#baz'").read()
['foo', 'bar']
classmethod search(params)#

Given a (possibly-empty) series of parameters to a Python interpreter, return any dependencies discovered in a script indicated in the parameters. Only honor the first file found.

classmethod try_read(script_path)#
class pip_run.scripts.NotebookDepsReader(script)#

Bases: DepsReader

classmethod load(script_path)#
class pip_run.scripts.SourceDepsReader(script)#

Bases: DepsReader

classmethod load(script_path)#
pip_run.scripts.run(cmdline)#

Execute the script as if it had been invoked naturally.

Indices and tables#