Conventions used
There are a number of text conventions used throughout this book.
Code in text
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “Also, you will find only the messages from our logger_client
in a newly created app.log
file automatically created by the application.”
A block of code is set as follows:
from locust import HttpUser, task
class ProtoappUser(HttpUser):
host = "http://localhost:8000"
@task
def hello_world(self):
self.client.get("/home")
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
from pydantic import BaseModel, Field
class Book(BaseModel):
title: str = Field(..., min_length=1, max_length=100)
author: str = Field(..., min_length=1, max_length=50)
year: int = Field(..., gt=1900, lt=2100)
Any command-line input or output is written as follows:
$ pytest --cov protoapp tests
Throughout this book, we will generally use Unix-like terminal commands. This might lead to compatibility issues with Windows for commands that run on multiple lines. If you are using a Windows terminal, consider adapting the newline character \
as follows:
$ python -m grpc_tools.protoc \
--proto_path=. ./grpcserver.proto \
--python_out=. \
--grpc_python_out=.
Here is the same line in CMD:
$ python -m grpc_tools.protoc ^
--proto_path=. ./grpcserver.proto ^
--python_out=. ^
--grpc_python_out=.
Here is the line in Powershell:
$ python -m grpc_tools.protoc `
--proto_path=. ./grpcserver.proto `
--python_out=. `
--grpc_python_out=.
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: “This limit can be adjusted in the settings (Settings | Advanced Settings | Run/Debug | Temporary configurations limit).”
Tips or important notes
Appear like this.