Skip to content

Commit 22abc36

Browse files
committed
fix: docs
1 parent bda4ef5 commit 22abc36

File tree

1 file changed

+141
-62
lines changed

1 file changed

+141
-62
lines changed

README.md

Lines changed: 141 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,41 @@ A production-ready Python development environment template using modern tools: *
2121
<img src="docs/img/ruff.gif" width="49%"> <img src="docs/img/jupyter.gif" width="49%">
2222
</div>
2323

24+
---
25+
26+
## 📋 Table of Contents
27+
28+
- [Python Development with uv and Ruff](#python-development-with-uv-and-ruff)
29+
- [📋 Table of Contents](#-table-of-contents)
30+
- [✨ Features](#-features)
31+
- [🚀 Quick Start](#-quick-start)
32+
- [Using Dev Container (Recommended)](#using-dev-container-recommended)
33+
- [Using Docker Only](#using-docker-only)
34+
- [Local Setup (Without Docker)](#local-setup-without-docker)
35+
- [📚 Development Workflow](#-development-workflow)
36+
- [Installing Dependencies](#installing-dependencies)
37+
- [Running Tasks](#running-tasks)
38+
- [Pre-commit Hooks](#pre-commit-hooks)
39+
- [Documentation](#documentation)
40+
- [🏗️ Project Structure](#️-project-structure)
41+
- [Built-in Utility Modules](#built-in-utility-modules)
42+
- [**Logger** - Dual-mode logging system](#logger---dual-mode-logging-system)
43+
- [**Configuration** - Environment-based settings](#configuration---environment-based-settings)
44+
- [**Timer** - Performance monitoring](#timer---performance-monitoring)
45+
- [⚙️ Configuration](#️-configuration)
46+
- [Ruff Configuration](#ruff-configuration)
47+
- [Pyright Configuration](#pyright-configuration)
48+
- [Pytest Configuration](#pytest-configuration)
49+
- [🔄 CI/CD](#-cicd)
50+
- [🎨 VSCode Configuration](#-vscode-configuration)
51+
- [🍪 Cookiecutter Templates](#-cookiecutter-templates)
52+
- [📖 Documentation](#-documentation)
53+
- [🌿 Branches](#-branches)
54+
- [📄 License](#-license)
55+
- [🙏 Acknowledgments](#-acknowledgments)
56+
57+
---
58+
2459
## ✨ Features
2560

2661
- 🚀 **Ultra-fast package management** with [uv](https://github.com/astral-sh/uv) (10-100x faster than pip)
@@ -89,7 +124,7 @@ uv sync
89124
uv run pre-commit install
90125
```
91126

92-
## 📚 Getting Started
127+
## 📚 Development Workflow
93128

94129
### Installing Dependencies
95130

@@ -107,7 +142,7 @@ uv add requests pandas
107142
uv add --dev pytest-mock
108143
```
109144

110-
### Development Workflow
145+
### Running Tasks
111146

112147
This project uses **nox** for task automation. All common development tasks are available as nox sessions:
113148

@@ -193,22 +228,30 @@ uv run mkdocs gh-deploy
193228
│ ├── config/ # Configuration management (Settings, FastAPI config)
194229
│ ├── logger/ # Logging utilities (Local & Google Cloud formatters)
195230
│ └── tracer/ # Performance tracing (Timer decorator/context manager)
196-
├── tests/ # Test suite mirroring tools/ structure
231+
├── tests/ # Test suite (mirrors tools/ structure)
232+
│ └── tools/ # Unit tests for utility modules
197233
├── docs/ # MkDocs documentation
234+
│ ├── getting-started/ # Setup guides
235+
│ ├── guides/ # Tool usage guides
236+
│ ├── configurations/ # Configuration references
237+
│ └── usecases/ # Real-world examples
198238
├── .devcontainer/ # Dev Container configuration
199239
├── .github/ # GitHub Actions workflows and reusable actions
200-
├── noxfile.py # Task automation configuration
201-
├── pyproject.toml # Project metadata and dependencies
202-
├── ruff.toml # Ruff configuration
240+
├── noxfile.py # Task automation configuration (test, lint, fmt)
241+
├── pyproject.toml # Project metadata and dependencies (uv)
242+
├── ruff.toml # Ruff linter/formatter configuration
203243
├── pyrightconfig.json # Pyright type checking configuration
204-
└── pytest.ini # Pytest configuration
244+
└── pytest.ini # Pytest configuration (75% coverage requirement)
205245
```
206246

207247
### Built-in Utility Modules
208248

209-
The `tools/` package provides production-ready utilities:
249+
The `tools/` package provides production-ready utilities that can be used in your projects:
210250

211251
#### **Logger** - Dual-mode logging system
252+
253+
Environment-aware logging with support for local development and cloud environments:
254+
212255
```python
213256
from tools.logger import Logger, LogType
214257

@@ -222,14 +265,21 @@ logger.info("Application started")
222265
```
223266

224267
#### **Configuration** - Environment-based settings
268+
269+
Type-safe configuration management using Pydantic:
270+
225271
```python
226272
from tools.config import Settings
227273

228274
settings = Settings() # Loads from .env and .env.local
229275
api_url = settings.api_prefix_v1
276+
is_debug = settings.DEBUG
230277
```
231278

232279
#### **Timer** - Performance monitoring
280+
281+
Automatic execution time logging for functions and code blocks:
282+
233283
```python
234284
from tools.tracer import Timer
235285

@@ -240,8 +290,7 @@ with Timer("database_query"):
240290
# As decorator
241291
@Timer("process_data")
242292
def process_data(data):
243-
# Logs execution time when function completes
244-
return transform(data)
293+
return transform(data) # Logs execution time when function completes
245294
```
246295

247296
## ⚙️ Configuration
@@ -250,106 +299,136 @@ def process_data(data):
250299

251300
Ruff replaces multiple tools (Black, isort, Flake8, pydocstyle, pyupgrade, autoflake) with a single, fast tool.
252301

253-
Key settings in `ruff.toml`:
302+
**Key settings in `ruff.toml`:**
254303
- **Line length**: 88 (Black-compatible)
255304
- **Target Python**: 3.14
256305
- **Rules**: ALL enabled by default with specific exclusions
257306
- **Test files**: Exempt from `INP001` (namespace packages) and `S101` (assert usage)
258307

259-
See [Ruff documentation](https://docs.astral.sh/ruff/) for customization options.
308+
> See [Ruff documentation](https://docs.astral.sh/ruff/) for customization options.
260309
261310
### Pyright Configuration
262311

263-
Type checking configured in `pyrightconfig.json`:
312+
Static type checking for Python code.
313+
314+
**Key settings in `pyrightconfig.json`:**
264315
- **Python version**: 3.14
265-
- **Mode**: Standard type checking
266-
- **Include**: `tools/` package
316+
- **Type checking mode**: Standard
317+
- **Include**: `tools/` package only
267318
- **Virtual environment**: `.venv`
268319

320+
> See [Pyright documentation](https://github.com/microsoft/pyright) for advanced configuration.
321+
269322
### Pytest Configuration
270323

271-
Testing configured in `pytest.ini`:
324+
Testing framework with coverage enforcement.
325+
326+
**Key settings in `pytest.ini`:**
272327
- **Coverage requirement**: 75% minimum (including branch coverage)
273-
- **Test file pattern**: `test__*.py`
328+
- **Test file pattern**: `test__*.py` (double underscore)
274329
- **Coverage reports**: HTML and terminal
275330
- **Import mode**: importlib
276331

332+
> See [pytest documentation](https://docs.pytest.org/) for additional options.
333+
277334
## 🔄 CI/CD
278335

279-
Automated workflows in `.github/workflows/`:
336+
Automated workflows ensure code quality and consistency. All workflows run on push and pull requests.
337+
338+
**Available workflows in `.github/workflows/`:**
280339

281-
| Workflow | Purpose |
282-
|----------|---------|
283-
| `docker.yml` | Validate Docker build |
284-
| `devcontainer.yml` | Validate Dev Container configuration |
285-
| `format.yml` | Check code formatting with Ruff |
286-
| `lint.yml` | Run Pyright and Ruff linting |
287-
| `test.yml` | Run test suite with coverage |
288-
| `gh-deploy.yml` | Deploy documentation to GitHub Pages |
289-
| `pr-agent.yml` | Automated PR reviews |
290-
| `publish-devcontainer.yml` | Publish Dev Container image |
340+
| Workflow | Purpose | Tools Used |
341+
|----------|---------|-----------|
342+
| `docker.yml` | Validate Docker build | Docker |
343+
| `devcontainer.yml` | Validate Dev Container configuration | devcontainer CLI |
344+
| `format.yml` | Check code formatting | Ruff |
345+
| `lint.yml` | Run static analysis | Pyright, Ruff |
346+
| `test.yml` | Run test suite with coverage | pytest, coverage |
347+
| `gh-deploy.yml` | Deploy documentation to GitHub Pages | MkDocs |
348+
| `pr-agent.yml` | Automated PR reviews | Qodo AI PR Agent |
349+
| `publish-devcontainer.yml` | Publish Dev Container image | Docker, GHCR |
291350

292351
## 🎨 VSCode Configuration
293352

294-
The Dev Container includes these pre-configured extensions:
353+
The Dev Container includes pre-configured extensions and settings for optimal Python development.
295354

296-
**Python Development**:
297-
- Ruff, Pyright, Python, autodocstring, python-indent
355+
**Python Development:**
356+
- **Ruff** - Fast linting and formatting
357+
- **Pyright** - Static type checking
358+
- **Python** - Core Python support
359+
- **autodocstring** - Automatic docstring generation
360+
- **python-indent** - Correct Python indentation
298361

299-
**Code Quality**:
300-
- GitLens, Error Lens, indent-rainbow, trailing-spaces
362+
**Code Quality:**
363+
- **GitLens** - Enhanced Git integration
364+
- **Error Lens** - Inline error highlighting
365+
- **indent-rainbow** - Visual indentation guide
366+
- **trailing-spaces** - Highlight trailing whitespace
301367

302-
**File Support**:
303-
- YAML, TOML, Markdown, Docker, Material Icon Theme
368+
**File Support:**
369+
- **YAML**, **TOML**, **Markdown** - Configuration file support
370+
- **Docker** - Dockerfile and docker-compose support
371+
- **Material Icon Theme** - File icons
304372

305-
**Editor Settings**:
306-
- Format on save (Python, JSON, YAML, TOML, Dockerfile)
307-
- Auto-trim trailing whitespace
308-
- Auto-insert final newline
373+
**Editor Settings:**
374+
- ✅ Format on save (Python, JSON, YAML, TOML, Dockerfile)
375+
- ✅ Auto-trim trailing whitespace
376+
- ✅ Auto-insert final newline
377+
- ✅ Organize imports on save
309378

310-
> **Note**: If Ruff formatting doesn't work, reload the window: `Cmd+Shift+P` → "Developer: Reload Window"
379+
> **Troubleshooting**: If Ruff formatting doesn't work, reload the window: `Cmd+Shift+P` → "Developer: Reload Window"
311380
312381
## 🍪 Cookiecutter Templates
313382

314-
Use this repository as a base to generate project-specific templates:
383+
This repository can be used as a base template for various Python projects. Combine it with Cookiecutter to bootstrap project-specific setups:
315384

316385
```bash
386+
# Install cookiecutter
387+
uv add --dev cookiecutter
388+
389+
# Use a template
317390
uv run cookiecutter <template-url>
318391
```
319392

320-
**Recommended templates**:
393+
**Recommended templates:**
321394

322-
- **Data Science**: [cookiecutter-data-science](https://github.com/drivendataorg/cookiecutter-data-science)
323-
- **FastAPI**: [full-stack-fastapi-template](https://github.com/fastapi/full-stack-fastapi-template)
324-
- **Django**: [cookiecutter-django](https://github.com/cookiecutter/cookiecutter-django)
325-
- **Flask**: [cookiecutter-flask](https://github.com/cookiecutter-flask/cookiecutter-flask)
395+
- **Data Science**: [cookiecutter-data-science](https://github.com/drivendataorg/cookiecutter-data-science) - Standardized data science project structure
396+
- **FastAPI**: [full-stack-fastapi-template](https://github.com/fastapi/full-stack-fastapi-template) - Full-stack web applications
397+
- **Django**: [cookiecutter-django](https://github.com/cookiecutter/cookiecutter-django) - Production-ready Django projects
398+
- **Flask**: [cookiecutter-flask](https://github.com/cookiecutter-flask/cookiecutter-flask) - Flask web applications
326399

327400
## 📖 Documentation
328401

329-
Comprehensive documentation is available at [https://a5chin.github.io/python-uv](https://a5chin.github.io/python-uv)
402+
Comprehensive documentation is available at **[https://a5chin.github.io/python-uv](https://a5chin.github.io/python-uv)**
330403

331-
Topics covered:
332-
- Getting started guides (Docker, VSCode, Dev Containers)
333-
- Tool configurations (uv, Ruff, Pyright, pre-commit)
334-
- Testing strategies
335-
- Using the `tools/` utilities (config, logger, tracer)
336-
- Use cases (Jupyter, FastAPI, OpenCV)
404+
**Topics covered:**
405+
- 🚀 **Getting Started** - Docker, VSCode, Dev Containers setup
406+
- ⚙️ **Tool Configurations** - uv, Ruff, Pyright, pre-commit
407+
- 🧪 **Testing Strategies** - pytest, coverage, and best practices
408+
- 🛠️ **Utility Modules** - Config, logger, and tracer guides
409+
- 💡 **Use Cases** - Jupyter, FastAPI, OpenCV examples
337410

338411
## 🌿 Branches
339412

340-
- **[main](https://github.com/a5chin/python-uv/tree/main)** - Current production-ready template
341-
- **[jupyter](https://github.com/a5chin/python-uv/tree/jupyter)** - Archived Jupyter-specific configuration
342-
- **[rye](https://github.com/a5chin/python-uv/tree/rye)** - Archived Rye package manager version
413+
This repository maintains multiple branches for different use cases:
414+
415+
- **[main](https://github.com/a5chin/python-uv/tree/main)** - Current production-ready template (recommended)
416+
- **[jupyter](https://github.com/a5chin/python-uv/tree/jupyter)** - Archived: Jupyter-specific configuration
417+
- **[rye](https://github.com/a5chin/python-uv/tree/rye)** - Archived: Rye package manager version (replaced by uv)
343418

344419
## 📄 License
345420

346421
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
347422

348423
## 🙏 Acknowledgments
349424

350-
This template leverages these excellent tools:
351-
- [uv](https://github.com/astral-sh/uv) by Astral
352-
- [Ruff](https://github.com/astral-sh/ruff) by Astral
353-
- [Pyright](https://github.com/microsoft/pyright) by Microsoft
354-
- [nox](https://nox.thea.codes/) for task automation
355-
- [pytest](https://pytest.org/) for testing
425+
This template is built on top of excellent open-source tools:
426+
427+
- **[uv](https://github.com/astral-sh/uv)** by Astral - Ultra-fast Python package manager
428+
- **[Ruff](https://github.com/astral-sh/ruff)** by Astral - Lightning-fast linter and formatter
429+
- **[Pyright](https://github.com/microsoft/pyright)** by Microsoft - Static type checker for Python
430+
- **[nox](https://nox.thea.codes/)** - Flexible task automation for Python
431+
- **[pytest](https://pytest.org/)** - Testing framework for Python
432+
- **[MkDocs](https://www.mkdocs.org/)** - Documentation site generator
433+
434+
Special thanks to the open-source community for making these tools available!

0 commit comments

Comments
 (0)