@@ -22,7 +22,15 @@ This section covers guidelines for Python samples. Note that
22
22
23
23
### Folder Location
24
24
25
- Each sample should be in a folder under the top-level folder of
25
+ Samples that primarily show the use of one client library should be placed in the
26
+ client library repository. Other samples should be placed in this repository
27
+ ` python-docs-samples ` .
28
+
29
+ ** Library repositories:** Each sample should be in the top-level samples folder ` samples `
30
+ in the client library repository. See the [ Text-to-Speech samples] ( https://github.com/googleapis/python-texttospeech/tree/master/samples )
31
+ for an example.
32
+
33
+ ** python-docs-samples:** Each sample should be in a folder under the top-level folder of
26
34
[ python-docs-samples] ( https://github.com/GoogleCloudPlatform/python-docs-samples )
27
35
that corresponds to the Google Cloud service or API used by the sample.
28
36
For example, a sample demonstrating how to work with BigTable should be
@@ -472,15 +480,22 @@ Please read the [MAC Setup Guide](https://github.com/GoogleCloudPlatform/python-
472
480
473
481
# ## Running tests with nox
474
482
475
- Automated testing for samples in `python - docs - samples` is managed by
483
+ Automated testing for samples is managed by
476
484
[nox](https:// nox.readthedocs.io). Nox allows us to run a variety of tests,
477
485
including the flake8 linter, Python 2.7 , Python 3. x, and App Engine tests,
478
486
as well as automated README generation.
479
487
480
- __Note:__ As a temporary workaround, each project currently uses first
488
+ __Note:__
489
+
490
+ ** Library repositories:** If you are working on an existing project, a `noxfile.py` will already exist.
491
+ For new samples, create a new `noxfile.py` and paste the contents of
492
+ [noxfile- template.py](https:// github.com/ GoogleCloudPlatform/ python- docs- samples/ blob/ master/ noxfile- template.py)
493
+
494
+ ** python- docs- samples:** As a temporary workaround, each project currently uses first
481
495
`noxfile- template.py` found in a parent folder above the current sample. In
482
496
order to simulate this locally, you need to copy + rename the parent
483
- `noxfile- template.py` as `noxfile.py` in the folder of the project (containing the `requirements.txt` for the file ) you want to
497
+ `noxfile- template.py` as `noxfile.py` in the folder of the project (containing the `requirements.txt` for the file ).
498
+
484
499
```console
485
500
cd python- docs- samples
486
501
cp noxfile- template.py PATH / TO / YOUR / PROJECT / noxfile.py
@@ -516,6 +531,8 @@ nox -s py-3.7 -- snippets_test.py:test_list_blobs
516
531
517
532
# ## Running tests with Docker
518
533
534
+ __Note__: This is currently only available for samples in `python- docs- samples` .
535
+
519
536
If you have [Docker](https:// www.docker.com) installed and runnable by
520
537
the local user, you can use `scripts/ run_tests_local.sh` helper script
521
538
to run the tests. For example, let' s say you want to modify the code
0 commit comments