Visitar URL original
Use `backports.zstd` on Python 3.13 and earlier by Kludex · Pull Request #1146 · pydantic/httpx2 · GitHub
Skip to content

Use backports.zstd on Python 3.13 and earlier - #1146

Merged
Kludex merged 1 commit into
mainfrom
use-backports-zstd
Aug 18, 2026
Merged

Kludex merged 1 commit into
mainfrom
use-backports-zstd

Conversation

@Kludex

@Kludex Kludex commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • replace the zstandard dependency with backports.zstd on Python 3.13 and earlier
  • use the same ZstdDecompressor API as compression.zstd on Python 3.14+
  • update the dependency documentation

Motivation

backports.zstd mirrors the standard library API, including bounded incremental decompression. This provides a common decoder interface for PR #1126.

Validation

  • scripts/check
  • scripts/test && scripts/coverage - 1,981 passed, 1 skipped, 100% coverage
  • decoder tests on Python 3.13 and 3.14 - 45 passed on each

AI Disclaimer

This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.

Review in cubic

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@github-actions

Copy link
Copy Markdown

@codspeed

codspeed Bot commented Aug 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 17 untouched benchmarks
⏩ 7 skipped benchmarks1


Comparing use-backports-zstd (ced985b) with main (2b13fa9)

Open in CodSpeed

Footnotes

  1. 7 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

Re-trigger cubic

@Kludex
Kludex enabled auto-merge (squash) August 18, 2026 11:44
@Kludex
Kludex merged commit d588e52 into main Aug 18, 2026
19 checks passed
@Kludex
Kludex deleted the use-backports-zstd branch August 18, 2026 11:45
@Rogdham

Rogdham commented Aug 23, 2026

Copy link
Copy Markdown

A few weeks ago I was wondering if I should migrate my PRs from httpx to httpx2, but decided against it because the bug in zstd was already fixed in httpx2 and conditioning the zstandard dependency on Python version has been included as well.

Well, that's my bad, I should have done it to avoid you the trouble of opening this PR. But thank you for this change ❤️

On that topic, feel free to reach out if you need help with the zstd stuff in the future. You will probably not need it, but we never know!

@Kludex

Kludex commented Aug 23, 2026 •

Copy link
Copy Markdown
Member Author

On that topic, feel free to reach out if you need help with the zstd stuff in the future. You will probably not need it, but we never know!

Nice! Thanks! ❤️

I should have done it to avoid you the trouble of opening this PR [...]

I think opening myself gave me context on why this is a good idea, so we are good. 😄

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Aug 25, 2026
## 2.12.0 (August 18th, 2026)

### Changed

* Use `backports.zstd` for Zstandard decoding on Python 3.13 and earlier.
  ([#1146](pydantic/httpx2#1146))

### Fixed

* Bound peak memory while streaming compressed responses and close response streams when decoding fails.
  ([#1126](pydantic/httpx2#1126))

## 2.11.0 (August 18th, 2026)

### Added

* Add the public `Origin` value object and `URL.origin` property for normalized,
  hashable origin comparisons. ([#1134](pydantic/httpx2#1134))

### Changed

* Require Brotli 1.2.0 or later for the `brotli` extra. ([#1141](pydantic/httpx2#1141))

### Fixed

* Restore deprecated status code aliases. ([#1135](pydantic/httpx2#1135))
* Extract HTTP/2 release notes from changelog headings correctly. ([#1136](pydantic/httpx2#1136))
* Respect explicit `Transfer-Encoding` headers and expose buffered request body lengths to WSGI applications.
  ([#1137](pydantic/httpx2#1137))
* Validate multipart part header names and values before serialization.
  ([#1142](pydantic/httpx2#1142))

This branch was previously deployed

1 inactive deployment
cloudflare — ced985b7 Deployed Aug 18, 2026 by Kludex via Docs preview (Cloudflare) #732
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants