-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vision Partial Veneer #2298
Vision Partial Veneer #2298
Conversation
If the manual layer wasn't there, what would the ideal solution have been?
Instinctively, I would think we should stick to our testing style in the rest of the repo. Is it just because it's easier, prettier, had some better features? We use sinon in places for easier stubbing, the chai part would be new. |
In which version of |
The ideal solution would be: module.exports = vision_v1;
module.exports.v1 = vision_v1;
// fictional other version
module.exports.v1beta1 = vision_v1beta1; right? |
I think so, but I can see being explicit worth considering, as well, if we intend to carry multiple versions. |
Precisely. If you ask for a version, you get that version. If we ever change which one is assigned to |
I do not know; I was going to ask for feedback on that. :-) I did not realize I would run up against that problem until yesterday when I was writing the code. There are a few options:
|
I really needed sinon to do the mocks I wanted. Since you are using it elsewhere, I assume this is not interesting. I ended up adding chai at the last minute because |
@stephenplusplus I would also like your thoughts on my use of ES6 syntax. Is that something you are okay with beginning to use now that we dropped Node 0.12 support, or would you prefer have the repo remain ES5 for the forseeable future? |
Move fast and break things. I also don't feel strongly about chai or no chai, if it helps us. My concern would be adding another tool to learn that contributors have to face. ES6 syntax is great. I'll do a deeper dive soon. |
I agree, move fast and break things. It's better to remove the manual code pre-1.0 than to have to do a post-1.0 major version bump. |
The most useful error message come not from using chai, but by using power-assert. |
These are not the only options, though. We are not going 1.0 when we release this. We could deprecate the manual layer, and still remove it pre-1.0. (Nonetheless, I am okay with "move fast and break things" in Node. I am not okay with it in Python and Ruby.) |
Oh hey, I like that way better. (That is similar to py.test in Python.) |
I moved over to power-assert. Holding off on scrapping the manual layer until that can have more discussion. |
packages/vision/package.json
Outdated
"tmp": "^0.0.31" | ||
}, | ||
"nyc": { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/vision/src/helpers.js
Outdated
// it to content. | ||
if (request.image.source && request.image.source.filename) { | ||
request.image = { | ||
content: fs.readFileSync(request.image.source.filename), |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/vision/src/helpers.js
Outdated
}); | ||
|
||
// Assign the single-feature method to the `methods` object. | ||
methods[methodName] = promisify(_createSingleFeatureMethod(featureValue)); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/vision/src/helpers.js
Outdated
* API call. | ||
* | ||
* @example | ||
* var vision = require('@google-cloud/vision').v1(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/vision/src/helpers.js
Outdated
* image: {source: {image_uri: 'gs://path/to/image.jpg'}}, | ||
* features: [], | ||
* }; | ||
* client.annotateImage(request).then(response => { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
packages/vision/src/index.js
Outdated
// Create the image annotator client with the provided options. | ||
var client = gapic.v1(opts).imageAnnotatorClient(opts); | ||
if (is.undefined(client.annotateImage)) { | ||
Object.assign(client.constructor.prototype, helpers('v1')); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
The coverage change seems to actually be because so much code was removed as to materially affect the overall total. The Vision coverage is 100%. |
@stephenplusplus @jmdobry The ML folks want this delivered reasonably soon. Can you give it another look and see if everything looks good? In particular, be looking at the pattern, since future GAPIC and partial Veneer releases will follow it. |
package.json
Outdated
"propprop": "^0.3.1", | ||
"semver": "^5.3.0", | ||
"shelljs": "^0.7.3", | ||
"sinon": "^2.2.0", |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@lukesneeringer I'm okay with it overall. The only issue is the docs: #2298 (comment) |
ada694f
to
b391b7d
Compare
Made some changes. Docs: http://stephenplusplus.github.io/gcloud-node/#/docs/vision/master/vision |
Looks good to me. Thanks @stephenplusplus |
I'm using the Vision API to annotate an image with several features at the same time. Unless I'm missing something obvious, the new Happy to open a new issue if that makes sense. |
This is the new surface with breaking changes.
This is an initial pass at the implementation of a "partial Veneer" for Vision.
It:
require('@google-cloud/vision').v1()
.annotateImage
and single-feature methodsIt does not:
provide a default partial Veneer on the versionless entry point (because it is taken by the deprecated manual layer)have backwards compatibility, at all, even remotely a littleNotes:
sinon and chai, which are not currently being used by other packages