Skip to content

Commit 93ed22e

Browse files
authored
Merge pull request #66 from RayCarterLab/v2.2
release: prepare ExcelAlchemy 2.2.6
2 parents 52e07b0 + 28e3d41 commit 93ed22e

48 files changed

Lines changed: 1563 additions & 96 deletions

Some content is hidden

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

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,51 @@ All notable changes to this project will be documented in this file.
44

55
The format is inspired by Keep a Changelog and versioned according to PEP 440.
66

7+
## [2.2.6] - 2026-04-04
8+
9+
This release continues the stable 2.x line with stronger consumer-facing
10+
result-object guidance, a copyable FastAPI reference project, harder release
11+
smoke validation, and clearer codec fallback diagnostics.
12+
13+
### Added
14+
15+
- Added `docs/result-objects.md` to explain how to read `ImportResult`,
16+
`CellErrorMap`, and `RowIssueMap` and how to expose them through backend APIs
17+
- Added a copyable FastAPI reference project under `examples/fastapi_reference`
18+
with separate route, service, storage, and schema modules
19+
- Added a captured output artifact for the FastAPI reference project and linked
20+
it from the examples docs and showcase
21+
22+
### Changed
23+
24+
- Extended `docs/getting-started.md`, `docs/public-api.md`,
25+
`docs/examples-showcase.md`, and the README entry points so the result
26+
objects and API integration path are easier to discover
27+
- Strengthened package smoke verification by validating both successful and
28+
failed imports, including structured `cell_error_map` and `row_error_map`
29+
payloads
30+
- Expanded example smoke coverage so the FastAPI reference project is exercised
31+
directly alongside the existing script-style examples
32+
- Polished codec fallback warnings so parse failures now produce clearer
33+
developer-facing diagnostics with field labels and cleaner exception reasons
34+
35+
### Compatibility Notes
36+
37+
- No public import or export workflow API was removed in this release
38+
- `ImportResult`, `CellErrorMap`, and `RowIssueMap` remain the stable public
39+
result objects for 2.x integrations
40+
- The FastAPI reference project is additive guidance and does not change the
41+
public API surface
42+
- `storage=...` remains the recommended 2.x backend configuration path
43+
44+
### Release Summary
45+
46+
- result objects are now documented as first-class API integration surfaces
47+
- the repository now includes a copyable FastAPI reference-project layout
48+
- release smoke verification checks successful imports, failed imports, and
49+
structured error payloads
50+
- codec fallback warnings are easier to read and more useful during debugging
51+
752
## [2.2.5] - 2026-04-04
853

954
This release continues the stable 2.x line with error UX polish, clearer
@@ -14,13 +59,18 @@ typing cleanup across the runtime path.
1459

1560
- Added `CellErrorMap` and `RowIssueMap` as richer workbook-facing error access
1661
containers while preserving 2.x dict-like compatibility
62+
- Added structured error records and API-friendly payload helpers through
63+
`records()` and `to_api_payload()` on both `CellErrorMap` and `RowIssueMap`
1764
- Added `docs/getting-started.md` to give new users one clear entry point for
1865
installation, schema declaration, workflow setup, and backend configuration
1966
- Added `docs/examples-showcase.md` and example-output assets so examples can
2067
be browsed as a lightweight showcase instead of only as source code
2168
- Added more business-oriented examples, including employee import,
2269
create-or-update import, export workflow, selection-heavy forms, and
2370
date/range field workflows
71+
- Added a minimal FastAPI reference project with separate route, service,
72+
storage, and schema modules so teams can start from a copyable backend
73+
layout instead of only single-file examples
2474
- Added stronger smoke scripts and release checks for installed packages,
2575
repository examples, and generated example-output assets
2676

@@ -34,6 +84,9 @@ typing cleanup across the runtime path.
3484
output and clearer equality semantics
3585
- Normalized common validation messages into more natural, workbook-facing
3686
English such as `This field is required`
87+
- Made common field-type validation messages more business-oriented by adding
88+
expected-format hints for date, date-range, number-range, email, phone,
89+
URL, and configured-selection fields
3790
- Clarified `FieldMetaInfo` as a compatibility facade over layered metadata
3891
objects and moved more internal consumers and codecs onto `declared`,
3992
`runtime`, `presentation`, and `constraints`
@@ -44,6 +97,8 @@ typing cleanup across the runtime path.
4497
public API, migrations, examples, showcase, and PyPI-facing README content
4598
- Expanded `examples/README.md` into a recommended reading order with expected
4699
outputs and captured example artifacts
100+
- Expanded the examples docs and showcase so the new FastAPI reference project
101+
is linked from GitHub README, PyPI README, and the examples showcase page
47102

