90 lines
6.0 KiB
Markdown
90 lines
6.0 KiB
Markdown
# Python Learning Workbook (2026 DevOps/SRE Edition)
|
|
|
|
Zeszyt ćwiczeń do nauki języka Python od zera, zaprojektowany pod **DevOps / SRE w 2026 roku** — izolowane środowisko **Podman** (Zero Host Pollution), nowoczesny toolchain (`uv`, `pytest`, `ruff`, `mypy`) oraz podejście dopasowane do ery AI.
|
|
|
|
## Architektura pracy (Model A — podział na gałęzie)
|
|
|
|
* **`main`** — czysty szablon: nierozwiązane zadania (`exercises/`), wspólne notatki (`notes/`), `AGENTS.md`. **Nie commituj tutaj rozwiązań zadań.**
|
|
* **`attempt/<YYYY-MM>`** — gałąź robocza dla konkretnego podejścia (np. `attempt/2026-11`).
|
|
* **Powrót po czasie / start od nowa:**
|
|
```bash
|
|
git checkout main
|
|
git checkout -b attempt/2027-01
|
|
```
|
|
|
|
## Szybki start (Podman)
|
|
|
|
```bash
|
|
# 1. Zbuduj lokalny obraz z Python 3.12, uv, pytest, ruff, mypy (raz)
|
|
make image
|
|
|
|
# 2. Sprawdź lint (ruff) i typy (mypy)
|
|
make check
|
|
|
|
# 3. Uruchom testy wybranego rozdziału
|
|
make test MOD=01-core/01-basics
|
|
make test MOD=02-engineering-2026/01-ai-code-audit
|
|
make test MOD=03-ecosystems/01-cli-typer
|
|
|
|
# 4. Sformatuj kod
|
|
make fmt
|
|
```
|
|
|
|
---
|
|
|
|
## Ścieżki i checklista postępów
|
|
|
|
### Ścieżka 1: `01-core/` — Rdzeń języka od zera (czyste `stdlib`)
|
|
- [ ] `01-basics` — [README](exercises/01-core/01-basics/README.md): zmienne, typy, warunki, pętle, funkcje
|
|
- [ ] `02-collections` — [README](exercises/01-core/02-collections/README.md): `list`, `tuple`, `dict`, `set`, slicing
|
|
- [ ] `03-strings-files` — [README](exercises/01-core/03-strings-files/README.md): f-stringi, parsowanie tekstu, `pathlib.Path`
|
|
- [ ] `04-errors-exceptions` — [README](exercises/01-core/04-errors-exceptions/README.md): `try`/`except`, własne wyjątki, walidacja
|
|
- [ ] `05-comprehensions-functional` — [README](exercises/01-core/05-comprehensions-functional/README.md): comprehensions, generatory (`yield`), lambdy
|
|
- [ ] `06-oop-dataclasses` — [README](exercises/01-core/06-oop-dataclasses/README.md): klasy, `@dataclass`, kompozycja, `Protocol`
|
|
- [ ] `07-typing-contracts` — [README](exercises/01-core/07-typing-contracts/README.md): nowoczesne typowanie, `Enum`, `TypedDict`, `mypy`
|
|
- [ ] `08-data-structures` — [README](exercises/01-core/08-data-structures/README.md): `Stack`, `Queue` (`deque`), `Counter`, `defaultdict`
|
|
- [ ] `09-design-patterns` — [README](exercises/01-core/09-design-patterns/README.md): Strategy, Factory, Context Manager (`with`), DI
|
|
- [ ] `10-crud-repository` — [README](exercises/01-core/10-crud-repository/README.md): pełny CRUD w pamięci (`TaskStore`)
|
|
- [ ] `11-algorithms` — [README](exercises/01-core/11-algorithms/README.md): wyszukiwanie binarne, two pointers, sliding window, Big-O
|
|
|
|
### Ścieżka 2: `02-engineering-2026/` — Dobre praktyki i umiejętności ery AI
|
|
- [ ] `01-ai-code-audit` — [README](exercises/02-engineering-2026/01-ai-code-audit/README.md): audyt wadliwego „kodu z AI”
|
|
- [ ] `02-type-driven-design` — [README](exercises/02-engineering-2026/02-type-driven-design/README.md): walidowane typy domenowe (`Email`, `Money`, `Port`)
|
|
- [ ] `03-cross-platform-os` — [README](exercises/02-engineering-2026/03-cross-platform-os/README.md): `pathlib`, env vars, bezpieczny `subprocess`, logi JSON
|
|
- [ ] `04-testing-best-practices` — [README](exercises/02-engineering-2026/04-testing-best-practices/README.md): `pytest` fixtures, parametryzacja, In-Memory Fakes
|
|
- [ ] `05-testing-types-and-mutation` — [README](exercises/02-engineering-2026/05-testing-types-and-mutation/README.md): testy jednostkowe, integracyjne i mutacyjne (zabijanie mutantów)
|
|
- [ ] `06-security-appsec` — [README](exercises/02-engineering-2026/06-security-appsec/README.md): bezpieczeństwo kodu (Path Traversal, redakcja sekretów)
|
|
|
|
### Ścieżka 3: `03-ecosystems/` — DevOps, SRE, Web i AIOps
|
|
- [ ] `01-cli-typer` — [README](exercises/03-ecosystems/01-cli-typer/README.md): parsowanie argumentów CLI z `typer`
|
|
- [ ] `02-web-api-fastapi` — [README](exercises/03-ecosystems/02-web-api-fastapi/README.md): REST API w `FastAPI` + `Pydantic`
|
|
- [ ] `03-devops-automation` — [README](exercises/03-ecosystems/03-devops-automation/README.md): YAML/JSON, analiza logów, retry z backoffem
|
|
- [ ] `04-aiops-structured-io` — [README](exercises/03-ecosystems/04-aiops-structured-io/README.md): walidacja JSON z API LLM przez `Pydantic`
|
|
- [ ] `05-sql-sqlite` — [README](exercises/03-ecosystems/05-sql-sqlite/README.md): SQL i SQLite z ochroną przed SQL Injection
|
|
|
|
### Mini-Projekt Końcowy (Capstone): `projects/incident-tracker/`
|
|
- [ ] `incident-tracker` — [README](projects/incident-tracker/README.md): pełna aplikacja SRE (CLI + SQLite + JSON + testy, `make test-project`)
|
|
|
|
---
|
|
|
|
## Notatki i Wiedza Teoretyczna
|
|
|
|
* [Indeks notatek](notes/README.md)
|
|
* [00 — Ściągawka Python 3.12](notes/00-cheatsheet.md)
|
|
* [01 — Ekosystem Pythona i najważniejsze biblioteki (2026)](notes/01-python-ecosystem-2026.md)
|
|
* [02 — Słownik języka branżowego PL ↔ EN (Rekrutacja & Korpo)](notes/02-terminology-pl-en.md)
|
|
* [03 — Algorytmy i złożoność obliczeniowa (Big-O)](notes/03-algorithms-and-complexity.md)
|
|
* [04 — Rodzaje testów: jednostkowe, integracyjne, mutacyjne, ręczne i automatyczne](notes/04-testing-pyramid-and-types.md)
|
|
* [05 — Efektywny debugging i czytanie błędów (Tracebacki)](notes/05-debugging-and-reading-errors.md)
|
|
* [06 — SQL i Bazy Danych (SQLite & PostgreSQL)](notes/06-sql-and-databases.md)
|
|
* [07 — Bezpieczeństwo Kodu (AppSec & OWASP)](notes/07-appsec-and-secure-coding.md)
|
|
* [08 — Git w Korpo i Architektura Aplikacji](notes/08-git-workflow-and-architecture.md)
|
|
* [99 — Dziennik Błędów i System Powtórek](notes/99-mistakes-log.md)
|
|
|
|
## Nauka z asystentem AI (metoda sokratejska i era 2026)
|
|
|
|
Repozytorium zawiera plik [AGENTS.md](AGENTS.md), który konfiguruje agentów AI do pracy w **3 trybach**:
|
|
* **Tryb Sokratejski (`01-core/`)** — stopniowane podpowiedzi zamiast gotowców + code review po przejściu testów.
|
|
* **Tryb Specyfikacja → Audyt (`02-engineering-2026/`)** — nacisk na krytyczny przegląd kodu AI, typowanie i bezpieczeństwo.
|
|
* **Tryb Architekta (`03-ecosystems/`)** — praktyka DevOps/SRE, FastAPI, CLI i AIOps.
|