Skip to content

Commit da02f07

Browse files
committed
Merge pull request #1519 from dstufft/remove-dependency-links
Remove Dependency Links - Needs Discussion
2 parents 2ad8888 + 95ac4c1 commit da02f07

File tree

18 files changed

+76
-196
lines changed

18 files changed

+76
-196
lines changed

CHANGES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
* **BACKWARD INCOMPATIBLE** Dropped support for Python 3.1.
44

5+
* Removed the deprecated support for dependency links and the
6+
``--process-dependency-links`` flag that turned them on. For alternatives to
7+
dependency links please see http://www.pip-installer.org/en/latest/installing.html
8+
59

610
**1.5.4 (2014-02-21)**
711

@@ -80,6 +84,9 @@
8084
* **BACKWARD INCOMPATIBLE** pip no longer respects dependency links by default.
8185
Users may opt into respecting them again using ``--process-dependency-links``.
8286

87+
* **DEPRECATION** ``pip install --process-dependency-links`` and the ability to
88+
use dependency links at all has been deprecated and will be removed in 1.6.
89+
8390
* **DEPRECATION** ``pip install --no-install`` and ``pip install
8491
--no-download`` are now formally deprecated. See Issue #906 for discussion on
8592
possible alternatives, or lack thereof, in future releases.

docs/dependency_links.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
:orphan:
2+
3+
Dependency Links
4+
================
5+
6+
In pip 1.5 processing dependency links was deprecated and it was removed
7+
completely in pip 1.6. Dependency links supports a few different scenarios.
8+
9+
10+
Depending on a Fork of a Project
11+
--------------------------------
12+
13+
If you need to depend on a forked version of a project and it is for your own
14+
personal use, than you can simply use a requirements.txt file that points to
15+
the fork.
16+
17+
.. code::
18+
19+
# We need this fork instead of the foobar that exists on PyPI
20+
git+https://github.com/example/foobar.git#egg=foobar
21+
22+
myproject==1.0 # myproject has a setup.py dependency on foobar
23+
24+
If you need to depend on a forked version of a project for something you want
25+
to distribute to other people than you should rename the project and upload
26+
it with a new name to PyPI. This way people can depend and install on it
27+
normally.
28+
29+
Deploying Directly from VCS
30+
---------------------------
31+
32+
If you're using dependency_links to essentially deploy a tree of dependencies
33+
directly from VCS then you have two primary options. You can either setup
34+
a requirements.txt that lists all of the repositories such as:
35+
36+
.. code::
37+
38+
# These are the locations of the git repos
39+
git+https://github.com/example/foobar.git#egg=foobar
40+
git+https://github.com/example/super.git#egg=super
41+
git+https://github.com/example/duper.git#egg=duper
42+
43+
# This is my main package
44+
myproject==1.0 # This depends on foobar, super, and duper from git repos
45+
46+
Or you can setup a private package index and point pip to use it instead. This
47+
can be as simple as a directory full of packages exposed using Apache2 or Nginx
48+
with an auto index, or can be as complex as a full blown index using software
49+
such as `devpi <http://devpi.net/>`_.
50+
51+
If you're using a simple autoindex, then you can add it to pip using:
52+
53+
.. code:: console
54+
55+
$ pip install --find-links https://example.com/deploy/ myproject
56+
57+
Or if you're using a full blown index it could be:
58+
59+
.. code:: console
60+
61+
# Replace PyPI with the custom index
62+
$ pip install --index-url https://example.com/simple/ myproject
63+
# Add a custom index in addition to PyPI
64+
$ pip install --extra-index-url https://example.com/simple/ myproject

pip/__init__.py

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def __init__(self, name, req, editable, comments=()):
213213
_date_re = re.compile(r'-(20\d\d\d\d\d\d)$')
214214

