Skip to content

Commit 127b408

Browse files
committed
Merge branch 'release/0.4'
2 parents a1c33c9 + 49be074 commit 127b408

File tree

7 files changed

+63
-12
lines changed

7 files changed

+63
-12
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ language: python
22
python:
33
- "2.6"
44
- "2.7"
5-
#- "3.1"
5+
#- "3.1" # cram does not support Python <3.2.4 anymore
66
#- "3.2"
7-
#- "3.3" # cram does not support Python 3.3
7+
#- "3.3" # but now it does support Python 3.3, according to release note 0.6
88
branches:
99
except:
10-
- future
10+
- piptools-ignore-patch
1111
install:
1212
- "pip install cram --use-mirrors"
1313
- "pip install . --use-mirrors"

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## How to contribute to `pip-review`
2+
3+
First rule: please **do** contribute!
4+
5+
I (@jgonggrijp) want to keep `pip-review` in the air, but I can't dedicate much time to maintaining it. So if you see a way to improve `pip-review`, whether it's fixing a bug or adding a feature, please go ahead and do it. I will happily accept your pull request.
6+
7+
### Wish list
8+
9+
- Python 3 compatibility
10+
11+
### The fine print
12+
13+
This repo ([jgonggrijp/pip-review](https://github.com/jgonggrijp/pip-review)) uses [gitflow](https://github.com/nvie/gitflow). Please submit pull requests to the `develop` branch.
14+
15+
The Python files (currently only `bin/pip-review`) use 4-space soft tabs. The other files use 2-space soft tabs.

HISTORY.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
History
22
=======
33

4+
0.4 (2015-11-21)
5+
----------------
6+
- Show and install only release updates by default (Rick Vause)
7+
- Enable pre-release versions using the --pre flag (Rick Vause)
8+
9+
0.3.7 (2015-10-06)
10+
------------------
11+
- Redistribute pip-review as a standalone package (Julian Gonggrijp)
12+
413
0.3.4 (2013-05-27)
514
------------------
615
- Fix bug where non-PyPI packages inside .pipignore broke things when

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Build status](https://travis-ci.org/jgonggrijp/pip-review.svg?branch=master)](https://secure.travis-ci.org/jgonggrijp/pip-review)
2+
13
pip-review
24
==========
35

@@ -35,6 +37,11 @@ Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit y
3537
...
3638
```
3739

40+
Up until version 0.3.7, `pip-review` would show and install any available
41+
update including pre-release versions. As of version 0.4, it will only show and
42+
install release versions by default. To restore the original behaviour, use the
43+
`--pre` flag.
44+
3845

3946
Installation
4047
============

bin/pip-review

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ try:
3737
except (ImportError, AttributeError):
3838
pass
3939

40+
from pip._vendor.packaging import version as packaging_version
41+
4042

4143
def parse_args():
4244
parser = argparse.ArgumentParser(
@@ -61,6 +63,9 @@ def parse_args():
6163
'--local', '-l', action='store_true', default=False,
6264
help='If in a virtualenv that has global access, do not output '
6365
'globally-installed packages')
66+
parser.add_argument(
67+
'--pre', '-p', action='store_true', default=False,
68+
help='Include pre-release and development versions')
6469
return parser.parse_args()
6570

6671

@@ -112,7 +117,7 @@ def get_pkg_info(pkg_name, silent=False):
112117
return info
113118

114119

115-
def latest_version(pkg_name, silent=False):
120+
def latest_version(pkg_name, prerelease=False, silent=False):
116121
try:
117122
info = get_pkg_info(pkg_name, silent=silent)
118123
except ValueError:
@@ -122,12 +127,26 @@ def latest_version(pkg_name, silent=False):
122127
raise
123128
if not info:
124129
return None, None
125-
version = info['info']['version']
130+
131+
try:
132+
versions = [
133+
v for v in sorted(
134+
list(info['releases']),
135+
key=packaging_version.parse
136+
)
137+
]
138+
if not prerelease:
139+
versions = [v for v in versions
140+
if not packaging_version.parse(v).is_prerelease]
141+
version = versions[-1]
142+
except IndexError:
143+
return None, None
144+
126145
return parse_version(version), version
127146

128147

129-
def get_latest_versions(pkg_names):
130-
get_latest = partial(latest_version, silent=True)
148+
def get_latest_versions(pkg_names, prerelease=False):
149+
get_latest = partial(latest_version, prerelease=prerelease, silent=True)
131150
versions = map(get_latest, pkg_names)
132151
return zip(pkg_names, versions)
133152

@@ -235,7 +254,7 @@ def main():
235254
installed = list(get_installed_pkgs(local=args.local))
236255
lookup_on_pypi = [name for name, _, _, editable in installed
237256
if not editable or args.editables]
238-
latest_versions = dict(get_latest_versions(lookup_on_pypi))
257+
latest_versions = dict(get_latest_versions(lookup_on_pypi, args.pre))
239258

240259
all_ok = True
241260
for pkg, installed_raw_version, installed_version, editable in installed:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def get_dependencies():
1414

1515
setup(
1616
name='pip-review',
17-
version='0.3.7',
17+
version='0.4',
1818
url='https://github.com/jgonggrijp/pip-review',
1919
license='BSD',
2020
author='Vincent Driessen, Julian Gonggrijp',

tests/review.t

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
Create a new playground first:
22

3-
$ virtualenv --python="$(which python)" FOO >/dev/null
3+
$ pip install virtualenv >/dev/null 2>&1
4+
$ virtualenv --python="$(which python)" FOO >/dev/null 2>&1
45
$ PATH=FOO/bin:$PATH
56
$ pip install --upgrade --force-reinstall 'pip' > /dev/null 2>&1
67
$ pip install argparse >/dev/null 2>&1
8+
$ pip install -U --force-reinstall argparse >/dev/null 2>&1
9+
$ pip install -U --force-reinstall wheel >/dev/null 2>&1
710
$ alias pip-review="$TESTDIR/../bin/pip-review"
811

912
Setup. Let's pretend we have some outdated package versions installed:
@@ -19,14 +22,12 @@ Next, let's see what pip-review does:
1922
$ pip-review
2023
cElementTree==1.0.2-20050302 is available (you have 1.0.5.post20051216)
2124
python-dateutil==* is available (you have 1.5) (glob)
22-
wheel==* is available (you have 0.24.0) (glob)
2325

2426
Or in raw mode:
2527

2628
$ pip-review --raw
2729
cElementTree==1.0.2-20050302
2830
python-dateutil==* (glob)
29-
wheel==* (glob)
3031

3132
We can also install these updates automatically:
3233

0 commit comments

Comments
 (0)