Skip to content

Commit 6a109b0

Browse files
committed
feat: add machine-readable llms.txt, structured-pipeline example, and uv modernization
1 parent 7084bf7 commit 6a109b0

50 files changed

Lines changed: 1292 additions & 50 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/validate.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- master
8+
- main
89

910
permissions:
1011
contents: read
@@ -16,19 +17,27 @@ concurrency:
1617
jobs:
1718
validate:
1819
runs-on: ubuntu-latest
19-
timeout-minutes: 20
20+
strategy:
21+
matrix:
22+
python-version: ["3.11", "3.12", "3.13"]
23+
timeout-minutes: 15
2024
steps:
2125
- name: Check out repository
22-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26+
uses: actions/checkout@v4
2327

24-
- name: Set up Python
25-
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v5
2630
with:
27-
python-version-file: ".python-version"
28-
cache: pip
31+
enable-cache: true
2932

30-
- name: Install Python dependencies
31-
run: python -m pip install --disable-pip-version-check -r requirements-dev.lock.txt
33+
- name: Set up Python ${{ matrix.python-version }}
34+
run: uv python install ${{ matrix.python-version }}
35+
36+
- name: Install dependencies and dev tools
37+
run: uv pip install --system -r requirements-dev.lock.txt ruff
38+
39+
- name: Lint with ruff
40+
run: ruff check .
3241

3342
- name: Run tests
3443
run: python -m pytest

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.12.13
1+
3.12

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ python examples/product-slug/verify.py solution
2828
```
2929

3030
You just reproduced a bug and verified its fixed behavior. Now give the
31-
[task contract](examples/product-slug/TASK.md) to a coding agent and make the
32-
starter pass without copying the solution.
31+
[task contract](examples/product-slug/TASK.md) and [agent rules](templates/AGENT_RULES.example.md)
32+
to a coding agent (Cursor, Windsurf, Claude Code, Copilot) and make the starter pass without copying the solution.
3333

3434
## Choose what you need to accomplish
3535

@@ -38,8 +38,8 @@ starter pass without copying the solution.
3838
| Write and change Python safely | [AI Coding workflow](guides/ai-coding/workflow.md) | A bounded change with explicit context and evidence |
3939
| Turn Python into a reliable product | [Product quality guide](guides/python-engineering/product-quality.md) | A tested, observable, reversible product path |
4040
| Finish a recurring engineering task | [Playbooks](playbooks/README.md) | A bug fix, API change, integration, dependency upgrade, or release |
41-
| Practice instead of only reading | [Runnable examples](examples/README.md) | A small local project with a failing starter and verified solution |
42-
| Give an agent better instructions | [Templates](templates/README.md) | A task contract, plan, review, and verification record |
41+
| Practice instead of only reading | [Runnable examples](examples/README.md) | Local testable projects with failing starters and verified solutions |
42+
| Give an agent better instructions | [Templates](templates/README.md) | Task contracts, plans, reviews, IDE rules, and verification records |
4343
| Build agents, Skills, MCP, APIs, or automation | [Reviewed source catalog](#browse-the-reviewed-source-catalog) | A primary-source path selected for your use case |
4444
| Find current Python projects | [Project Radar review queue](catalog/projects/README.md) | An evidence-backed shortlist after maintainer review |
4545

@@ -52,6 +52,14 @@ Prefer a guided reading path and ongoing updates? Continue on
5252
[flypython.com](https://flypython.com/). The repository remains the inspectable
5353
source; the website helps you choose the next useful step.
5454

55+
## For AI Agents and LLMs
56+
57+
If you are an LLM agent or coding assistant (Cursor, Windsurf, Claude Code, Copilot, Perplexity):
58+
- Ingest repository index: [`llms.txt`](llms.txt) or [`catalog.json`](catalog.json)
59+
- Universal IDE rules template: [`templates/AGENT_RULES.example.md`](templates/AGENT_RULES.example.md)
60+
- Machine-readable manifest: [`content-manifest.json`](content-manifest.json)
61+
- Official web knowledge dump: `https://flypython.com/llms-full.txt`
62+
5563
## Browse the reviewed source catalog
5664