48103
### Fixed
49104

README-pypi.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ ExcelAlchemy turns Pydantic models into typed workbook contracts:
1010
- render workbook-facing output in `zh-CN` or `en`
1111
- keep storage pluggable through `ExcelStorage`
1212

13-
The current stable release is `2.2.5`, which continues the 2.x line with richer import-failure feedback, clearer documentation entry points, stronger examples, and stronger smoke coverage.
13+
The current stable release is `2.2.6`, which continues the 2.x line with stronger result-object guidance, a copyable FastAPI reference project, more robust smoke verification, and clearer codec fallback diagnostics.
1414

15-
[GitHub Repository](https://github.com/RayCarterLab/ExcelAlchemy) · [Full README](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/README.md) · [Getting Started](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/getting-started.md) · [Examples Showcase](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/examples-showcase.md) · [Architecture](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/architecture.md) · [Migration Notes](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/MIGRATIONS.md)
15+
[GitHub Repository](https://github.com/RayCarterLab/ExcelAlchemy) · [Full README](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/README.md) · [Getting Started](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/getting-started.md) · [Result Objects](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/result-objects.md) · [Examples Showcase](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/examples-showcase.md) · [Architecture](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/architecture.md) · [Migration Notes](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/MIGRATIONS.md)
1616

1717
## Screenshots
1818

@@ -111,11 +111,38 @@ Full captured outputs:
111111
- [export-workflow.txt](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/export-workflow.txt)
112112
- [date-and-range-fields.txt](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/date-and-range-fields.txt)
113113
- [selection-fields.txt](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/selection-fields.txt)
114+
- [fastapi-reference.txt](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/fastapi-reference.txt)
114115

115116
For a single GitHub page that combines screenshots, representative workflows,
116117
and captured outputs, see the
117118
[Examples Showcase](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/examples-showcase.md).
118119

120+
If you want a copyable FastAPI-oriented reference layout rather than a single
121+
example script, see the
122+
[FastAPI reference project](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/fastapi_reference/README.md).
123+
124+
## Error Feedback
125+
126+
ExcelAlchemy keeps workbook-facing validation feedback readable while also
127+
supporting API-friendly inspection in application code.
128+
129+
The stable 2.x result surface includes:
130+
131+
- `alchemy.cell_error_map`
132+
- `alchemy.row_error_map`
133+
134+
These objects remain dict-like for compatibility, but also expose helpers such
135+
as:
136+
137+
- `messages_at(...)`
138+
- `messages_for_row(...)`
139+
- `flatten()`
140+
- `to_api_payload()`
141+
142+
Common field types now also produce more business-oriented error wording, such
143+
as expected date formats, sample email/phone/URL formats, and clearer messages
144+
for configured selection fields.
145+
119146
## Why ExcelAlchemy
120147

121148
- Pydantic v2-based schema extraction and validation

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
![Lint](https://img.shields.io/badge/lint-ruff-D7FF64)
77
![Typing](https://img.shields.io/badge/typing-pyright-2C6BED)
88

9-
[中文 README](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/README_cn.md) · [About](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/ABOUT.md) · [Getting Started](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/getting-started.md) · [Architecture](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/architecture.md) · [Examples Showcase](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/examples-showcase.md) · [Public API](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/public-api.md) · [Locale Policy](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/locale.md) · [Changelog](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/CHANGELOG.md) · [Migration Notes](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/MIGRATIONS.md)
9+
[中文 README](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/README_cn.md) · [About](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/ABOUT.md) · [Getting Started](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/getting-started.md) · [Result Objects](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/result-objects.md) · [Architecture](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/architecture.md) · [Examples Showcase](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/examples-showcase.md) · [Public API](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/public-api.md) · [Locale Policy](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/locale.md) · [Changelog](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/CHANGELOG.md) · [Migration Notes](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/MIGRATIONS.md)
1010

1111
ExcelAlchemy is a schema-driven Python library for Excel import and export workflows.
1212
It turns Pydantic models into typed workbook contracts: generate templates, validate uploads, map failures back to rows
@@ -16,7 +16,7 @@ This repository is also a design artifact.
1616
It documents a series of deliberate engineering choices: `src/` layout, Pydantic v2 migration, pandas removal,
1717
pluggable storage, `uv`-based workflows, and locale-aware workbook output.
1818

19-
The current stable release is `2.2.5`, which continues the ExcelAlchemy 2.x line with richer import-failure feedback, clearer getting-started and public-API guidance, stronger real-world examples, and stronger release smoke coverage.
19+
The current stable release is `2.2.6`, which continues the ExcelAlchemy 2.x line with stronger result-object guidance, a copyable FastAPI reference project, more robust release smoke verification, and clearer codec fallback diagnostics.
2020

2121
## At a Glance
2222

@@ -186,6 +186,7 @@ Practical examples live in the repository:
186186
- [`examples/export_workflow.py`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/export_workflow.py)
187187
- [`examples/minio_storage.py`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/minio_storage.py)
188188
- [`examples/fastapi_upload.py`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/fastapi_upload.py)
189+
- [`examples/fastapi_reference/README.md`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/fastapi_reference/README.md)
189190
- [`examples/README.md`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/README.md)
190191

191192
If you want the recommended reading order, start with
@@ -231,6 +232,7 @@ Full captured outputs:
231232
- [`files/example-outputs/selection-fields.txt`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/selection-fields.txt)
232233
- [`files/example-outputs/custom-storage.txt`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/custom-storage.txt)
233234
- [`files/example-outputs/annotated-schema.txt`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/annotated-schema.txt)
235+
- [`files/example-outputs/fastapi-reference.txt`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/fastapi-reference.txt)
234236

235237
## Public API Boundaries
236238

@@ -257,6 +259,39 @@ The older aliases:
257259
still work in the 2.x line as compatibility paths, but new application code
258260
should use the clearer names above.
259261

262+
## Structured Error Access
263+
264+
Import failures are now easier to inspect programmatically.
265+
266+
- `alchemy.cell_error_map`
267+
- `alchemy.row_error_map`
268+
269+
Both containers remain dict-like for 2.x compatibility, but they also expose
270+
clearer helper methods for application code and API handlers:
271+
272+
- `at(...)`
273+
- `messages_at(...)`
274+
- `messages_for_row(...)`
275+
- `numbered_messages_for_row(...)`
276+
- `flatten()`
277+
- `to_dict()`
278+
- `to_api_payload()`
279+
280+
This makes it easier to:
281+
282+
- build frontend-friendly validation responses
283+
- render row-level and cell-level failure summaries
284+
- keep workbook feedback and API feedback aligned
285+
286+
Common field types also provide more business-oriented validation wording. For
287+
example:
288+
289+
- date fields now mention the expected date format
290+
- date range and number range fields now mention the expected combined input
291+
- email, phone number, and URL fields now include example formats
292+
- selection, organization, and staff fields now mention that values must come
293+
from the configured options
294+
260295
## Locale-Aware Workbook Output
261296

262297
`locale` affects workbook-facing display text such as:

README_cn.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# ExcelAlchemy
22

3-
[English README](./README.md) · [项目说明](./ABOUT.md) · [架构文档](./docs/architecture.md) · [Locale Policy](./docs/locale.md) · [Changelog](./CHANGELOG.md) · [迁移说明](./MIGRATIONS.md)
3+
[English README](./README.md) · [项目说明](./ABOUT.md) · [快速开始](./docs/getting-started.md) · [结果对象](./docs/result-objects.md) · [架构文档](./docs/architecture.md) · [Locale Policy](./docs/locale.md) · [Changelog](./CHANGELOG.md) · [迁移说明](./MIGRATIONS.md)
44

55
ExcelAlchemy 是一个面向 Excel 导入导出的 schema-first Python 库。
66
它的核心思路不是“读写表格文件”,而是“把 Excel 当成一种带约束的业务契约”。
77

8-
当前稳定发布版本是 `2.2.5`,它在稳定的 ExcelAlchemy 2.x 线上继续加强了导入失败反馈、更清晰的入门与 public API 文档、更贴近真实业务的示例,以及更强的 release smoke 验证。
8+
当前稳定发布版本是 `2.2.6`,它在稳定的 ExcelAlchemy 2.x 线上继续加强了结果对象与接入说明、可复制的 FastAPI 参考项目、更稳的 release smoke 验证,以及更清晰的 codec fallback 诊断信息
99

1010
你用 Pydantic 模型定义结构,用 `FieldMeta` 定义 Excel 元数据,用显式的导入/导出流程去完成模板生成、数据校验、错误回写和后端集成。
1111

@@ -115,6 +115,7 @@ pip install "ExcelAlchemy[minio]"
115115
- [`examples/export_workflow.py`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/export_workflow.py)
116116
- [`examples/minio_storage.py`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/minio_storage.py)
117117
- [`examples/fastapi_upload.py`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/fastapi_upload.py)
118+
- [`examples/fastapi_reference/README.md`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/fastapi_reference/README.md)
118119
- [`examples/README.md`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/README.md)
119120

120121
如果你想按推荐顺序来阅读,建议先看
@@ -161,6 +162,7 @@ Uploaded objects: ['employees-export-upload.xlsx']
161162
- [`files/example-outputs/selection-fields.txt`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/selection-fields.txt)
162163
- [`files/example-outputs/custom-storage.txt`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/custom-storage.txt)
163164
- [`files/example-outputs/annotated-schema.txt`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/annotated-schema.txt)
165+
- [`files/example-outputs/fastapi-reference.txt`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/fastapi-reference.txt)
164166

165167
## 快速开始
166168

@@ -270,6 +272,36 @@ alchemy = ExcelAlchemy(ExporterConfig(Importer, storage=InMemoryExcelStorage()))
270272

271273
在 2.x 里仍然可用,用于兼容旧代码;但新代码建议统一使用前面这组更明确的名字。
272274

275+
## 结构化错误读取
276+
277+
现在导入失败不仅能回写到 workbook,也更适合被后端服务和前端界面读取。
278+
279+
- `alchemy.cell_error_map`
280+
- `alchemy.row_error_map`
281+
282+
这两个对象在 2.x 中仍然保持 dict 兼容,但同时提供了更适合业务代码使用的辅助方法:
283+
284+
- `at(...)`
285+
- `messages_at(...)`
286+
- `messages_for_row(...)`
287+
- `numbered_messages_for_row(...)`
288+
- `flatten()`
289+
- `to_dict()`
290+
- `to_api_payload()`
291+
292+
这意味着你可以更容易地:
293+
294+
- 构造前端可直接消费的校验响应
295+
- 渲染按行和按单元格的失败摘要
296+
- 保持 workbook 提示和 API 提示的一致性
297+
298+
常见字段类型的错误提示也更贴近业务语义了,例如:
299+
300+
- 日期字段会直接提示期望的日期格式
301+
- 日期区间和数值区间字段会提示期望的组合输入格式
302+
- 邮箱、手机号、URL 会给出更自然的示例格式
303+
- 选项、组织、人员类字段会明确提示“必须来自配置项”
304+
273305
## 为什么这样设计
274306

275307
### 为什么去掉 pandas

docs/examples-showcase.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ It complements the repository examples by surfacing the most representative
66
workflows, screenshots, and fixed outputs in one place. If you want the full
77
guided path through the examples directory, start with
88
[`examples/README.md`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/README.md).
9+
If you want to see how import results and error maps are meant to be surfaced
10+
through backend APIs, see
11+
[`docs/result-objects.md`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/docs/result-objects.md).
912

1013
## What ExcelAlchemy Looks Like
1114

@@ -119,6 +122,8 @@ If you want to see how ExcelAlchemy fits into backend systems:
119122
- [`examples/minio_storage.py`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/minio_storage.py)
120123
- FastAPI integration:
121124
- [`examples/fastapi_upload.py`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/fastapi_upload.py)
125+
- [`examples/fastapi_reference/README.md`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/fastapi_reference/README.md)
126+
- [`files/example-outputs/fastapi-reference.txt`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/files/example-outputs/fastapi-reference.txt)
122127

123128
## Recommended Reading Order
124129

@@ -134,6 +139,7 @@ showcase:
134139
7. [`examples/selection_fields.py`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/selection_fields.py)
135140
8. [`examples/minio_storage.py`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/minio_storage.py)
136141
9. [`examples/fastapi_upload.py`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/fastapi_upload.py)
142+
10. [`examples/fastapi_reference/README.md`](https://github.com/RayCarterLab/ExcelAlchemy/blob/main/examples/fastapi_reference/README.md)
137143

138144
Or start with the dedicated guide:
139145

0 commit comments

Comments
 (0)