215215
@classmethod
216-
def from_dist(cls, dist, dependency_links, find_tags=False):
216+
def from_dist(cls, dist, find_tags=False):
217217
location = os.path.normcase(os.path.abspath(dist.location))
218218
comments = []
219219
from pip.vcs import vcs, get_src_requirement
@@ -241,38 +241,7 @@ def from_dist(cls, dist, dependency_links, find_tags=False):
241241
req = dist.as_requirement()
242242
specs = req.specs
243243
assert len(specs) == 1 and specs[0][0] == '=='
244-
version = specs[0][1]
245-
ver_match = cls._rev_re.search(version)
246-
date_match = cls._date_re.search(version)
247-
if ver_match or date_match:
248-
svn_backend = vcs.get_backend('svn')
249-
if svn_backend:
250-
svn_location = svn_backend().get_location(
251-
dist,
252-
dependency_links,
253-
)
254-
if not svn_location:
255-
logger.warn(
256-
'Warning: cannot find svn location for %s' % req)
257-
comments.append(
258-
'## FIXME: could not find svn URL in dependency_links '
259-
'for this package:'
260-
)
261-
else:
262-
comments.append(
263-
'# Installing as editable to satisfy requirement %s:' %
264-
req
265-
)
266-
if ver_match:
267-
rev = ver_match.group(1)
268-
else:
269-
rev = '{%s}' % date_match.group(1)
270-
editable = True
271-
req = '%s@%s#egg=%s' % (
272-
svn_location,
273-
rev,
274-
cls.egg_name(dist)
275-
)
244+
276245
return cls(dist.project_name, req, editable, comments)
277246

278247
@staticmethod

pip/cmdoptions.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,6 @@ def make(self):
252252
help=SUPPRESS_HELP
253253
)
254254

255-
# Remove after 1.5
256-
process_dependency_links = OptionMaker(
257-
"--process-dependency-links",
258-
dest="process_dependency_links",
259-
action="store_true",
260-
default=False,
261-
help="Enable the processing of dependency links.",
262-
)
263-
264255
requirements = OptionMaker(
265256
'-r', '--requirement',
266257
dest='requirements',
@@ -374,6 +365,5 @@ def make(self):
374365
no_allow_external,
375366
allow_unsafe,
376367
no_allow_unsafe,
377-
process_dependency_links,
378368
]
379369
}

pip/commands/freeze.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from pip.log import logger
77
from pip.basecommand import Command
88
from pip.util import get_installed_distributions
9-
from pip._vendor import pkg_resources
109

1110

1211
class FreezeCommand(Command):
@@ -60,27 +59,13 @@ def run(self, options, args):
6059
if skip_regex:
6160
skip_match = re.compile(skip_regex)
6261

63-
dependency_links = []
64-
6562
f = sys.stdout
6663

67-
for dist in pkg_resources.working_set:
68-
if dist.has_metadata('dependency_links.txt'):
69-
dependency_links.extend(
70-
dist.get_metadata_lines('dependency_links.txt')
71-
)
72-
for link in find_links:
73-
if '#egg=' in link:
74-
dependency_links.append(link)
7564
for link in find_links:
7665
f.write('-f %s\n' % link)
7766
installations = {}
7867
for dist in get_installed_distributions(local_only=local_only):
79-
req = pip.FrozenRequirement.from_dist(
80-
dist,
81-
dependency_links,
82-
find_tags=find_tags,
83-
)
68+
req = pip.FrozenRequirement.from_dist(dist, find_tags=find_tags)
8469
installations[req.name] = req
8570
if requirement:
8671
req_f = open(requirement)

pip/commands/install.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ def _build_package_finder(self, options, index_urls, session):
198198
allow_unverified=options.allow_unverified,
199199
allow_all_external=options.allow_all_external,
200200
allow_all_prereleases=options.pre,
201-
process_dependency_links=options.process_dependency_links,
202201
session=session,
203202
)
204203

pip/commands/list.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ def _build_package_finder(self, options, index_urls, session):
7070
allow_unverified=options.allow_unverified,
7171
allow_all_external=options.allow_all_external,
7272
allow_all_prereleases=options.pre,
73-
process_dependency_links=options.process_dependency_links,
7473
session=session,
7574
)
7675

@@ -116,18 +115,9 @@ def find_packages_latests_versions(self, options):
116115
)
117116
index_urls += options.mirrors
118117

119-
dependency_links = []
120-
for dist in get_installed_distributions(
121-
local_only=options.local, skip=self.skip):
122-
if dist.has_metadata('dependency_links.txt'):
123-
dependency_links.extend(
124-
dist.get_metadata_lines('dependency_links.txt'),
125-
)
126-
127118
session = self._build_session(options)
128119

129120
finder = self._build_package_finder(options, index_urls, session)
130-
finder.add_dependency_links(dependency_links)
131121

