#Python
117 posts
Python Automation #5: Reporting Results — Email, Slack, and Discord Notifications
The last piece of automation is reporting. Send Slack and Discord notifications with a single httpx POST, email Excel attachments with smtplib, and keep tokens out of your code with a .env file.

Advanced typing — Variance, ParamSpec, Self, overload
The next step from intermediate typing — covariance/contravariance, ParamSpec and Concatenate, Self, TypeGuard/TypeIs, and @overload.

Appendix A — Moving old Python code to the modern style
A step-by-step guide for moving 2017-era Python code (% strings, has_key, type() comparison, etc.) to modern Python. So readers of the old 21-part Python basics tutorial can continue naturally into this book.

Async and background jobs
When to use async routes, BackgroundTasks for post-response work, the boundary where external queues (Celery, ARQ) start to be needed, and how to safely mix in sync libraries.

Async in depth — event loop, gather/wait, async generator
The next step from the intermediate intro — how the event loop actually works, the difference between Future and Task, gather vs wait, async generators and async iteration.

Asyncio intro
What async/await means, the event loop, asyncio.gather and TaskGroup, and mixing with sync code — your first steps into asyncio in one place.

Authentication — OAuth2 password flow + JWT
Password hashing (argon2/bcrypt), the OAuth2 password flow, JWT issuance/verification, and the current_user dependency that wraps it all into a clean auth pattern.

Building CLI tools (Typer)
How to build a type-hints-first CLI with Typer instead of argparse. Subcommands, autocompletion, and Rich-powered output.

Capstone — finishing the TODO API
Tie the patterns from Chapters 1 ~ 28 into a single working service. Authenticated per-user TODO CRUD, tag filtering, pagination, background notifications, tests, and deploy.

Collections and comprehensions
The four collections — list/tuple/dict/set — and the comprehensions and generator expressions that build new collections in one line.

Connecting a DB — SQLAlchemy 2.x + Alembic
SQLAlchemy 2.x's new style — Mapped/mapped_column, async sessions, integration with FastAPI's dependency injection, and Alembic migrations.

Context managers (with, contextlib)
with that turns try/finally into one line, building your own with __enter__/__exit__, @contextmanager for constructor-short forms, and practical tools like ExitStack/suppress.