Skip to content

Commit

Permalink
Remove 'deps.on_sys_path', presumed unused. Ref #39.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Aug 28, 2019
1 parent f29aa0f commit d327573
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 45 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
6.0
---

#39: Removed ``pip_run.deps.on_sys_path``, originally intended
for API-use for making packages available at run time in
the same process.

5.3
---

Expand Down
1 change: 0 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ With this single-line command::

Features include

- Allows declaration of dependencies at runtime.
- Downloads missing dependencies and makes their packages available for import.
- Installs packages to a special staging location such that they're not installed after the process exits.
- Relies on pip to cache downloads of such packages for reuse.
Expand Down
33 changes: 0 additions & 33 deletions pip_run/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,6 @@
filterfalse = getattr(itertools, 'filterfalse', None) or itertools.ifilterfalse


@contextlib.contextmanager
def _update_working_set():
"""
Update the master working_set to include these new packages.
TODO: would be better to use an officially-supported API,
but no suitable API is apparent.
"""
try:
pkg_resources = sys.modules['pkg_resources']
pkg_resources._initialize_master_working_set()
except KeyError:
# it's unnecessary to re-initialize when it hasn't
# yet been initialized.
pass
yield


def _installable(args):
"""
Return True only if the args to pip install
Expand Down Expand Up @@ -119,21 +101,6 @@ def _save_file(filename):
os.remove(filename)


@contextlib.contextmanager
def on_sys_path(*args):
"""
Install dependencies via args to pip and ensure they have precedence
on sys.path.
"""
with load(*args) as target:
sys.path.insert(0, target)
try:
with _update_working_set():
yield target
finally:
sys.path.remove(target)


def pkg_installed(spec):
try:
pkg_resources.require(spec)
Expand Down
11 changes: 0 additions & 11 deletions pip_run/tests/test_deps.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
import copy

import pkg_resources

from pip_run import deps


def test_entry_points():
"""
Ensure entry points are visible after making packages visible
"""
with deps.on_sys_path('jaraco.mongodb'):
eps = pkg_resources.iter_entry_points('pytest11')
assert list(eps), "Entry points not found"


class TestInstallCheck:
def test_installed(self):
assert deps.pkg_installed('pip-run')
Expand Down

0 comments on commit d327573

Please sign in to comment.