132122
installed_packages = get_installed_distributions(
133123
local_only=options.local,

pip/commands/wheel.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ def run(self, options, args):
152152
allow_unverified=options.allow_unverified,
153153
allow_all_external=options.allow_all_external,
154154
allow_all_prereleases=options.pre,
155-
process_dependency_links=options.process_dependency_links,
156155
session=session,
157156
)
158157

pip/index.py

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ class PackageFinder(object):
3838
def __init__(self, find_links, index_urls,
3939
use_wheel=True, allow_external=[], allow_unverified=[],
4040
allow_all_external=False, allow_all_prereleases=False,
41-
process_dependency_links=False, session=None):
41+
session=None):
4242
self.find_links = find_links
4343
self.index_urls = index_urls
44-
self.dependency_links = []
4544
self.cache = PageCache()
4645
# These are boring links that have already been logged somehow:
4746
self.logged_links = set()
@@ -73,28 +72,9 @@ def __init__(self, find_links, index_urls,
7372
# Do we want to allow _all_ pre-releases?
7473
self.allow_all_prereleases = allow_all_prereleases
7574

76-
# Do we process dependency links?
77-
self.process_dependency_links = process_dependency_links
78-
self._have_warned_dependency_links = False
79-
8075
# The Session we'll use to make requests
8176
self.session = session or PipSession()
8277

83-
def add_dependency_links(self, links):
84-
## FIXME: this shouldn't be global list this, it should only
85-
## apply to requirements of the package that specifies the
86-
## dependency_links value
87-
## FIXME: also, we should track comes_from (i.e., use Link)
88-
if self.process_dependency_links:
89-
if not self._have_warned_dependency_links:
90-
logger.deprecated(
91-
"1.6",
92-
"Dependency Links processing has been deprecated with an "
93-
"accelerated time schedule and will be removed in pip 1.6",
94-
)
95-
self._have_warned_dependency_links = True
96-
self.dependency_links.extend(links)
97-
9878
def _sort_locations(self, locations):
9979
"""
10080
Sort locations into "files" (archives) and "urls", and return
@@ -222,16 +202,11 @@ def mkurl_pypi_url(url):
222202
posixpath.join(main_index_url.url, version)] + locations
223203

224204
file_locations, url_locations = self._sort_locations(locations)
225-
_flocations, _ulocations = self._sort_locations(self.dependency_links)
226-
file_locations.extend(_flocations)
227205

228206
# We trust every url that the user has given us whether it was given
229207
# via --index-url or --find-links
230208
locations = [Link(url, trusted=True) for url in url_locations]
231209

232-
# We explicitly do not trust links that came from dependency_links
233-
locations.extend([Link(url) for url in _ulocations])
234-
235210
logger.debug('URLs to search for versions for %s:' % req)
236211
for location in locations:
237212
logger.debug('* %s' % location)
@@ -280,15 +255,6 @@ def mkurl_pypi_url(url):
280255
)
281256
finally:
282257
logger.indent -= 2
283-
dependency_versions = list(self._package_versions(
284-
[Link(url) for url in self.dependency_links], req.name.lower()))
285-
if dependency_versions:
286-
logger.info(
287-
'dependency_links found: %s' %
288-
', '.join([
289-
link.url for parsed, link, version in dependency_versions
290-
])
291-
)
292258
file_versions = list(
293259
self._package_versions(
294260
[Link(url) for url in file_locations],
@@ -297,7 +263,6 @@ def mkurl_pypi_url(url):
297263
)
298264
if (not found_versions
299265
and not page_versions
300-
and not dependency_versions
301266
and not file_versions):
302267
logger.fatal(
303268
'Could not find any downloads that satisfy the requirement'
@@ -334,7 +299,7 @@ def mkurl_pypi_url(url):
334299
)
335300
#this is an intentional priority ordering
336301
all_versions = installed_version + file_versions + found_versions \
337-
+ page_versions + dependency_versions
302+
+ page_versions
338303
applicable_versions = []
339304
for (parsed_version, link, version) in all_versions:
340305
if version not in req.req:

pip/req/req_install.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,6 @@ def pkg_info(self):
446446
p.feed(data or '')
447447
return p.close()
448448

449-
@property
450-
def dependency_links(self):
451-
return self.egg_info_lines('dependency_links.txt')
452-
453449
_requirements_section_re = re.compile(r'\[(.*?)\]')
454450

455451
def requirements(self, extras=()):

0 commit comments

Comments
 (0)