Skip to content

Commit

Permalink
Merge branch 'bye-first'
Browse files Browse the repository at this point in the history
* bye-first:
  ChangeLog: Remove "first" dependency
  Remove dependency on "first"
  • Loading branch information
suutari-ai committed Mar 11, 2017
2 parents 012167c + 3ba5584 commit 5d3c51f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions ChangeLog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Unreleased
required only by unsafe packages
- Fix constraint handling: Do not add new dependencies from constraints
- compile-in: Rename "--no-trusted-host" to "--no-emit-trusted-host"
- Remove dependency on the "first" Python package

0.300.0
-------
Expand Down
6 changes: 3 additions & 3 deletions prequ/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
from itertools import chain, count

import click
from first import first
from pip.req import InstallRequirement

from .cache import DependencyCache
from .exceptions import UnsupportedConstraint
from .logging import log
from .utils import (format_requirement, format_specifier, full_groupby,
from .utils import (first, format_requirement, format_specifier, full_groupby,
get_pinned_version,
is_pinned_requirement, key_from_req, is_vcs_link,
UNSAFE_PACKAGES)
Expand Down Expand Up @@ -156,7 +155,8 @@ def _group_constraints(self, constraints):
"""
for _, ireqs in full_groupby(constraints, key=_dep_key):
ireqs = list(ireqs)
exception_ireq = first(ireqs, key=lambda ireq: ireq.editable or is_vcs_link(ireq))
exception_ireq = first(
x for x in ireqs if x.editable or is_vcs_link(x))
if exception_ireq:
yield exception_ireq # ignore all the other specs: the editable/vcs one is the one that counts
continue
Expand Down
8 changes: 6 additions & 2 deletions prequ/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
from click import style
from pip.req import InstallRequirement

from first import first

from .exceptions import ImpossibleConstraint


def first(iterable):
for x in iterable:
return x
return None


def safeint(s):
try:
return int(s)
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ include_package_data = True
packages = find:
install_requires =
click>=6
first
six
zip_safe = False

Expand Down

0 comments on commit 5d3c51f

Please sign in to comment.