Glossary

Updated

September 8, 2026

Glossary

Short definitions for terms this book uses as defaults. Words are defined on first use in the chapters; this list is for lookup.

API. The names, arguments, return values, and exceptions callers may depend on.

argparse. Standard-library parser for sys.argv. The CLI should call your functions, not reimplement them.

aware datetime. A datetime with tzinfo set. Store these (UTC). Contrast naive datetime.

cProfile. Standard-library profiler. Run uv run python -m cProfile -s tottime file.py after the program is correct.

CSV. Row-and-column text. Use csv with newline="" and UTF-8.

ctypes. Standard-library FFI. Call C types and libraries. Last resort; prefer Python types.

dataclass. Class generated from fields (@dataclass). Boring model for tickets and shifts.

docstring. String literal right under def or on a module. The written contract.

encoding. How bytes become text. This book always passes encoding="utf-8" for text files.

environment variable. A name/value pair on the process (os.environ). Where secrets and DESK_SHIFT live.

FFI. Foreign function interface: calling C (or similar) from Python. Avoid unless you must.

hatchling. A build backend. Named in [build-system] so uv build can produce wheels.

HTTPError. urllib exception for HTTP status errors such as 404.

importlib.resources. Read files shipped inside a package, independent of the current directory.

inspect. Standard-library reflection (signature, getdoc). For tools and tests, not the happy path.

ISO-8601. Timestamp text such as 2026-09-07T14:30:00+00:00. What you put in JSON.

JSON. Nested text format for APIs and files (json module). No native datetime type.

logging. Standard-library logs: named loggers, levels, handlers. The boring default over print in services.

main guard. if __name__ == "__main__":. Runs main only when the file is the program.

naive datetime. A datetime with tzinfo is None. Do not store these as the system of record.

package. Importable directory (usually with __init__.py). The unit you ship.

path. A location on disk. pathlib.Path is the object; / joins relative parts.

pip-audit. Standalone vulnerability scanner. This book prefers uv audit when you already use uv.

pyproject.toml. Project metadata: name, version, dependencies, build backend.

pytest. Test runner. uv run pytest.

ruff. Linter and formatter. uv run ruff check / ruff format.

sdist. Source distribution tarball from uv build.

StringIO. In-memory text stream (io.StringIO). Same shape as a text file for tests.

subprocess.run. Run a child process. List of args, capture_output=True, check=True. No shell=True by default.

sys.executable. Path of the running interpreter. Use it to spawn Python children.

TemporaryDirectory. Temp folder that is deleted when the with block ends.

TextIO. Type of a text stream (typing.TextIO): files, StringIO.

timedelta. A duration (datetime.timedelta), not a clock.

timeit. Repeat a snippet and measure time. Do not freeze the float in tests.

TOML. Config format. tomllib reads it in the standard library; it does not write.

type hint. Annotation such as n: int. Used from the typing part onward where they help.

UTC. The zone you store (datetime.timezone.utc). Convert to a desk ZoneInfo for display.

uv. Toolchain: install Python, run programs (uv run python file.py), lock, build, audit.

wheel. Built install artifact (*.whl) from uv build.

ZoneInfo. IANA time zone (zoneinfo.ZoneInfo("America/Chicago")) for display and local wall times.