Skip to content

Commit

Permalink
Merge branch 'master' of github.com:jazzband/pip-tools into pip-tools…
Browse files Browse the repository at this point in the history
…-integration

* 'master' of github.com:jazzband/pip-tools:
  Update release date for 1.10.1.
  Fixed bug breaking pip-sync on Python 3, raising TypeError
  Added release date for 1.10.0.
  • Loading branch information
suutari committed Sep 28, 2017
2 parents 94ecd7a + aecb213 commit 5340e63
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
- Optimize resolver by improving handling of pinned requirements (f954f53)
- Bugfix: Do not generate dependencies from constraints (1367f55)

# 1.10.0 (UNRELEASED)
# 1.10.1 (2017-09-27)

Bug Fixes:
- Fixed bug breaking `pip-sync` on Python 3, raising `TypeError: '<' not supported between instances of 'InstallRequirement' and 'InstallRequirement'` ([#570](https://github.com/jazzband/pip-tools/pull/570)).

# 1.10.0 (2017-09-27)

Features:
- `--generate-hashes` now generates hashes for all wheels,
Expand All @@ -21,7 +26,7 @@ when `--allow-unsafe` was not set. ([#517](https://github.com/jazzband/pip-tools
- Fixed bug where pkg-resources would be removed by pip-sync in Ubuntu. ([#555](https://github.com/jazzband/pip-tools/pull/555)). Thanks @cemsbr
- Fixed bug where the resolver would sometime not stabilize on requirements specifying extras. ([#566](https://github.com/jazzband/pip-tools/pull/566)). Thanks @vphilippon
- Fixed an unicode encoding error when distribution package contains non-ASCII file names ([#567](https://github.com/jazzband/pip-tools/pull/567)). Thanks @suutari
- Fixed package hashing doing unnecessary unpacking
- Fixed package hashing doing unnecessary unpacking ([#557](https://github.com/jazzband/pip-tools/pull/557)). Thanks @suutari-ai

# 1.9.0 (2017-04-12)

Expand Down
13 changes: 3 additions & 10 deletions piptools/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,13 @@
from .logging import log
from .utils import (format_requirement, format_specifier, full_groupby,
get_pinned_version,
is_pinned_requirement, key_from_req, is_vcs_link,
is_pinned_requirement, key_from_ireq, key_from_req, is_vcs_link,
UNSAFE_PACKAGES)

green = partial(click.style, fg='green')
magenta = partial(click.style, fg='magenta')


def _dep_key(ireq):
if ireq.req is None and ireq.link is not None:
return str(ireq.link)
else:
return key_from_req(ireq.req)


class RequirementSummary(object):
"""
Summary of a requirement's properties for comparison purposes.
Expand Down Expand Up @@ -155,7 +148,7 @@ def _group_constraints(self, constraints):
flask~=0.7
"""
for _, ireqs in full_groupby(constraints, key=_dep_key):
for _, ireqs in full_groupby(constraints, key=key_from_ireq):
ireqs = list(ireqs)
exception_ireq = first(ireqs, key=lambda ireq: ireq.editable or is_vcs_link(ireq))
if exception_ireq:
Expand Down Expand Up @@ -190,7 +183,7 @@ def _resolve_one_round(self):
configuration.
"""
# Sort this list for readability of terminal output
constraints = sorted(self.constraints, key=_dep_key)
constraints = sorted(self.constraints, key=key_from_ireq)
unsafe_constraints = []
original_constraints = copy.copy(constraints)
if not self.allow_unsafe:
Expand Down
4 changes: 2 additions & 2 deletions piptools/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from . import click
from .exceptions import IncompatibleRequirements, UnsupportedConstraint
from .utils import flat_map, format_requirement, key_from_req, is_pinned_requirement, is_vcs_link
from .utils import flat_map, format_requirement, key_from_ireq, key_from_req, is_pinned_requirement, is_vcs_link

PACKAGES_TO_IGNORE = [
'pip',
Expand Down Expand Up @@ -155,7 +155,7 @@ def sync(to_install, to_uninstall, verbose=False, dry_run=False, pip_flags=None,
click.echo(" {}".format(format_requirement(ireq)))
else:
package_args = []
for ireq in sorted(to_install):
for ireq in sorted(to_install, key=key_from_ireq):
if ireq.editable:
package_args.extend(['-e', str(ireq.link or ireq.req)])
else:
Expand Down
8 changes: 8 additions & 0 deletions piptools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ def assert_compatible_pip_version():
sys.exit(4)


def key_from_ireq(ireq):
"""Get a standardized key for an InstallRequirement."""
if ireq.req is None and ireq.link is not None:
return str(ireq.link)
else:
return key_from_req(ireq.req)


def key_from_req(req):
"""Get an all-lowercase version of the requirement's name."""
if hasattr(req, 'key'):
Expand Down
15 changes: 15 additions & 0 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,21 @@ def test_diff_with_editable(fake_dist, from_editable):
assert str(package.link) == _get_file_url(path_to_package)


@pytest.mark.parametrize(
'lines',
[
['django==1.8'],
['django==1.8', 'click==4.0'],
]
)
def test_sync_install(from_line, lines):
with mock.patch('piptools.sync.check_call') as check_call:
to_install = {from_line(line) for line in lines}

sync(to_install, set())
check_call.assert_called_once_with(['pip', 'install', '-q'] + sorted(lines))


def test_sync_with_editable(from_editable):
with mock.patch('piptools.sync.check_call') as check_call:
path_to_package = os.path.join(os.path.dirname(__file__), 'fixtures', 'small_fake_package')
Expand Down

0 comments on commit 5340e63

Please sign in to comment.