Skip to content

Commit 6a76d31

Browse files
Developer documentation updates (Azure#40870)
* doc updates * wording * Fix spelling and link issues * Code snippet documentation --------- Co-authored-by: Josiah Vinson <[email protected]>
1 parent d4c265e commit 6a76d31

File tree

5 files changed

+37
-30
lines changed

5 files changed

+37
-30
lines changed

.vscode/cspell.json

+2
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@
343343
"mynewpackage",
344344
"mypackage",
345345
"myvault",
346+
"myservice",
346347
"mytable",
347348
"nazsdk",
348349
"nbytes",
@@ -391,6 +392,7 @@
391392
"pyright",
392393
"pyrightconfig",
393394
"parameterizing",
395+
"pypirc",
394396
"pyrit",
395397
"pytyped",
396398
"pytz",

doc/dev/code_snippets.md

+24-21
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
All code snippets in README should be up to date and runnable. And we want to have single source of truth hence we only need to maintain one copy. To achieve it, we want to have:
44

5-
- [Store samples in samples folder and setup the pipeline to run them to make sure no sample is broken](#create-samples)
6-
- [In README, refer the code snippet from the samples](#refer-samples)
5+
- [Define snippet definitions in the samples folder](#create-samples)
6+
- [In README, refer to the code snippets from the samples](#refer-samples)
77
- [Run `python_snippet_updater.py` to keep them in sync](#python_snippet_updater-tool)
88

99
## Create samples
@@ -29,35 +29,38 @@ https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/samp
2929

3030
Instead of copying the code snippet into README which is hard to maintain and validate, we add reference to the sample snippet in README. We use the annotation `\<!-- SNIPPET:file_name.snippet_name-->` to refer the code snippet in README file.
3131

32-
It is like:
33-
34-
`\<!-- SNIPPET:test_example_async.asyncio -->`
32+
If you have a file in `samples\text_example_async.py` with a snippet named `asyncio`, you can reference it in your README like:
3533

34+
````markdown
35+
<!-- SNIPPET:test_example_async.asyncio -->
3636
```python
37-
from azure.core.pipeline.transport import AsyncioRequestsTransport
38-
39-
async with AsyncPipeline(AsyncioRequestsTransport(), policies=policies) as pipeline:
40-
response = await pipeline.run(request)
4137
```
38+
<!-- END SNIPPET -->
39+
````
4240

43-
`\<!-- END SNIPPET -->`
44-
45-
**Note:** you need to make sure there is
46-
47-
\```python
48-
49-
\```
50-
51-
within `\<!-- SNIPPET:` & `\<!-- END SNIPPET -->` in README.MD to make the annotation valid.
41+
> Make sure you include a Python code fence within the snippet reference!
5242
5343
## Run python_snippet_updater tool
5444

5545
```powershell
5646
python <azure-sdk-for-python>/tools/azure-sdk-tools/ci_tools/snippet_update/python_snippet_updater.py <path_to_the_service>
5747
```
5848

59-
The script scans the snippets in samples folder and auto replace the snippets in README with the one from samples folder.
49+
The script scans the snippets in samples folder and populates snippet references in README with the snippet definitions from samples folder.
50+
51+
The example reference above could become:
52+
53+
````markdown
54+
<!-- SNIPPET:test_example_async.asyncio -->
55+
56+
```python
57+
from azure.core.pipeline.transport import AsyncioRequestsTransport
58+
59+
async with AsyncPipeline(AsyncioRequestsTransport(), policies=policies) as pipeline:
60+
response = await pipeline.run(request)
61+
```
6062

61-
**NOTE: the snippets in README will be overwritten!**
63+
<!-- END SNIPPET -->
64+
````
6265

63-
Now you are all set!
66+
Once you've run the script, you can commit your changes. Now you are all set!

doc/dev/dev_setup.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ or execute the various commands available in the toolbox.
4343
4444
5. Create a .env file to store your secrets.
4545
46-
The recommended place to store your .env file is one directory higher than the `azure-sdk-for-python` location.
47-
This ensures the secrets will be loaded by the interpreter and most importantly not be committed to Git history.
46+
The recommended place to store your .env file in the root of the SDK repository, as it will be gitignored.
4847
4948
## Follow test-running guidance
5049

doc/dev/release.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Release process
22

3-
### Disclaimer
4-
This article assumes you have code on `main` that is ready to publish:
5-
- Version is accurate
6-
- ChangeLog is updated
7-
- Readme is accurate, etc.
3+
## Prerequisites
4+
First, ensure your code on `main` is ready to publish.
85

9-
If you don't, and you are working with Management packages, start with this page:
10-
https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/mgmt_release.md
6+
For management (control plane) packages, start with this page: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/mgmt_release.md
117

8+
For client (data plane) packages, ensure that:
9+
- The version at `sdk/path-to-your-package/_version.py` has been updated following [these guidelines](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/package_version/package_version_rule.md).
10+
- The changelog has been updated following [these guidelines](https://azure.github.io/azure-sdk/policies_releases.html#change-logs).
11+
- Package README has been updated following [these guidelines](https://azure.github.io/azure-sdk/python_documentation.html).
12+
- Samples have been updated following [these guidelines](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/sample_guide.md).
1213

1314
## Python Package Index
1415

doc/dev/sample_guide.md

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Note that the metadata under `products` must match an existing product slug foun
4242

4343
## Capturing code snippets in reference documentation
4444
Code snippets from samples can be captured as [examples][qa_example] in our reference documentation.
45+
See [code snippets documentation](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/code_snippets.md) for more details on how to define and reference code snippets in Markdown files.
46+
4547
To do this, place `# [START <keyword>]` and `# [END <keyword>]` comments which span the lines you want to show up in the reference documentation example.
4648
Note that the <keyword> used should be unique across all sync/async samples added to a client library.
4749

0 commit comments

Comments
 (0)