Skip to content

Commit 2fb70fb

Browse files
authored
Improve README generation (#233)
1 parent d6fe616 commit 2fb70fb

File tree

5 files changed

+44
-112
lines changed

5 files changed

+44
-112
lines changed

.readme_generation/readme_template.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ $description
1313

1414
We recommend using the provided Docker container.
1515

16-
A pre-built version is available at [docker hub](https://hub.docker.com/repository/docker/ghga/$name):
16+
A pre-built version is available on [Docker Hub](https://hub.docker.com/repository/docker/ghga/$name):
1717
```bash
1818
docker pull ghga/$name:$version
1919
```
@@ -24,11 +24,11 @@ Or you can build the container yourself from the [`./Dockerfile`](./Dockerfile):
2424
docker build -t ghga/$name:$version .
2525
```
2626

27-
For production-ready deployment, we recommend using Kubernetes, however,
28-
for simple use cases, you could execute the service using docker
27+
For production-ready deployment, we recommend using Kubernetes.
28+
However for simple use cases, you could execute the service using docker
2929
on a single server:
3030
```bash
31-
# The entrypoint is preconfigured:
31+
# The entrypoint is pre-configured:
3232
docker run -p 8080:8080 ghga/$name:$version --help
3333
```
3434

@@ -50,18 +50,18 @@ $config_description
5050

5151
### Usage:
5252

53-
A template YAML for configuring the service can be found at
53+
A template YAML file for configuring the service can be found at
5454
[`./example_config.yaml`](./example_config.yaml).
5555
Please adapt it, rename it to `.$shortname.yaml`, and place it in one of the following locations:
5656
- in the current working directory where you execute the service (on Linux: `./.$shortname.yaml`)
5757
- in your home directory (on Linux: `~/.$shortname.yaml`)
5858

59-
The config yaml will be automatically parsed by the service.
59+
The config YAML file will be automatically parsed by the service.
6060

6161
**Important: If you are using containers, the locations refer to paths within the container.**
6262

6363
All parameters mentioned in the [`./example_config.yaml`](./example_config.yaml)
64-
could also be set using environment variables or file secrets.
64+
can also be set using environment variables or file secrets.
6565

6666
For naming the environment variables, just prefix the parameter name with `${shortname}_`,
6767
e.g. for the `host` set an environment variable named `${shortname}_host`
@@ -95,12 +95,12 @@ This will give you a full-fledged, pre-configured development environment includ
9595
- a pre-configured debugger
9696
- automatic license-header insertion
9797

98-
Moreover, inside the devcontainer, a command `dev_install` is available for convenience.
98+
Inside the devcontainer, a command `dev_install` is available for convenience.
9999
It installs the service with all development dependencies, and it installs pre-commit.
100100

101101
The installation is performed automatically when you build the devcontainer. However,
102102
if you update dependencies in the [`./pyproject.toml`](./pyproject.toml) or the
103-
[`lock/requirements-dev.txt`](./lock/requirements-dev.txt), please run it again.
103+
[`lock/requirements-dev.txt`](./lock/requirements-dev.txt), run it again.
104104

105105
## License
106106

.readme_generation/template_overview.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ This is a template for GitHub repositories containing one Python-based microserv
44

55
It features:
66

7-
- *Continuous Templation* - A continuous update-delivery mechanism for templated repositories
8-
- A [devcontainer](https://containers.dev/)-based fully-configured development environment for vscode
7+
- *Continuous Templation* - A continuous update delivery mechanism for templated repositories
8+
- A fully-configured [devcontainer](https://containers.dev/)-based development environment for VS Code
99
- Tight linting and formatting using [Ruff](https://docs.astral.sh/ruff/)
1010
- Static type checking using [mypy](https://www.mypy-lang.org/)
1111
- Security scanning using [bandit](https://bandit.readthedocs.io/en/latest/)
@@ -17,11 +17,11 @@ It features:
1717

1818
It is worth emphasizing the first point, this template is not just a one-time kickstart for your project
1919
but repositories created using this template will continue receiving updates as the template evolves.
20-
For further details, please look at the explanation in [.template/README.md](/.template/README.md).
20+
For further details, please refer to the explanation in [.template/README.md](/.template/README.md).
2121

2222
Please also refer to [.readme_generation/README.md](/.readme_generation/README.md) for details on how
2323
to adapt this readme.
2424

25-
Here the intro to the template stops and the actual template for the readme of the microservice starts:
25+
The introductory section ends here; the microservice README template begins below:
2626

2727
---

README.md

Lines changed: 13 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ This is a template for GitHub repositories containing one Python-based microserv
44

55
It features:
66

7-
- *Continuous Templation* - A continuous update-delivery mechanism for templated repositories
8-
- A [devcontainer](https://containers.dev/)-based fully-configured development environment for vscode
7+
- *Continuous Templation* - A continuous update delivery mechanism for templated repositories
8+
- A fully-configured [devcontainer](https://containers.dev/)-based development environment for VS Code
99
- Tight linting and formatting using [Ruff](https://docs.astral.sh/ruff/)
1010
- Static type checking using [mypy](https://www.mypy-lang.org/)
1111
- Security scanning using [bandit](https://bandit.readthedocs.io/en/latest/)
@@ -17,12 +17,12 @@ It features:
1717

1818
It is worth emphasizing the first point, this template is not just a one-time kickstart for your project
1919
but repositories created using this template will continue receiving updates as the template evolves.
20-
For further details, please look at the explanation in [.template/README.md](/.template/README.md).
20+
For further details, please refer to the explanation in [.template/README.md](/.template/README.md).
2121

2222
Please also refer to [.readme_generation/README.md](/.readme_generation/README.md) for details on how
2323
to adapt this readme.
2424

25-
Here the intro to the template stops and the actual template for the readme of the microservice starts:
25+
The introductory section ends here; the microservice README template begins below:
2626

2727
---
2828
[![tests](https://github.com/ghga-de/microservice-repository-template/actions/workflows/tests.yaml/badge.svg)](https://github.com/ghga-de/microservice-repository-template/actions/workflows/tests.yaml)
@@ -43,7 +43,7 @@ Here you should provide a short summary of the purpose of this microservice.
4343

4444
We recommend using the provided Docker container.
4545

46-
A pre-built version is available at [docker hub](https://hub.docker.com/repository/docker/ghga/my-microservice):
46+
A pre-built version is available on [Docker Hub](https://hub.docker.com/repository/docker/ghga/my-microservice):
4747
```bash
4848
docker pull ghga/my-microservice:0.1.0
4949
```
@@ -54,11 +54,11 @@ Or you can build the container yourself from the [`./Dockerfile`](./Dockerfile):
5454
docker build -t ghga/my-microservice:0.1.0 .
5555
```
5656

57-
For production-ready deployment, we recommend using Kubernetes, however,
58-
for simple use cases, you could execute the service using docker
57+
For production-ready deployment, we recommend using Kubernetes.
58+
However for simple use cases, you could execute the service using docker
5959
on a single server:
6060
```bash
61-
# The entrypoint is preconfigured:
61+
# The entrypoint is pre-configured:
6262
docker run -p 8080:8080 ghga/my-microservice:0.1.0 --help
6363
```
6464

@@ -77,184 +77,125 @@ my_microservice --help
7777

7878
The service requires the following configuration parameters:
7979
- <a id="properties/log_level"></a>**`log_level`** *(string)*: The minimum log level to capture. Must be one of: "CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", or "TRACE". Default: `"INFO"`.
80-
8180
- <a id="properties/service_name"></a>**`service_name`** *(string)*: Short name of this service. Default: `"my_microservice"`.
82-
8381
- <a id="properties/service_instance_id"></a>**`service_instance_id`** *(string, required)*: A string that uniquely identifies this instance across all instances of this service. This is included in log messages.
8482

85-
8683
Examples:
87-
8884
```json
8985
"germany-bw-instance-001"
9086
```
9187

92-
9388
- <a id="properties/log_format"></a>**`log_format`**: If set, will replace JSON formatting with the specified string format. If not set, has no effect. In addition to the standard attributes, the following can also be specified: timestamp, service, instance, level, correlation_id, and details. Default: `null`.
94-
9589
- **Any of**
96-
9790
- <a id="properties/log_format/anyOf/0"></a>*string*
98-
9991
- <a id="properties/log_format/anyOf/1"></a>*null*
10092

101-
10293
Examples:
103-
10494
```json
10595
"%(timestamp)s - %(service)s - %(level)s - %(message)s"
10696
```
10797

108-
10998
```json
11099
"%(asctime)s - Severity: %(levelno)s - %(msg)s"
111100
```
112101

113-
114102
- <a id="properties/log_traceback"></a>**`log_traceback`** *(boolean)*: Whether to include exception tracebacks in log messages. Default: `true`.
115-
116103
- <a id="properties/host"></a>**`host`** *(string)*: IP of the host. Default: `"127.0.0.1"`.
117-
118104
- <a id="properties/port"></a>**`port`** *(integer)*: Port to expose the server on the specified host. Default: `8080`.
119-
120105
- <a id="properties/auto_reload"></a>**`auto_reload`** *(boolean)*: A development feature. Set to `True` to automatically reload the server upon code changes. Default: `false`.
121-
122106
- <a id="properties/workers"></a>**`workers`** *(integer)*: Number of workers processes to run. Default: `1`.
123-
124107
- <a id="properties/api_root_path"></a>**`api_root_path`** *(string)*: Root path at which the API is reachable. This is relative to the specified host and port. Default: `""`.
125-
126108
- <a id="properties/openapi_url"></a>**`openapi_url`** *(string)*: Path to get the openapi specification in JSON format. This is relative to the specified host and port. Default: `"/openapi.json"`.
127-
128109
- <a id="properties/docs_url"></a>**`docs_url`** *(string)*: Path to host the swagger documentation. This is relative to the specified host and port. Default: `"/docs"`.
129-
130110
- <a id="properties/cors_allowed_origins"></a>**`cors_allowed_origins`**: A list of origins that should be permitted to make cross-origin requests. By default, cross-origin requests are not allowed. You can use ['*'] to allow any origin. Default: `null`.
131-
132111
- **Any of**
133-
134112
- <a id="properties/cors_allowed_origins/anyOf/0"></a>*array*
135-
136113
- <a id="properties/cors_allowed_origins/anyOf/0/items"></a>**Items** *(string)*
137-
138114
- <a id="properties/cors_allowed_origins/anyOf/1"></a>*null*
139115

140-
141116
Examples:
142-
143117
```json
144118
[
145119
"https://example.org",
146120
"https://www.example.org"
147121
]
148122
```
149123

150-
151124
- <a id="properties/cors_allow_credentials"></a>**`cors_allow_credentials`**: Indicate that cookies should be supported for cross-origin requests. Defaults to False. Also, cors_allowed_origins cannot be set to ['*'] for credentials to be allowed. The origins must be explicitly specified. Default: `null`.
152-
153125
- **Any of**
154-
155126
- <a id="properties/cors_allow_credentials/anyOf/0"></a>*boolean*
156-
157127
- <a id="properties/cors_allow_credentials/anyOf/1"></a>*null*
158128

159-
160129
Examples:
161-
162130
```json
163131
[
164132
"https://example.org",
165133
"https://www.example.org"
166134
]
167135
```
168136

169-
170137
- <a id="properties/cors_allowed_methods"></a>**`cors_allowed_methods`**: A list of HTTP methods that should be allowed for cross-origin requests. Defaults to ['GET']. You can use ['*'] to allow all standard methods. Default: `null`.
171-
172138
- **Any of**
173-
174139
- <a id="properties/cors_allowed_methods/anyOf/0"></a>*array*
175-
176140
- <a id="properties/cors_allowed_methods/anyOf/0/items"></a>**Items** *(string)*
177-
178141
- <a id="properties/cors_allowed_methods/anyOf/1"></a>*null*
179142

180-
181143
Examples:
182-
183144
```json
184145
[
185146
"*"
186147
]
187148
```
188149

189-
190150
- <a id="properties/cors_allowed_headers"></a>**`cors_allowed_headers`**: A list of HTTP request headers that should be supported for cross-origin requests. Defaults to []. You can use ['*'] to allow all request headers. The Accept, Accept-Language, Content-Language, Content-Type and some are always allowed for CORS requests. Default: `null`.
191-
192151
- **Any of**
193-
194152
- <a id="properties/cors_allowed_headers/anyOf/0"></a>*array*
195-
196153
- <a id="properties/cors_allowed_headers/anyOf/0/items"></a>**Items** *(string)*
197-
198154
- <a id="properties/cors_allowed_headers/anyOf/1"></a>*null*
199155

200-
201156
Examples:
202-
203157
```json
204158
[]
205159
```
206160

207-
208161
- <a id="properties/cors_exposed_headers"></a>**`cors_exposed_headers`**: A list of HTTP response headers that should be exposed for cross-origin responses. Defaults to []. Note that you can NOT use ['*'] to expose all response headers. The Cache-Control, Content-Language, Content-Length, Content-Type, Expires, Last-Modified and Pragma headers are always exposed for CORS responses. Default: `null`.
209-
210162
- **Any of**
211-
212163
- <a id="properties/cors_exposed_headers/anyOf/0"></a>*array*
213-
214164
- <a id="properties/cors_exposed_headers/anyOf/0/items"></a>**Items** *(string)*
215-
216165
- <a id="properties/cors_exposed_headers/anyOf/1"></a>*null*
217166

218-
219167
Examples:
220-
221168
```json
222169
[]
223170
```
224171

225-
226172
- <a id="properties/generate_correlation_id"></a>**`generate_correlation_id`** *(boolean)*: A flag, which, if False, will result in an error when inbound requests don't possess a correlation ID. If True, requests without a correlation ID will be assigned a newly generated ID in the correlation ID middleware function. Default: `true`.
227173

228-
229174
Examples:
230-
231175
```json
232176
true
233177
```
234178

235-
236179
```json
237180
false
238181
```
239182

240-
241183
- <a id="properties/language"></a>**`language`** *(string)*: The language. Must be one of: "Greek", "Croatian", "French", or "German". Default: `"Croatian"`.
242184

243-
244185
### Usage:
245186

246-
A template YAML for configuring the service can be found at
187+
A template YAML file for configuring the service can be found at
247188
[`./example_config.yaml`](./example_config.yaml).
248189
Please adapt it, rename it to `.my_microservice.yaml`, and place it in one of the following locations:
249190
- in the current working directory where you execute the service (on Linux: `./.my_microservice.yaml`)
250191
- in your home directory (on Linux: `~/.my_microservice.yaml`)
251192

252-
The config yaml will be automatically parsed by the service.
193+
The config YAML file will be automatically parsed by the service.
253194

254195
**Important: If you are using containers, the locations refer to paths within the container.**
255196

256197
All parameters mentioned in the [`./example_config.yaml`](./example_config.yaml)
257-
could also be set using environment variables or file secrets.
198+
can also be set using environment variables or file secrets.
258199

259200
For naming the environment variables, just prefix the parameter name with `my_microservice_`,
260201
e.g. for the `host` set an environment variable named `my_microservice_host`
@@ -296,12 +237,12 @@ This will give you a full-fledged, pre-configured development environment includ
296237
- a pre-configured debugger
297238
- automatic license-header insertion
298239

299-
Moreover, inside the devcontainer, a command `dev_install` is available for convenience.
240+
Inside the devcontainer, a command `dev_install` is available for convenience.
300241
It installs the service with all development dependencies, and it installs pre-commit.
301242

302243
The installation is performed automatically when you build the devcontainer. However,
303244
if you update dependencies in the [`./pyproject.toml`](./pyproject.toml) or the
304-
[`lock/requirements-dev.txt`](./lock/requirements-dev.txt), please run it again.
245+
[`lock/requirements-dev.txt`](./lock/requirements-dev.txt), run it again.
305246

306247
## License
307248

0 commit comments

Comments
 (0)