Hello community,
here is the log from the commit of package python-Flask-Compress for
openSUSE:Leap:15.2 checked in at 2020-05-25 13:42:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-Flask-Compress (Old)
and /work/SRC/openSUSE:Leap:15.2/.python-Flask-Compress.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Flask-Compress"
Mon May 25 13:42:46 2020 rev:3 rq:808620 version:1.5.0
Changes:
--------
---
/work/SRC/openSUSE:Leap:15.2/python-Flask-Compress/python-Flask-Compress.changes
2020-01-15 15:45:59.439342146 +0100
+++
/work/SRC/openSUSE:Leap:15.2/.python-Flask-Compress.new.2738/python-Flask-Compress.changes
2020-05-25 13:43:08.507470531 +0200
@@ -1,0 +2,20 @@
+Sat May 2 19:53:59 UTC 2020 - Arun Persaud <[email protected]>
+
+- specfile:
+ * update copyright year
+ * be more specifc in %files section
+ * upate project url
+ * remove devel requirement
+ * require python-Brotli for tests
+
+- update to version 1.5.0:
+ * Added brotli compression
+ * Added tests
+ * setup.py: Update url
+ * Fix PyPI rendering of long_description
+ * Use request instead of response in cache key callable and ensure
+ cache works as expected without always compressing content.
+ * Fix indentation in README
+ * Added copyright header to flask_compress.py
+
+-------------------------------------------------------------------
Old:
----
Flask-Compress-1.4.0.tar.gz
New:
----
Flask-Compress-1.5.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-Flask-Compress.spec ++++++
--- /var/tmp/diff_new_pack.kaqZ7a/_old 2020-05-25 13:43:08.823471221 +0200
+++ /var/tmp/diff_new_pack.kaqZ7a/_new 2020-05-25 13:43:08.823471221 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-Flask-Compress
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2016, Martin Hauke <[email protected]>
#
# All modifications and additions to the file contributed by third parties
@@ -13,29 +13,28 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-Flask-Compress
-Version: 1.4.0
+Version: 1.5.0
Release: 0
Summary: Compress responses in Flask apps with gzip
License: MIT
Group: Development/Languages/Python
-Url: https://libwilliam.github.io/flask-compress/
+URL: https://github.com/colour-science/flask-compress
Source:
https://files.pythonhosted.org/packages/source/F/Flask-Compress/Flask-Compress-%{version}.tar.gz
-BuildRequires: %{python_module devel}
+BuildRequires: %{python_module Brotli}
BuildRequires: %{python_module setuptools}
+BuildRequires: fdupes
BuildRequires: python-rpm-macros
+Requires: python-Flask
+BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module Flask}
# /SECTION
-BuildRequires: fdupes
-Requires: python-Flask
-BuildArch: noarch
-
%python_subpackages
%description
@@ -62,6 +61,8 @@
%files %{python_files}
%doc README.md
%license LICENSE.txt
-%{python_sitelib}/*
+%{python_sitelib}/flask_compress.py*
+%{python_sitelib}/Flask_Compress-%{version}-py*.egg-info
+%pycache_only %{python_sitelib}/__pycache__
%changelog
++++++ Flask-Compress-1.4.0.tar.gz -> Flask-Compress-1.5.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Flask-Compress-1.4.0/Flask_Compress.egg-info/PKG-INFO
new/Flask-Compress-1.5.0/Flask_Compress.egg-info/PKG-INFO
--- old/Flask-Compress-1.4.0/Flask_Compress.egg-info/PKG-INFO 2017-01-05
00:37:12.000000000 +0100
+++ new/Flask-Compress-1.5.0/Flask_Compress.egg-info/PKG-INFO 2020-04-27
09:10:49.000000000 +0200
@@ -1,12 +1,94 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
Name: Flask-Compress
-Version: 1.4.0
-Summary: Compress responses in your Flask app with gzip.
-Home-page: https://libwilliam.github.io/flask-compress/
-Author: William Fagan
-Author-email: [email protected]
+Version: 1.5.0
+Summary: Compress responses in your Flask app with gzip or brotli.
+Home-page: https://github.com/colour-science/flask-compress
+Author: Thomas Mansencal
+Author-email: [email protected]
License: MIT
-Description: Full documentation can be found on the Flask-Compress "Home Page".
+Description: # Flask-Compress
+
+
[](https://pypi.python.org/pypi/Flask-Compress)
+ [](https://travis-ci.org/libwilliam/flask-compress)
+
[](https://coveralls.io/github/libwilliam/flask-compress)
+
[](https://github.com/libwilliam/flask-compress/blob/master/LICENSE.txt)
+
+ Flask-Compress allows you to easily compress your
[Flask](http://flask.pocoo.org/) application's responses with gzip.
+
+ The preferred solution is to have a server (like
[Nginx](http://wiki.nginx.org/Main)) automatically compress the static files
for you. If you don't have that option Flask-Compress will solve the problem
for you.
+
+
+ ## How it works
+
+ Flask-Compress both adds the various headers required for a compressed
response and gzips the response data. This makes serving gzip compressed static
files extremely easy.
+
+ Internally, every time a request is made the extension will check if
it matches one of the compressible MIME types and will automatically attach the
appropriate headers.
+
+
+ ## Installation
+
+ If you use pip then installation is simply:
+
+ ```shell
+ $ pip install flask-compress
+ ```
+
+ or, if you want the latest github version:
+
+ ```shell
+ $ pip install git+git://github.com/colour-science/flask-compress.git
+ ```
+
+ You can also install Flask-Compress via Easy Install:
+
+ ```shell
+ $ easy_install flask-compress
+ ```
+
+
+ ## Using Flask-Compress
+
+ Flask-Compress is incredibly simple to use. In order to start gzip'ing
your Flask application's assets, the first thing to do is let Flask-Compress
know about your
[`flask.Flask`](http://flask.pocoo.org/docs/latest/api/#flask.Flask)
application object.
+
+ ```python
+ from flask import Flask
+ from flask_compress import Compress
+
+ app = Flask(__name__)
+ Compress(app)
+ ```
+
+ In many cases, however, one cannot expect a Flask instance to be ready
at import time, and a common pattern is to return a Flask instance from within
a function only after other configuration details have been taken care of. In
these cases, Flask-Compress provides a simple function,
`flask_compress.Compress.init_app`, which takes your application as an argument.
+
+ ```python
+ from flask import Flask
+ from flask_compress import Compress
+
+ compress = Compress()
+
+ def start_app():
+ app = Flask(__name__)
+ compress.init_app(app)
+ return app
+ ```
+
+ In terms of automatically compressing your assets using gzip, passing
your [`flask.Flask`](http://flask.pocoo.org/docs/latest/api/#flask.Flask)
object to the `flask_compress.Compress` object is all that needs to be done.
+
+
+ ## Options
+
+ Within your Flask application's settings you can provide the following
settings to control the behavior of Flask-Compress. None of the settings are
required.
+
+ | Option | Description | Default |
+ | ------ | ----------- | ------- |
+ | `COMPRESS_MIMETYPES` | Set the list of mimetypes to compress here. |
`[`<br>`'text/html',`<br>`'text/css',`<br>`'text/xml',`<br>`'application/json',`<br>`'application/javascript'`<br>`]`
|
+ | `COMPRESS_LEVEL` | Specifies the gzip compression level. | `6` |
+ | `COMPRESS_MIN_SIZE` | Specifies the minimum file size threshold for
compressing files. | `500` |
+ | `COMPRESS_CACHE_KEY` | Specifies the cache key method for
lookup/storage of response data. | `None` |
+ | `COMPRESS_CACHE_BACKEND` | Specified the backend for storing the
cached response data. | `None` |
+ | `COMPRESS_REGISTER` | Specifies if compression should be
automatically registered. | `True` |
+ | `COMPRESS_ALGORITHM` | Compression algorithm used: `gzip` or `br`. |
`gzip` |
+
Platform: any
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
@@ -22,3 +104,4 @@
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Description-Content-Type: text/markdown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Flask-Compress-1.4.0/Flask_Compress.egg-info/requires.txt
new/Flask-Compress-1.5.0/Flask_Compress.egg-info/requires.txt
--- old/Flask-Compress-1.4.0/Flask_Compress.egg-info/requires.txt
2017-01-05 00:37:12.000000000 +0100
+++ new/Flask-Compress-1.5.0/Flask_Compress.egg-info/requires.txt
2020-04-27 09:10:49.000000000 +0200
@@ -1 +1,2 @@
-Flask
+flask
+brotli
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-Compress-1.4.0/LICENSE.txt
new/Flask-Compress-1.5.0/LICENSE.txt
--- old/Flask-Compress-1.4.0/LICENSE.txt 2017-01-04 23:22:33.000000000
+0100
+++ new/Flask-Compress-1.5.0/LICENSE.txt 2020-04-21 09:38:27.000000000
+0200
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2013-2016 William Fagan
+Copyright (c) 2013-2017 William Fagan
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-Compress-1.4.0/PKG-INFO
new/Flask-Compress-1.5.0/PKG-INFO
--- old/Flask-Compress-1.4.0/PKG-INFO 2017-01-05 00:37:12.000000000 +0100
+++ new/Flask-Compress-1.5.0/PKG-INFO 2020-04-27 09:10:49.000000000 +0200
@@ -1,12 +1,94 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
Name: Flask-Compress
-Version: 1.4.0
-Summary: Compress responses in your Flask app with gzip.
-Home-page: https://libwilliam.github.io/flask-compress/
-Author: William Fagan
-Author-email: [email protected]
+Version: 1.5.0
+Summary: Compress responses in your Flask app with gzip or brotli.
+Home-page: https://github.com/colour-science/flask-compress
+Author: Thomas Mansencal
+Author-email: [email protected]
License: MIT
-Description: Full documentation can be found on the Flask-Compress "Home Page".
+Description: # Flask-Compress
+
+
[](https://pypi.python.org/pypi/Flask-Compress)
+ [](https://travis-ci.org/libwilliam/flask-compress)
+
[](https://coveralls.io/github/libwilliam/flask-compress)
+
[](https://github.com/libwilliam/flask-compress/blob/master/LICENSE.txt)
+
+ Flask-Compress allows you to easily compress your
[Flask](http://flask.pocoo.org/) application's responses with gzip.
+
+ The preferred solution is to have a server (like
[Nginx](http://wiki.nginx.org/Main)) automatically compress the static files
for you. If you don't have that option Flask-Compress will solve the problem
for you.
+
+
+ ## How it works
+
+ Flask-Compress both adds the various headers required for a compressed
response and gzips the response data. This makes serving gzip compressed static
files extremely easy.
+
+ Internally, every time a request is made the extension will check if
it matches one of the compressible MIME types and will automatically attach the
appropriate headers.
+
+
+ ## Installation
+
+ If you use pip then installation is simply:
+
+ ```shell
+ $ pip install flask-compress
+ ```
+
+ or, if you want the latest github version:
+
+ ```shell
+ $ pip install git+git://github.com/colour-science/flask-compress.git
+ ```
+
+ You can also install Flask-Compress via Easy Install:
+
+ ```shell
+ $ easy_install flask-compress
+ ```
+
+
+ ## Using Flask-Compress
+
+ Flask-Compress is incredibly simple to use. In order to start gzip'ing
your Flask application's assets, the first thing to do is let Flask-Compress
know about your
[`flask.Flask`](http://flask.pocoo.org/docs/latest/api/#flask.Flask)
application object.
+
+ ```python
+ from flask import Flask
+ from flask_compress import Compress
+
+ app = Flask(__name__)
+ Compress(app)
+ ```
+
+ In many cases, however, one cannot expect a Flask instance to be ready
at import time, and a common pattern is to return a Flask instance from within
a function only after other configuration details have been taken care of. In
these cases, Flask-Compress provides a simple function,
`flask_compress.Compress.init_app`, which takes your application as an argument.
+
+ ```python
+ from flask import Flask
+ from flask_compress import Compress
+
+ compress = Compress()
+
+ def start_app():
+ app = Flask(__name__)
+ compress.init_app(app)
+ return app
+ ```
+
+ In terms of automatically compressing your assets using gzip, passing
your [`flask.Flask`](http://flask.pocoo.org/docs/latest/api/#flask.Flask)
object to the `flask_compress.Compress` object is all that needs to be done.
+
+
+ ## Options
+
+ Within your Flask application's settings you can provide the following
settings to control the behavior of Flask-Compress. None of the settings are
required.
+
+ | Option | Description | Default |
+ | ------ | ----------- | ------- |
+ | `COMPRESS_MIMETYPES` | Set the list of mimetypes to compress here. |
`[`<br>`'text/html',`<br>`'text/css',`<br>`'text/xml',`<br>`'application/json',`<br>`'application/javascript'`<br>`]`
|
+ | `COMPRESS_LEVEL` | Specifies the gzip compression level. | `6` |
+ | `COMPRESS_MIN_SIZE` | Specifies the minimum file size threshold for
compressing files. | `500` |
+ | `COMPRESS_CACHE_KEY` | Specifies the cache key method for
lookup/storage of response data. | `None` |
+ | `COMPRESS_CACHE_BACKEND` | Specified the backend for storing the
cached response data. | `None` |
+ | `COMPRESS_REGISTER` | Specifies if compression should be
automatically registered. | `True` |
+ | `COMPRESS_ALGORITHM` | Compression algorithm used: `gzip` or `br`. |
`gzip` |
+
Platform: any
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
@@ -22,3 +104,4 @@
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Description-Content-Type: text/markdown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-Compress-1.4.0/README.md
new/Flask-Compress-1.5.0/README.md
--- old/Flask-Compress-1.4.0/README.md 2017-01-05 00:22:00.000000000 +0100
+++ new/Flask-Compress-1.5.0/README.md 2020-04-21 10:36:48.000000000 +0200
@@ -28,7 +28,7 @@
or, if you want the latest github version:
```shell
-$ pip install git+git://github.com/libwilliam/flask-compress.git
+$ pip install git+git://github.com/colour-science/flask-compress.git
```
You can also install Flask-Compress via Easy Install:
@@ -59,7 +59,7 @@
compress = Compress()
def start_app():
- app = Flask(__name__)
+ app = Flask(__name__)
compress.init_app(app)
return app
```
@@ -79,3 +79,4 @@
| `COMPRESS_CACHE_KEY` | Specifies the cache key method for lookup/storage of
response data. | `None` |
| `COMPRESS_CACHE_BACKEND` | Specified the backend for storing the cached
response data. | `None` |
| `COMPRESS_REGISTER` | Specifies if compression should be automatically
registered. | `True` |
+| `COMPRESS_ALGORITHM` | Compression algorithm used: `gzip` or `br`. | `gzip` |
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-Compress-1.4.0/flask_compress.py
new/Flask-Compress-1.5.0/flask_compress.py
--- old/Flask-Compress-1.4.0/flask_compress.py 2017-01-05 00:16:40.000000000
+0100
+++ new/Flask-Compress-1.5.0/flask_compress.py 2020-04-21 09:38:27.000000000
+0200
@@ -1,7 +1,13 @@
+
+# Authors: William Fagan
+# Copyright (c) 2013-2017 William Fagan
+# License: The MIT License (MIT)
+
import sys
from gzip import GzipFile
from io import BytesIO
+import brotli
from flask import request, current_app
@@ -62,6 +68,7 @@
('COMPRESS_CACHE_KEY', None),
('COMPRESS_CACHE_BACKEND', None),
('COMPRESS_REGISTER', True),
+ ('COMPRESS_ALGORITHM', 'gzip'),
]
for k, v in defaults:
@@ -80,7 +87,8 @@
accept_encoding = request.headers.get('Accept-Encoding', '')
if (response.mimetype not in app.config['COMPRESS_MIMETYPES'] or
- 'gzip' not in accept_encoding.lower() or
+ ('gzip' not in accept_encoding.lower() and
app.config['COMPRESS_ALGORITHM'] == 'gzip') or
+ ('br' not in accept_encoding.lower() and
app.config['COMPRESS_ALGORITHM'] == 'br') or
not 200 <= response.status_code < 300 or
(response.content_length is not None and
response.content_length < app.config['COMPRESS_MIN_SIZE']) or
@@ -90,15 +98,17 @@
response.direct_passthrough = False
if self.cache:
- key = self.cache_key(response)
- gzip_content = self.cache.get(key) or self.compress(app, response)
- self.cache.set(key, gzip_content)
+ key = self.cache_key(request)
+ compressed_content = self.cache.get(key)
+ if compressed_content is None:
+ compressed_content = self.compress(app, response)
+ self.cache.set(key, compressed_content)
else:
- gzip_content = self.compress(app, response)
+ compressed_content = self.compress(app, response)
- response.set_data(gzip_content)
+ response.set_data(compressed_content)
- response.headers['Content-Encoding'] = 'gzip'
+ response.headers['Content-Encoding'] = app.config['COMPRESS_ALGORITHM']
response.headers['Content-Length'] = response.content_length
vary = response.headers.get('Vary')
@@ -111,9 +121,12 @@
return response
def compress(self, app, response):
- gzip_buffer = BytesIO()
- with GzipFile(mode='wb',
- compresslevel=app.config['COMPRESS_LEVEL'],
- fileobj=gzip_buffer) as gzip_file:
- gzip_file.write(response.get_data())
- return gzip_buffer.getvalue()
+ if app.config['COMPRESS_ALGORITHM'] == 'gzip':
+ gzip_buffer = BytesIO()
+ with GzipFile(mode='wb',
+ compresslevel=app.config['COMPRESS_LEVEL'],
+ fileobj=gzip_buffer) as gzip_file:
+ gzip_file.write(response.get_data())
+ return gzip_buffer.getvalue()
+ elif app.config['COMPRESS_ALGORITHM'] == 'br':
+ return brotli.compress(response.get_data())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-Compress-1.4.0/setup.cfg
new/Flask-Compress-1.5.0/setup.cfg
--- old/Flask-Compress-1.4.0/setup.cfg 2017-01-05 00:37:12.000000000 +0100
+++ new/Flask-Compress-1.5.0/setup.cfg 2020-04-27 09:10:49.000000000 +0200
@@ -1,5 +1,4 @@
[egg_info]
tag_build =
tag_date = 0
-tag_svn_revision = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-Compress-1.4.0/setup.py
new/Flask-Compress-1.5.0/setup.py
--- old/Flask-Compress-1.4.0/setup.py 2017-01-05 00:18:32.000000000 +0100
+++ new/Flask-Compress-1.5.0/setup.py 2020-04-27 09:06:00.000000000 +0200
@@ -1,20 +1,25 @@
import setuptools
+with open('README.md') as fl:
+ LONG_DESCRIPTION = fl.read()
+
setuptools.setup(
name='Flask-Compress',
- version='1.4.0',
- url='https://libwilliam.github.io/flask-compress/',
+ version='1.5.0',
+ url='https://github.com/colour-science/flask-compress',
license='MIT',
- author='William Fagan',
- author_email='[email protected]',
- description='Compress responses in your Flask app with gzip.',
- long_description='Full documentation can be found on the Flask-Compress
"Home Page".',
+ author='Thomas Mansencal',
+ author_email='[email protected]',
+ description='Compress responses in your Flask app with gzip or brotli.',
+ long_description=LONG_DESCRIPTION,
+ long_description_content_type='text/markdown',
py_modules=['flask_compress'],
zip_safe=False,
include_package_data=True,
platforms='any',
install_requires=[
- 'Flask'
+ 'flask',
+ 'brotli'
],
test_suite='tests',
classifiers=[
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Flask-Compress-1.4.0/tests/test_flask_compress.py
new/Flask-Compress-1.5.0/tests/test_flask_compress.py
--- old/Flask-Compress-1.4.0/tests/test_flask_compress.py 2017-01-04
23:22:33.000000000 +0100
+++ new/Flask-Compress-1.5.0/tests/test_flask_compress.py 2020-04-21
09:38:27.000000000 +0200
@@ -27,6 +27,10 @@
""" Tests COMPRESS_MIN_SIZE default value is correctly set. """
self.assertEqual(self.app.config['COMPRESS_MIN_SIZE'], 500)
+ def test_algorithm_default(self):
+ """ Tests COMPRESS_ALGORITHM default value is correctly set. """
+ self.assertEqual(self.app.config['COMPRESS_ALGORITHM'], 'gzip')
+
class InitTests(unittest.TestCase):
def setUp(self):
@@ -71,6 +75,16 @@
self.assertEqual(response.status_code, 200)
return response
+ def test_br_algorithm(self):
+ client = self.app.test_client()
+ headers = [('Accept-Encoding', 'br')]
+
+ response = client.options('/small/', headers=headers)
+ self.assertEqual(response.status_code, 200)
+
+ response = client.options('/large/', headers=headers)
+ self.assertEqual(response.status_code, 200)
+
def test_compress_level(self):
""" Tests COMPRESS_LEVEL correctly affects response data. """
self.app.config['COMPRESS_LEVEL'] = 1