5765
Choose a learning path below and open the official source that matches your
@@ -190,9 +198,16 @@ Use the Python version declared in `.python-version`, then install the locked
190198
development dependencies:
191199

192200
```bash
201+
# Fast setup using uv (recommended):
202+
uv venv
203+
uv pip install -r requirements-dev.lock.txt
204+
uv run pytest
205+
206+
# Or using standard pip:
193207
python -m venv .venv
194-
. .venv/bin/activate
208+
source .venv/bin/activate
195209
python -m pip install -r requirements-dev.lock.txt
210+
pytest
196211
```
197212

198213
Run the deterministic checks:

README_cn.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ python examples/product-slug/verify.py solution
2626
```
2727

2828
你刚刚复现了一个 Bug,并验证了修复后的行为。接下来把[任务契约](examples/product-slug/TASK_cn.md)
29-
交给 coding agent,让 starter 通过测试,但先不要复制 solution。
29+
[Agent 规则模板](templates/AGENT_RULES.example_cn.md) 提供给 Coding Agent(如 Cursor、Windsurf、Claude Code、Copilot),
30+
让 starter 通过测试,但先不要复制 solution。
3031

3132
## 选择你现在要完成的事
3233

@@ -35,8 +36,8 @@ python examples/product-slug/verify.py solution
3536
| 安全地编写和修改 Python | [AI Coding 工作方法](guides/ai-coding/workflow_cn.md) | 上下文明确、有证据的边界修改 |
3637
| 把 Python 变成可靠产品 | [产品质量指南](guides/python-engineering/product-quality_cn.md) | 可测试、可观测、可回退的产品路径 |
3738
| 完成反复出现的工程任务 | [Playbook](playbooks/README_cn.md) | Bug 修复、API 修改、外部集成、依赖升级或发布 |
38-
| 动手练习而不只是阅读 | [可运行示例](examples/README_cn.md) | 有失败 starter 和验证后 solution 的本地小项目 |
39-
|agent 更好的任务信息 | [模板](templates/README.md) | 任务契约、计划、Review 与验证记录 |
39+
| 动手练习而不只是阅读 | [可运行示例](examples/README_cn.md) | 包含失败 starter 与验证通过 solution 的本地实战项目 |
40+
|Agent 更好的上下文与指令 | [模板](templates/README_cn.md) | 任务契约、计划、IDE 规则、Review 与验证记录 |
4041
| 构建 Agent、Skill、MCP、API 或自动化 | [已审核资料目录](#浏览经过审核的一手资料) | 适合当前用途的一手资料路径 |
4142
| 发现近期值得关注的 Python 项目 | [Project Radar 审核队列](catalog/projects/README.md) | 经维护者审核、带证据的项目短名单 |
4243

@@ -46,6 +47,14 @@ python examples/product-slug/verify.py solution
4647
希望按路径阅读并持续获得更新,可以继续前往
4748
[flypython.com](https://flypython.com/)。仓库仍然是可检查的源内容,网站帮助你选择下一步。
4849

50+
## 面向 AI 智能体与 LLM
51+
52+
如果你是 LLM 智能体或 AI 编程助手(Cursor、Windsurf、Claude Code、Copilot、Perplexity):
53+
- 快速读取结构化仓库索引:[`llms.txt`](llms.txt)[`catalog.json`](catalog.json)
54+
- 通用 IDE 行为守则模板:[`templates/AGENT_RULES.example_cn.md`](templates/AGENT_RULES.example_cn.md)
55+
- 机器可读内容清单:[`content-manifest.json`](content-manifest.json)
56+
- 官网无噪纯文本知识汇总:`https://flypython.com/llms-full.txt`
57+
4958
## 浏览经过审核的一手资料
5059

5160
先选择一条学习路径,再打开符合当前目标的官方资料。目录会说明每项资源为什么被收录、
@@ -179,9 +188,16 @@ https://raw.githubusercontent.com/flypythoncom/python/<full-commit-sha>/catalog.
179188
使用 `.python-version` 指定的 Python,并安装锁定的开发依赖:
180189

