From 62e409be247325a198f193e67ce32b5b2d0918cc Mon Sep 17 00:00:00 2001 From: voj-tech-j Date: Sat, 15 Aug 2026 12:14:33 +0200 Subject: [PATCH 1/2] fix: correct inverted segment condition logic in docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API composes segment conditions as `(A OR B) AND (C OR D)` — conditions within a group are OR-ed, and groups are AND-ed together. The docs here stated the exact inverse. Verified against the server implementation, SegmentService::buildSegmentWhere: conditions are joined with `implode(' OR ', ...)` inside each group, and the resulting group clauses with `implode(' AND ', ...)`. The API reference and the product docs both agree. Comments only — no behaviour change. The same inversion was present in five SDKs, which suggests a shared source; each is being corrected separately. Co-Authored-By: Claude Opus 5 (1M context) --- src/lettr/_types.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lettr/_types.py b/src/lettr/_types.py index 127ea14..076914b 100644 --- a/src/lettr/_types.py +++ b/src/lettr/_types.py @@ -610,7 +610,8 @@ class AudienceSegment: """An audience segment. ``condition_groups`` is kept as a list of raw dicts mirroring the - API shape (groups joined by OR, conditions within a group joined by AND). + API shape (conditions within a group joined by OR, groups joined by + AND) -- i.e. (A OR B) AND (C OR D). """ id: str From adaf955c24a8df56e488345546d736565c60dc5b Mon Sep 17 00:00:00 2001 From: voj-tech-j Date: Sat, 15 Aug 2026 17:38:07 +0200 Subject: [PATCH 2/2] chore: release 1.5.1 Patch release carrying the segment condition docstring fix. Docstrings are what help() and IDE hover render from the installed package, so the corrected AND/OR only reaches users once a version exists on PyPI. Co-Authored-By: Claude Opus 5 (1M context) --- CHANGELOG.md | 8 +++++++- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13a3f60..8172540 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.5.1] - 2026-08-15 + +### Fixed +- Corrected the segment condition documentation on `SegmentConditionGroup`: conditions **within a group** are joined by `OR`, and **groups** are joined by `AND` — i.e. `(A OR B) AND (C OR D)`. The previous docstring stated the inverse. No behaviour change — the API has always evaluated segments this way, and no code paths were touched. Worth a read if you built a segment against the old description, since it may target a wider or narrower audience than you intended. + ## [1.5.0] - 2026-08-14 Covers the reworked bulk contact import (TPL-2105) and the duplicate-create fix. @@ -283,7 +288,8 @@ the exact same payloads. `ValidationError`, `NotFoundError`, `ConflictError`, `BadRequestError`, `ServerError`) -[Unreleased]: https://github.com/lettr/lettr-python/compare/v1.4.0...HEAD +[Unreleased]: https://github.com/lettr/lettr-python/compare/v1.5.1...HEAD +[1.5.1]: https://github.com/lettr/lettr-python/compare/v1.5.0...v1.5.1 [1.5.0]: https://github.com/lettr/lettr-python/compare/v1.4.0...v1.5.0 [1.4.0]: https://github.com/lettr/lettr-python/compare/v1.3.0...v1.4.0 [1.3.0]: https://github.com/lettr/lettr-python/compare/v1.2.0...v1.3.0 diff --git a/pyproject.toml b/pyproject.toml index 7ece0d0..4eec0f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "lettr" -version = "1.5.0" +version = "1.5.1" description = "Official Python SDK for the Lettr Email API" readme = "README.md" license = "MIT"