403a0e832f231b43da6769b945ab0f61dea4a5df
blog.pyaqa.ru
Блог pyaqa - FastAPI приложение для блога.
Features
- FastAPI REST API
- Python 3.13+
- Async/await support
- Type hints throughout
- Comprehensive testing
- Auto-generated documentation
Requirements
- Python 3.13+
- uv package manager
Installation
uv sync
Usage
uv run python -m app.main
Server runs on http://0.0.0.0:8000
API documentation:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Available Commands
| Command | Description |
|---|---|
uv sync |
Install dependencies |
uv run python -m app.main |
Start development server |
uv run pytest --cov=app --cov-fail-under=70 |
Run tests with coverage |
uv run ruff check . --fix |
Run linters |
uv run ruff format . |
Format code |
uv run isort . --profile black --filter-files |
Sort imports |
uv run mypy . |
Type checking |
uv run mkdocs build |
Build documentation |
uv run mkdocs serve |
Serve documentation locally |
Dependencies
Runtime
- dishka>=1.0.0
- fastapi>=0.136.0
- pydantic-settings>=2.7.0
- uvicorn>=0.44.0
Development
- Tests: httpx>=0.28.1, mimesis>=13.0.0, pytest-asyncio>=1.3.0, pytest-cov>=7.1.0, pytest>=9.0.3
- Lint: black>=23.7.0, isort>=8.0.1, ruff>=0.15.11
- Types: mypy>=1.20.1
- Docs: interrogate>=1.7.0, mkdocs>=1.6.0, mkdocstrings[python]>=0.24.0, pydocstyle>=6.3.0
Project Structure
app/
├── main.py
├── core/
│ ├── config.py
│ └── exceptions.py
├── api/
│ └── v1/
├── modules/
└── common/
└── error_handler.py
tests/
├── api/
├── unit/
├── integration/
└── e2e/
docs/
├── api/
└── development/
Architecture
Layered Architecture:
- API Layer - HTTP endpoints, request/response handling
- Service Layer - Business logic, orchestration
- Repository Layer - Data access abstraction
- Database - Persistence
Dependency Injection: Dishka (not FastAPI Depends)
Testing
# Run all tests
uv run pytest --cov=app --cov-fail-under=70
# Run by type
uv run pytest tests/unit/ -v
uv run pytest tests/api/ -v
uv run pytest -m unit -v
uv run pytest -m api -v
Documentation
# Build docs
uv run mkdocs build
# Serve locally
uv run mkdocs serve
CI/CD
Woodpecker CI is configured in .woodpecker/ directory.
License
See LICENSE file.
Changelog
[v0.1.0] - 2026-04-25
Added
- feat: update project structure and docs (
9772c3c) - [QG] Add quality gates on main branch (
9c3b44b) - [Lint] add pipeline (
fa8751c)
Changed
- pipeline updated (
7cd0d8c)
Other
Languages
Python
91.2%
Shell
8.8%