181190
```bash
191+
# 推荐:使用 uv 极速安装与测试
192+
uv venv
193+
uv pip install -r requirements-dev.lock.txt
194+
uv run pytest
195+
196+
# 或使用标准 pip:
182197
python -m venv .venv
183-
. .venv/bin/activate
198+
source .venv/bin/activate
184199
python -m pip install -r requirements-dev.lock.txt
200+
pytest
185201
```
186202

187203
运行与 CI 相同的确定性校验:

content-manifest.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,29 @@
346346
}
347347
]
348348
},
349+
{
350+
"id": "structured-pipeline-example",
351+
"type": "example",
352+
"content_version": 1,
353+
"status": "reviewed",
354+
"reviewed_on": "2026-09-02",
355+
"locales": [
356+
{
357+
"lang": "en-US",
358+
"path": "examples/structured-pipeline/README.md",
359+
"title": "Resilient batch data pipeline",
360+
"summary": "Build an isolated, bounded data batch processing pipeline with error recovery using the standard library.",
361+
"sha256": "366cb8a04f17b1f5f80d49889cc4268b7a941e31d789f784b0c5f0b54eb158dd"
362+
},
363+
{
364+
"lang": "zh-CN",
365+
"path": "examples/structured-pipeline/README_cn.md",
366+
"title": "鲁棒批处理数据流水线",
367+
"summary": "使用标准库实现具备错误隔离、类型校验与批处理统计的鲁棒数据流水线。",
368+
"sha256": "21b24d351993b947cde9a36c147a4111690204de858cb07f25436d57853f3dd8"
369+
}
370+
]
371+
},
349372
{
350373
"id": "upgrade-python-dependencies",
351374
"type": "playbook",

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ loop without trusting generated code on sight.
88
- [Untrusted payload validation](pydantic-validation/README.md): handle messy camelCase and snake_case inputs, dirty amount strings, and structured error responses.
99
- [MCP tool server](mcp-server/README.md): build a standard JSON-RPC 2.0 Model Context Protocol tool server with schema validation and isolated runtime errors.
1010
- [Async batch fetcher](async-fetcher/README.md): control concurrency with Semaphore, back off and retry transient HTTP failures, and collect structured results.
11+
- [Resilient batch pipeline](structured-pipeline/README.md): process semi-structured data safely with batch error isolation and field validation using the standard library.
1112

1213
[中文索引](README_cn.md)

examples/README_cn.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
- [不可信数据清洗校验](pydantic-validation/README_cn.md):处理驼峰与下划线混杂入参、带符号金额清洗与结构化错误响应。
88
- [MCP 工具服务](mcp-server/README_cn.md):构建符合规范的 JSON-RPC 2.0 Model Context Protocol 服务端,包含参数模式校验与错误隔离。
99
- [受控并发异步抓取器](async-fetcher/README_cn.md):使用 Semaphore 限制最大并发,对瞬时网络故障进行指数退避重试并聚合结构化结果。
10+
- [鲁棒批处理数据流水线](structured-pipeline/README_cn.md):使用标准库实现具备错误隔离、字段校验与统计汇总的安全批处理流水线。
1011

1112
[English index](README.md)

examples/async-fetcher/solution/fetcher.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from __future__ import annotations
44

55
import asyncio
6-
from typing import Any, Awaitable, Callable
6+
from collections.abc import Awaitable, Callable
7+
from typing import Any
78

89
RETRYABLE_STATUSES = {429, 500, 502, 503, 504}
910

examples/async-fetcher/starter/fetcher.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from __future__ import annotations
44

55
import asyncio
6-
from typing import Any, Awaitable, Callable
6+
from collections.abc import Awaitable, Callable
7+
from typing import Any
78

89

910
async def async_batch_fetch(
@@ -17,7 +18,7 @@ async def async_batch_fetch(
1718
responses = await asyncio.gather(*tasks)
1819

1920
results = []
20-
for item, resp in zip(items, responses):
21+
for item, resp in zip(items, responses, strict=False):
2122
results.append({
2223
"item": item,
2324
"success": resp.get("status_code") == 200,

examples/async-fetcher/tests/test_fetcher.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import asyncio
44
import unittest
5+
56
from fetcher import async_batch_fetch
67

78

0 commit comments

Comments
 (0)