-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add include_samples=True #263
Conversation
Add support for copying *.test.yaml files into samples/{version}/test/
From definitions in sample_resources.yaml files
This code didn't work because glob() returns a generator. It wasn't necessary to add a conditional around creation of the test/ directory because it's needed for the manifest file as well.
Expect exceptions from shell.run for sample-tester and do not blow up. Example message when sample-tester is not installed to generate manifest: (Note: sample-tester only runs when samples are present) synthtool > Failed executing sample-tester gen-manifest --bin php --env php --chdir samples --output v1p1beta1/test/samples.manifest.yaml v1p1beta1/SpeechAdaptationBeta.php v1p1beta1/SpeechTranscribeDiarizationBeta.php v1p1beta1/SpeechQuickstartBeta.php v1p1beta1/SpeechTranscribeAutoPunctuationBeta.php v1p1beta1/SpeechContextsClassesBeta.php v1p1beta1/SpeechTranscribeMultilanguageBeta.php v1p1beta1/SpeechTranscribeRecognitionMetadataBeta.php v1p1beta1/SpeechTranscribeWordLevelConfidenceBeta.php: pyenv: sample-tester: command not found synthtool > sample-tester failed to run (may not be installed)
Kokoro has been stuck on: Expected — Waiting for status to be reported. Let me know if I can change anything / provide any information to aid in review. Here are some considerations that I made:
The method is just barely shorter than the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎆
@beccasaurus LGTM! I think our linter is unhappy, but a quick |
For code samples, we need to know the version number of the API. Samples are output into directories like: sample/{version}/ Most languages use lowercase version numbers, e.g. v1 or v1p1beta1 Other languages (PHP) capitalize the 'v', e.g. V1 or V1p1beta1 This checks for both. Note: this update does not support full case insensitivity, only allows for the 'v' to be either lower or uppercase for now.
Remove this code now that the following issue was resolved: googleapis/sample-tester#70
The `gen-manifest` command is still a part of the sample-tester PyPi package. Note: manifest generation will eventually move into the generators themselves. For the time being, `gen-manifest` is the recommended tool.
For now. Start with Python, Ruby, Node.js, PHP. Follow-up later to add support for the remaining languages: Java, C#. Go does not use SynthTool at this time.
Now that the sample-tester issue[0] has been resolved, the way key/value pairs are passed to gen-manifest has been updated to be far more flexible. You can read more at: https://sample-tester.readthedocs.io/ [0]: googleapis/sample-tester#70
Reminder: this is intentionally only supporting Python, Ruby, PHP, and Node.js More language support to come in the future
~ Just pushed a number of changes ~ This is production ready for: 🐍 Python, 🐘 PHP, 💎 Ruby, and 🚀 Node.js This is ready for re-review 🔍
☑️ [Response to Feedback] Since the PR was first sent, there have been a number of changes made
ℹ️ [Misc] There have been a number of other, unrelated improvements to the tooling:
Java + C# support will be added in the future (out of scope for this PR) /cc @googleapis/samplegen 🦇 |
@busunkim96 Kokoro is happy, but FYI: I tweaked the code a bit since the last review, would love another look-see 👀 Nothing more to add on my end, it's in a happy state 🍰 |
Ty kindly! |
Add support for GAPIC generated code samples.
You can find a detailed description of what
include_samples=True
does here:This prototype was used to send these initial PRs demonstrating generated code samples:
This is a supported feature of GAPIC.
The official method of testing generated samples is sample-tester.
Library developers define required resources for code samples in
sample_resources.yaml
files.Support for
include_samples=True
based on implementation ofinclude_protos=True
.TODO(beccasaurus)
include_samples
to README(Requires in-progress implementation of: allow running samples with the manifest file dir being the working dir sample-tester#73)
(Based on feedback from PHP)
+
generated samples/cc @googleapis/samplegen @dwsupplee