From d1c92a2613035f0df93db7226fd3358cb319edd4 Mon Sep 17 00:00:00 2001 From: Kurt McKee Date: Mon, 23 Sep 2024 17:48:58 -0500 Subject: [PATCH] Drop support for Python 3.8 and lower Closes #27 --- .github/workflows/ci.yaml | 12 +++++++++--- CHANGELOG.md | 4 ++++ flask_compress/flask_compress.py | 13 ------------- setup.py | 12 ++++-------- tox.ini | 5 +++-- 5 files changed, 20 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ef13d84..f241afd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,7 +17,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9'] + python-version: + - '3.9' + - '3.10' + - '3.11' + - '3.12' + - 'pypy-3.9' + - 'pypy-3.10' os: [ubuntu-latest] #, windows-latest, macos-latest] name: ${{ matrix.os }} - ${{ matrix.python-version }} @@ -49,7 +55,7 @@ jobs: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - uses: actions/setup-python@v5 with: - python-version: "3.8" + python-version: "3.12" - name: Install dependencies run: | python -m pip install --upgrade pip @@ -68,7 +74,7 @@ jobs: steps: - uses: actions/setup-python@v5 with: - python-version: "3.8" + python-version: "3.12" - name: Install dependencies run: pip install twine - uses: actions/download-artifact@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0192c80..c23dad7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `flask-compress` will be documented in this file. +## Unreleased + +- Drop support for Python 3.8 and lower. + ## 1.15 (2024-04-24) - Add support of Zstandard compression. diff --git a/flask_compress/flask_compress.py b/flask_compress/flask_compress.py index 7cfb59d..cc01118 100644 --- a/flask_compress/flask_compress.py +++ b/flask_compress/flask_compress.py @@ -3,7 +3,6 @@ # Copyright (c) 2013-2017 William Fagan # License: The MIT License (MIT) -import sys import functools from gzip import GzipFile import zlib @@ -21,18 +20,6 @@ from flask import request, after_this_request, current_app -if sys.version_info[:2] == (2, 6): - class GzipFile(GzipFile): - """ Backport of context manager support for python 2.6""" - def __enter__(self): - if self.fileobj is None: - raise ValueError("I/O operation on closed GzipFile object") - return self - - def __exit__(self, *args): - self.close() - - class DictCache(object): def __init__(self): diff --git a/setup.py b/setup.py index 2fbfb18..0e5d79c 100644 --- a/setup.py +++ b/setup.py @@ -14,9 +14,9 @@ long_description=LONG_DESCRIPTION, long_description_content_type='text/markdown', packages=find_packages(exclude=['tests']), - zip_safe=False, include_package_data=True, platforms='any', + python_requires='>=3.9', install_requires=[ 'flask', "brotli; platform_python_implementation!='PyPy'", @@ -32,14 +32,10 @@ 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', diff --git a/tox.ini b/tox.ini index 745b950..ded8d7c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,8 @@ [tox] -isolated_build = True skip_missing_interpreters = true -envlist = py27,py35,py36,py37,py38,py39,py310,py311,py312,pypy2,pypy3 +envlist = + py{39, 310, 311, 312} + pypy{39, 310} [testenv] package = wheel