Skip to content

Use backports.zstd instead of pyzstd #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions flask_compress/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
# When Python 3.14 is the lowest supported version,
# the `import compression.*` statements can move to `flask_compress.py`
# and this try/except block can be removed from this file.
try:
# Python >= 3.14
import sys

if sys.version_info >= (3, 14):
import compression.gzip
import compression.zlib
import compression.zstd
except ModuleNotFoundError:
# Python <= 3.13
else: # Python <= 3.13
import gzip
import types
import zlib

import pyzstd
from backports import zstd

compression = types.SimpleNamespace()
compression.gzip = gzip
compression.zlib = zlib
compression.zstd = pyzstd
compression.zstd = zstd
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"flask",
"brotli; platform_python_implementation!='PyPy'",
"brotlicffi; platform_python_implementation=='PyPy'",
"pyzstd; python_version<'3.14'",
"backports.zstd; python_version<'3.14'",
],
setup_requires=[
"setuptools_scm",
Expand Down
Loading