Skip to content

Add missing GCF samples (other than tutorials)#1614

Merged
ace-n merged 17 commits intomasterfrom
gcf-low-pri
Aug 16, 2018
Merged

Add missing GCF samples (other than tutorials)#1614
ace-n merged 17 commits intomasterfrom
gcf-low-pri

Conversation

@ace-n
Copy link
Copy Markdown

@ace-n ace-n commented Aug 7, 2018

No description provided.

@ace-n ace-n requested a review from andrewsg August 7, 2018 01:09
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 7, 2018
@ace-n
Copy link
Copy Markdown
Author

ace-n commented Aug 11, 2018

@andrewsg something broke in Nox.py, and it no longer supports linting a specific directory. (You have to lint all of python-docs-samples.)

Can you (or another Python person) submit a PR to address this?

@ace-n
Copy link
Copy Markdown
Author

ace-n commented Aug 13, 2018

Edit: addressed the Nox issues in #1630. Force pushed to this branch to include the new changes.

Ace Nassri added 11 commits August 13, 2018 10:49
Change-Id: I2362e4ee8031fd3ea6880ffcec5eb253615df5ba
Change-Id: Ieb2b5b3421bd6821bc6d5626b7986c23e9d82350
Change-Id: I0fb311114bf8c3554e2f052ca00f1dd9eef1cf69
Change-Id: I5ed6d6dc3792e28b12162c47c7e6f5c974a7477f
Change-Id: I1a17e1c72bea6e7a8d18b9ed5910db09bedb753d
Change-Id: I3d99531c68b5ca3272cb6208777f3ab9bde8f9bd
Change-Id: I06c2a5cb46fd2cb497af7ba9e02e43a4e97de972
Change-Id: Ic20ff72602ea3b6b1fdc361d87aea7dfb742150f
Change-Id: Ie8682514d99aa6f82786a76719535efd58a5c1bf
Change-Id: Ief7e96a43948af12de32627b20031c95953ade09
Change-Id: Idc9854ba256271081078c15f7e62d3fd6bbec449
Change-Id: Ib1b6f8eb47511fe9b19ed6d773b4f9c6ef0dc8ed
Copy link
Copy Markdown
Member

@andrewsg andrewsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are all of the requirements files extended?

@ace-n
Copy link
Copy Markdown
Author

ace-n commented Aug 13, 2018

IIRC believe this step was required to get the builds passing previously.

That being said, I'll revert it and see if the build still passes now that the Nox issues have been fixed.

@andrewsg
Copy link
Copy Markdown
Member

It looks like that removed requirements.txt entirely for some samples such as slack and tips.

Change-Id: I8fe4f70869deeb3aac0f9c6016f5c5e45a172731
@ace-n
Copy link
Copy Markdown
Author

ace-n commented Aug 14, 2018

Removed that commit in favor of shrinking the existing requirements.txt files. PTAL once the build passes?

Change-Id: Iba2165bd2af99306feb47b7e29640ebf7d8f3e95
@ace-n
Copy link
Copy Markdown
Author

ace-n commented Aug 14, 2018

Build is passing - PTAL?

Change-Id: I585f2a6a31cf5e23a54eb02fb366a8685601ea23
@@ -0,0 +1 @@
pytest==3.6.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this one too.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

# [END functions_log_retrieve]

# [START functions_logs_retrieve]
from google.cloud import logging as cloud_logging
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "import as" here instead of just "import google.cloud.logging"?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

# [START functions_log_retrieve]
cloud_client = cloud_logging.Client()
log_name = 'cloudfunctions.googleapis.com%2Fcloud-functions'
cloud_logger = cloud_client.logger(log_name.format(os.getenv('GCP_PROJECT')))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we mention in the readme or anywhere else that this env variable has to be set for it to work locally?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not currently - added.

from unittest.mock import MagicMock, Mock, patch

import flask
from mock import MagicMock, Mock, patch
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this need to be changed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted.

import flask
from mock import MagicMock, Mock, patch
import pytest

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this change required by the linter?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope - removed.

google-cloud-error-reporting==0.30.0
python-dateutil==2.7.3 No newline at end of file
google-cloud-pubsub==0.35.4
mock==2.0.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed as it's included in testing requirements.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Change-Id: Ibb5a518f60d06c7637cc39ab54e81a234ea188ec
# [END functions_http_signed_url]

# [START functions_http_form_data]
from werkzeug.utils import secure_filename
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this will work as-is, even without werkzeug in requirements.txt, but have you tested it in production just to make sure (since clearing requirements.txt)?

Copy link
Copy Markdown
Author

@ace-n ace-n Aug 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some (unrelated) bugfixes and confirmed it works.

Change-Id: If71dba3d86954e8e0bf7168638c5c73eb40fe599
@ace-n
Copy link
Copy Markdown
Author

ace-n commented Aug 15, 2018

@dpebot merge when green

@dpebot
Copy link
Copy Markdown
Collaborator

dpebot commented Aug 15, 2018

Okay! I'll merge when all statuses are green and all reviewers approve.

@dpebot dpebot added the automerge Merge the pull request once unit tests and other checks pass. label Aug 15, 2018
@dpebot dpebot self-assigned this Aug 15, 2018
@ace-n ace-n merged commit 69543d4 into master Aug 16, 2018
@ace-n ace-n deleted the gcf-low-pri branch August 16, 2018 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Merge the pull request once unit tests and other checks pass. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants