Skip to content

Commit 1c64690

Browse files
committed
Updates to documentation.
1 parent 761a52f commit 1c64690

File tree

3 files changed

+75
-35
lines changed

3 files changed

+75
-35
lines changed

Diff for: .github/workflows/writeme.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
python-version: 3.11 # install the python needed
3030
- name: Install dependencies
3131
run: >-
32-
python3 -m pip install -r .tools/readmes/requirements.txt
32+
python3 -m pip install -r .tools/scanners/requirements.txt
3333
- name: Check WRITEMEs
3434
run: >-
3535
python3 .tools/scanners/writeme.py --check --diff

Diff for: .tools/scanners/README.md

+73-33
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22

33
## Overview
44

5-
Describes WRITEME, a tool to automatically generate service-level READMEs from
6-
metadata and Jinja templates.
5+
Describes a set of scanners to generate documents from the example metadata in this repository.
76

8-
This is an internal tool intended for use only by the AWS code examples team.
7+
- [writeme.py](#WRITEME) - generates READMEs from metadata. Enabled for all SDK languages.
8+
- [catalog.py](#Catalog) - generates catalog files with example listings. Currently enabled for Python only.
9+
10+
### General Information
911

1012
## Prerequisites
1113

12-
We recommend a virtual environment to run this tool.
14+
We recommend a virtual environment to run these tools.
1315

1416
```
15-
cd .tools/readmes
17+
cd .tools/scanners
1618
python -m venv .venv
1719
1820
# Windows
@@ -26,30 +28,6 @@ Depending on how you have Python installed and on your operating system,
2628
the commands might vary slightly. For example, on Windows, use `py` in place of
2729
`python` and uses backslashes in the `venv` path.
2830

29-
## Generate a README
30-
31-
> These instructions assume you're running the commands from the `.tools/readmes`
32-
> directory, using the venv installed there.
33-
34-
WRITEME creates content primarily from metadata you have already
35-
authored for the SOS project. After you have authored metadata and snippet tags
36-
for your examples, run the following command in the `.tools/readmes` folder:
37-
38-
```
39-
python -m writeme --languages <language>:<version> --services <service>
40-
```
41-
42-
WRITEME reads metadata and config data and generates READMEs in the service
43-
folder for the specified languages, versions, and services.
44-
45-
For example, to generate an S3 README for Python:
46-
47-
```
48-
python -m writeme --languages Python:3 --services s3
49-
```
50-
51-
This creates a README.md file in the `python/example_code/s3` folder.
52-
5331
### Parameters
5432

5533
- `--languages` must match a top-level language:version in sdks.yaml.
@@ -58,8 +36,8 @@ This creates a README.md file in the `python/example_code/s3` folder.
5836
`saved_readme` value in config.py (such as README.old.md).
5937
- `--verbose` When set, output verbose debugging info.
6038
- `--dry-run`, `--no-dry-run` In dry run, compare current vs generated and exit with failure if they do not match.
61-
- `--check` Verifies whether the existing README.md matches the proposed new README.md
62-
(but does not write a new README.md). This is the same check that is run by the GitHub action.
39+
- `--check` Verifies whether the existing generated file matches the generated content.
40+
(but does not write a new file). This is the same check that is run by the GitHub action.
6341

6442
You can get inline usage info by using the `-h` flag:
6543

@@ -73,6 +51,7 @@ Additional configuration is kept in `config.py`.
7351

7452
- `entities` is a dictionary of entities that are not otherwise defined in
7553
services.yaml.
54+
- `catalog_filename` is the base name for generated catalog files.
7655
- `language` is a dictionary of language and version for each SDK. Fields are:
7756
- `base_folder` the root folder for the SDK version.
7857
- `service_folder` a Jinja template of the service folder for the SDK version.
@@ -83,6 +62,38 @@ Additional configuration is kept in `config.py`.
8362
and if the generated link is wrong, you can update it manually. On subsequent runs
8463
of WRITEME, the existing link is kept.
8564

65+
66+
### WRITEME
67+
WRITEME is a tool to automatically generate service-level READMEs from
68+
metadata and Jinja templates.
69+
70+
This is an internal tool intended for use only by the AWS code examples team.
71+
72+
## Generate a README
73+
74+
> These instructions assume you're running the commands from the `.tools/scanners`
75+
> directory, using the venv installed there.
76+
77+
WRITEME creates content primarily from metadata you have already
78+
authored for the SOS project. After you have authored metadata and snippet tags
79+
for your examples, run the following command in the `.tools/scanners` folder:
80+
81+
```
82+
python -m writeme --languages <language>:<version> --services <service>
83+
```
84+
85+
WRITEME reads metadata and config data and generates READMEs in the service
86+
folder for the specified languages, versions, and services.
87+
88+
For example, to generate an S3 README for Python:
89+
90+
```
91+
python -m writeme --languages Python:3 --services s3
92+
```
93+
94+
This creates a README.md file in the `python/example_code/s3` folder.
95+
96+
8697
### Custom content
8798

8899
Custom content can be per-SDK or per-README.
@@ -114,13 +125,13 @@ empty if you don't need custom content.
114125
versions, and services.
115126

116127
```
117-
python .tools/readmes/writeme.py --languages <language1>:<version> <language2>:<version> --service <service1> <service2>
128+
python .tools/scanners/writeme.py --languages <language1>:<version> <language2>:<version> --service <service1> <service2>
118129
```
119130

120131
For example, to generate S3 and STS READMEs for Python sdk version 3 and Go sdk version 2:
121132

122133
```
123-
python .tools/readmes/writeme.py --languages Python:3 Go:2 --services s3 sts
134+
python .tools/scanners/writeme.py --languages Python:3 Go:2 --services s3 sts
124135
```
125136

126137
This creates the README.md files in `python/example_code/s3` and other folders.
@@ -147,3 +158,32 @@ And yes, building all readmes for all languages after changing metadata or templ
147158
```
148159
python -m writeme
149160
```
161+
162+
### Catalog
163+
Catalog.py is a tool to automatically generate service-level example catalogs (examples_catalog.json) from metadata using shared document generation tools.
164+
165+
This is an internal tool intended for use only by the AWS code examples team.
166+
167+
## Generate a Catalog
168+
169+
> These instructions assume you're running the commands from the `.tools/scanners`
170+
> directory, using the venv installed there.
171+
172+
WRITEME creates content primarily from metadata you have already
173+
authored for the SOS project. After you have authored metadata and snippet tags
174+
for your examples, run the following command in the `.tools/scanners` folder:
175+
176+
```
177+
python -m catalog --languages <language>:<version> --services <service>
178+
```
179+
180+
Catalog.py reads metadata and config data and generates listings of examples in the service
181+
folder for the specified languages and versions. The file will not be generated if no examples exist.
182+
183+
For example, to generate an S3 README for Python:
184+
185+
```
186+
python -m catalog --languages Python:3 --services s3
187+
```
188+
189+
This creates an `examples_catalog.json` file in the `python/example_code/s3` folder.

Diff for: rustv1/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ these examples in an isolated environment.
9898

9999
## Updating Rust Version
100100

101-
If a rust version releases (most likely) a clippy or has some other breaking change, the Weathertop dashboard will go red. The easiest way to handle this is to run `./tools/set_rust_version.py [rust_version]` (using a venv with the appropriate requirements), creating a commit with those updates, and then running `cargo clippy --fix` in the appropriate folder before making a second commit with those fixes. Line numbers will certainly change, so don't forget to run WRITEME - `./.tools/readmes/.venv/bin/python ./.tools/readmes/writeme.py --languages Rust:1`.
101+
If a rust version releases (most likely) a clippy or has some other breaking change, the Weathertop dashboard will go red. The easiest way to handle this is to run `./tools/set_rust_version.py [rust_version]` (using a venv with the appropriate requirements), creating a commit with those updates, and then running `cargo clippy --fix` in the appropriate folder before making a second commit with those fixes. Line numbers will certainly change, so don't forget to run WRITEME - `./.tools/scanners/.venv/bin/python ./.tools/readmes/writeme.py --languages Rust:1`.
102102

103103
## Contributing
104104

0 commit comments

Comments
 (0)