Skip to content

Commit 65d92dd

Browse files
author
Jonathan Wayne Parrott
committed
Merge pull request #144 from GoogleCloudPlatform/requirements
Restoring missing requirements.txt files
2 parents 475b43f + fcc7a74 commit 65d92dd

File tree

25 files changed

+177
-46
lines changed

25 files changed

+177
-46
lines changed

appengine/bigquery/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
google-api-python-client
1+
google-api-python-client==1.4.2

appengine/mailgun/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
httplib2
1+
httplib2==0.9.2
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
# This requirements file lists all third-party dependencies for this project.
2-
#
3-
# Run 'pip install -r requirements.txt -t lib/' to install these dependencies
4-
# in `lib/` subdirectory.
5-
#
6-
# Note: The `lib` directory is added to `sys.path` by `appengine_config.py`.
7-
Flask==0.10
1+
Flask==0.10.1

appengine/storage/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
google-api-python-client
1+
google-api-python-client==1.4.2

bigquery/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ This section contains samples for [Google BigQuery](https://cloud.google.com/big
77
1. Your environment must be setup with [authentication
88
information](https://developers.google.com/identity/protocols/application-default-credentials#howtheywork). If you're running in your local development environment and you have the [Google Cloud SDK](https://cloud.google.com/sdk/) installed, you can do this easily by running:
99

10-
$ gcloud auth login
10+
$ gcloud init
1111

12-
2. Install dependencies from the top-level [`requirements.txt`](../requirements.txt):
12+
2. Install dependencies in `requirements.txt`:
1313

1414
$ pip install -r requirements.txt
1515

bigquery/api/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-api-python-client==1.4.2

blog/introduction_to_data_models_in_cloud_datastore/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ using [Google Cloud Datastore](https://cloud.google.com/datastore).
99

1010
2. [Enable the Datastore API](https://console.developers.google.com/project/_/apiui/apiview/datastore/overview).
1111

12-
3. Install the [Google Cloud SDK](https://cloud.google.com/sdk) and be sure to run ``gcloud auth``.
12+
3. Install the [Google Cloud SDK](https://cloud.google.com/sdk) and be sure to run ``gcloud init``.
1313

1414

1515
## Running the samples
1616

17-
Install dependencies from the top-level [`requirements.txt`](../../requirements.txt):
17+
Install dependencies from `requirements.txt`:
1818

1919
pip install -r requirements.txt
2020

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gcloud==0.8.0

cloud_logging/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ This section contains samples for [Google Cloud Logging](https://cloud.google.co
77
1. Your environment must be setup with [authentication
88
information](https://developers.google.com/identity/protocols/application-default-credentials#howtheywork). If you're running in your local development environment and you have the [Google Cloud SDK](https://cloud.google.com/sdk/) installed, you can do this easily by running:
99

10-
$ gcloud auth login
10+
$ gcloud init
1111

12-
2. Install dependencies from the top-level [`requirements.txt`](../requirements.txt):
12+
2. Install dependencies from `requirements.txt`:
1313

1414
$ pip install -r requirements.txt
1515

cloud_logging/api/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-api-python-client==1.4.2

compute/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ locally and set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable.
1111

1212
$ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json
1313

14-
2. Install dependencies from the top-level [`requirements.txt`](../requirements.txt):
14+
2. Install dependencies from `requirements.txt`
1515

1616
$ pip install -r requirements.txt
1717

compute/api/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-api-python-client==1.4.2

monitoring/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ locally and set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable.
1111

1212
$ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json
1313

14-
2. Install dependencies from the top-level [`requirements.txt`](../requirements.txt):
14+
2. Install dependencies from `requirements.txt`:
1515

1616
$ pip install -r requirements.txt
1717

monitoring/api/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-api-python-client==1.4.2

requirements-dev.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
beautifulsoup4==4.4.0
2-
coverage==3.7.1
1+
beautifulsoup4==4.4.1
2+
coverage==4.0.2
33
Flask==0.10.1
44
funcsigs==0.4
55
itsdangerous==0.24
@@ -8,11 +8,11 @@ MarkupSafe==0.23
88
mock==1.3.0
99
nose==1.3.7
1010
nose-exclude==0.4.1
11-
nosegae==0.5.7
12-
pbr==1.8.0
11+
nosegae==0.5.8
12+
pbr==1.8.1
1313
PyYAML==3.11
1414
waitress==0.8.10
15-
WebOb==1.4.1
16-
WebTest==2.0.18
17-
Werkzeug==0.10.4
18-
nose-timer
15+
WebOb==1.5.1
16+
WebTest==2.0.20
17+
Werkzeug==0.11.2
18+
nose-timer==0.5.0

requirements.txt

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
gcloud==0.7.1
1+
gcloud==0.8.0
22
google-api-python-client==1.4.2
3-
google-apitools==0.4.11
4-
httplib2==0.9.1
5-
oauth2client==1.5.1
6-
protobuf==3.0.0a1
7-
protorpc==0.11.1
8-
pyasn1==0.1.8
9-
pyasn1-modules==0.0.7
10-
pycrypto==2.6.1
11-
rsa==3.2
12-
simplejson==3.8.0
13-
six==1.9.0
14-
uritemplate==0.6
3+
oauth2client==1.5.2
4+
requests[security]==2.8.1

scripts/check_requirements.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env python
2+
3+
# Copyright (C) 2013 Google Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
"""
18+
Checks dependencies in requirements.txt to ensure they are the latest version.
19+
"""
20+
21+
import argparse
22+
import sys
23+
24+
from update_requirements import get_package_info, read_requirements
25+
26+
27+
def check_req(req):
28+
info = get_package_info(req.project_name)
29+
newest_version = info['version']
30+
current_spec = req.specs[0] if req.specs else ('==', 'unspecified')
31+
if current_spec[1] != newest_version:
32+
return req, newest_version
33+
34+
35+
def main(req_file):
36+
reqs = read_requirements(req_file)
37+
outdated_reqs = filter(None, [check_req(req) for req in reqs])
38+
39+
if outdated_reqs:
40+
for req in outdated_reqs:
41+
print("{} is out of date, latest version is {}".format(*req))
42+
sys.exit(1)
43+
44+
45+
if __name__ == '__main__':
46+
parser = argparse.ArgumentParser(description=__doc__)
47+
parser.add_argument(
48+
'requirements_file',
49+
help='Path the the requirements.txt file to check.')
50+
51+
args = parser.parse_args()
52+
53+
main(args.requirements_file)

scripts/update_requirements.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env python
2+
3+
# Copyright (C) 2013 Google Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
"""
18+
Updates dependencies in requirements.txt to the latest version.
19+
"""
20+
21+
import argparse
22+
23+
from pip.req.req_file import parse_requirements
24+
from pkg_resources import Requirement
25+
import requests
26+
27+
28+
def get_package_info(package):
29+
url = 'https://pypi.python.org/pypi/{}/json'.format(package)
30+
r = requests.get(url)
31+
r.raise_for_status()
32+
return r.json()['info']
33+
34+
35+
def read_requirements(req_file):
36+
return [x.req for x in parse_requirements(req_file, session={})]
37+
38+
39+
def update_req(req):
40+
info = get_package_info(req.project_name)
41+
newest_version = info['version']
42+
current_spec = req.specs[0] if req.specs else ('==', 'unspecified')
43+
new_spec = ('==', newest_version)
44+
if current_spec != new_spec:
45+
newreq = Requirement(req.unsafe_name, [new_spec], req.extras)
46+
print('Updated {} from {} -> {}'.format(
47+
req.project_name,
48+
current_spec[1],
49+
newest_version))
50+
return newreq
51+
return req
52+
53+
54+
def write_requirements(reqs, req_file):
55+
with open(req_file, 'w') as f:
56+
for req in reqs:
57+
f.write('{}\n'.format(req))
58+
59+
60+
def main(req_file):
61+
reqs = read_requirements(req_file)
62+
reqs = [update_req(req) for req in reqs]
63+
write_requirements(reqs, req_file)
64+
65+
66+
if __name__ == '__main__':
67+
parser = argparse.ArgumentParser(description=__doc__)
68+
parser.add_argument(
69+
'requirements_file',
70+
help='Path the the requirements.txt file to update.')
71+
72+
args = parser.parse_args()
73+
74+
main(args.requirements_file)

storage/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ This section contains samples for [Google Cloud Storage](https://cloud.google.co
77
1. Your environment must be setup with [authentication
88
information](https://developers.google.com/identity/protocols/application-default-credentials#howtheywork). If you're running in your local development environment and you have the [Google Cloud SDK](https://cloud.google.com/sdk/) installed, you can do this easily by running:
99

10-
$ gcloud auth login
10+
$ gcloud init
1111

12-
2. Install dependencies from the top-level [`requirements.txt`](../requirements.txt):
12+
2. Install dependencies from `requirements.txt`:
1313

1414
$ pip install -r requirements.txt
1515

storage/api/compose_objects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
def main(bucket, destination, sources):
4444
# Get the application default credentials. When running locally, these are
45-
# available after running `gcloud auth login`. When running on compute
45+
# available after running `gcloud init`. When running on compute
4646
# engine, these are available from the environment.
4747
credentials = GoogleCredentials.get_application_default()
4848

storage/api/list_objects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
def main(bucket):
3636
# [START list_bucket]
3737
# Get the application default credentials. When running locally, these are
38-
# available after running `gcloud auth login`. When running on compute
38+
# available after running `gcloud init`. When running on compute
3939
# engine, these are available from the environment.
4040
credentials = GoogleCredentials.get_application_default()
4141

storage/api/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-api-python-client==1.4.2

storage/transfer_service/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ These samples are used on the following documentation pages:
2323
storage-transfer-<accountId>@partnercontent.gserviceaccount.com
2424
1. Set up gcloud for application default credentials.
2525
1. `gcloud components update`
26-
1. `gcloud auth login`
27-
1. `gcloud config set project PROJECT_ID`
26+
1. `gcloud init`
2827
1. Install [Google API Client Library for Python](https://developers.google.com/api-client-library/python/start/installation).
2928

3029
## Transfer from Amazon S3 to Google Cloud Storage
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-api-python-client==1.4.2

tox.ini

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
skipsdist = True
3-
envlist = pep8, gae, py27, py34
3+
envlist = pep8, reqcheck, gae, py27, py34
44

55
[testenv]
66
passenv = PYTHONPATH GOOGLE_* GCLOUD_* TEST_* TRAVIS*
@@ -15,6 +15,20 @@ commonargs =
1515
--cover-branches
1616
--cover-inclusive
1717

18+
[testenv:reqcheck]
19+
deps =
20+
requests[security]
21+
commands =
22+
bash -c "find . -name requirements.txt |\
23+
xargs -n 1 ./scripts/check_requirements.py"
24+
25+
[testenv:requpdate]
26+
deps =
27+
requests[security]
28+
commands =
29+
bash -c "find . -name requirements.txt |\
30+
xargs -n 1 ./scripts/update_requirements.py"
31+
1832
[testenv:gae]
1933
deps =
2034
{[testenv]deps}

0 commit comments

Comments
 (0)