From f6cb1efa8fba683bdc5c9b4a645f9357fe2e6208 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Wed, 4 Dec 2019 01:13:52 -0600 Subject: negotiate the best static asset using supported encodings --- docs/narr/assets.rst | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'docs') diff --git a/docs/narr/assets.rst b/docs/narr/assets.rst index d1d64f0c3..f9d30563e 100644 --- a/docs/narr/assets.rst +++ b/docs/narr/assets.rst @@ -189,6 +189,37 @@ listening on ``example.com`` must be itself configured to respond properly to such a request. The :meth:`~pyramid.request.Request.static_url` API is discussed in more detail later in this chapter. +.. index:: + single: pre-compressed assets + +.. _pre_compressed_assets: + +Serving Pre-compressed Assets +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.0 + +It's possible to configure :app:`Pyramid` to serve pre-compressed static assets. +This can greatly reduce the bandwidth required to serve assets - most modern browsers support ``gzip``, ``deflate``, and ``br`` (brotli) encoded responses. +A client declares support for encoded responses using the ``Accept-Encoding`` HTTP header. For example, ``Accept-Encoding: gzip, default, br``. +The response will then contain the pre-compressed content with the ``Content-Encoding`` header set to the matched encoding. +This feature assumes that the static assets exist unencoded (``identity`` encoding) as well as in zero or more encoded formats. +If the encoded version of a file is missing, or the client doesn't declare support for the encoded version, the unencoded version is returned instead. + +In order to configure this in your application, the first step is to compress your assets. +For example, update your static asset pipeline to export ``.gz`` versions of every file. +Second, add ``content_encodings=['gzip']`` when invoking :meth:`pyramid.config.Configurator.add_static_view`. + +The encoded file extensions are determined by :attr:`mimetypes.encodings_map`. +So, if your desired encoding is missing, you'll need to add it there: + +.. code-block:: python + + import mimetypes + mimetypes.encodings_map['.br'] = 'br' # add brotli + +It is not necessary for every file to support every encoding, but :app:`Pyramid` will not serve an encoding that is not declared. + .. index:: single: generating static asset urls single: static asset urls -- cgit v1.2.3 From 3f42e5f2c848e69f282337f6fbf56e69b295b58e Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 15 Dec 2019 23:14:19 -0800 Subject: Remove Python 3.4, Python 3.5, and add Python 3.8 --- docs/narr/install.rst | 6 +++--- docs/narr/logging.rst | 2 +- docs/narr/upgrading.rst | 6 +++--- docs/quick_tutorial/requirements.rst | 4 ++-- docs/tutorials/modwsgi/index.rst | 2 +- docs/tutorials/wiki/installation.rst | 2 -- docs/tutorials/wiki/tests.rst | 3 --- 7 files changed, 10 insertions(+), 15 deletions(-) (limited to 'docs') diff --git a/docs/narr/install.rst b/docs/narr/install.rst index 268ae5f8d..903769b59 100644 --- a/docs/narr/install.rst +++ b/docs/narr/install.rst @@ -5,7 +5,7 @@ Installing :app:`Pyramid` .. note:: - This installation guide emphasizes the use of Python 3.4 and greater for + This installation guide emphasizes the use of Python 3.6 and greater for simplicity. @@ -15,13 +15,13 @@ Installing :app:`Pyramid` Before You Install Pyramid -------------------------- -Install Python version 3.4 or greater for your operating system, and satisfy +Install Python version 3.6 or greater for your operating system, and satisfy the :ref:`requirements-for-installing-packages`, as described in the following sections. .. sidebar:: Python Versions - As of this writing, :app:`Pyramid` is tested against Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 (with allowed failures), and PyPy3. + As of this writing, :app:`Pyramid` is tested against Python 3.6, Python 3.7, Python 3.8, and PyPy3. :app:`Pyramid` is known to run on all popular Unix-like systems such as Linux, macOS, and FreeBSD, as well as on Windows platforms. It is also known to diff --git a/docs/narr/logging.rst b/docs/narr/logging.rst index 58bd2d4ec..844128758 100644 --- a/docs/narr/logging.rst +++ b/docs/narr/logging.rst @@ -32,7 +32,7 @@ you to send messages to :mod:`Python standard library logging package :term:`PasteDeploy` ``development.ini`` and ``production.ini`` files created when you use our cookiecutter include a basic configuration for the Python :mod:`logging` package. -These ``.ini`` file sections are passed to the `logging module's config file configuration engine `_. +These ``.ini`` file sections are passed to the `logging module's config file configuration engine `_. PasteDeploy ``.ini`` files use the Python standard library :mod:`ConfigParser format `. This is the same format used as the Python diff --git a/docs/narr/upgrading.rst b/docs/narr/upgrading.rst index af552741c..31ca6adfa 100644 --- a/docs/narr/upgrading.rst +++ b/docs/narr/upgrading.rst @@ -86,10 +86,10 @@ At the time of a Pyramid version release, each supports all versions of Python through the end of their lifespans. The end-of-life for a given version of Python is when security updates are no longer released. -- `Python 3.4 Lifespan `_ 2019-03-16 . -- `Python 3.5 Lifespan `_ 2020-09-13 . +- `Python 3.5 Lifespan `_ 2020-09-13. - `Python 3.6 Lifespan `_ 2021-12-23. -- `Python 3.7 Lifespan `_ 2023-06-27 . +- `Python 3.7 Lifespan `_ 2023-06-27. +- `Python 3.8 Lifespan `_ 2024-10-??. To determine the Python support for a specific release of Pyramid, view its ``tox.ini`` file at the root of the repository's version. diff --git a/docs/quick_tutorial/requirements.rst b/docs/quick_tutorial/requirements.rst index 2ed9b8b55..901f6134d 100644 --- a/docs/quick_tutorial/requirements.rst +++ b/docs/quick_tutorial/requirements.rst @@ -19,8 +19,8 @@ virtual environment.) This *Quick Tutorial* is based on: -* **Python 3.7**. Pyramid fully supports Python 3.4+. - This tutorial uses **Python 3.7**. +* **Python 3.8**. Pyramid fully supports Python 3.6+. + This tutorial uses **Python 3.8**. * **venv**. We believe in virtual environments. For this tutorial, we use Python 3's built-in solution :term:`venv`. diff --git a/docs/tutorials/modwsgi/index.rst b/docs/tutorials/modwsgi/index.rst index fa0d4f0cb..be72c014c 100644 --- a/docs/tutorials/modwsgi/index.rst +++ b/docs/tutorials/modwsgi/index.rst @@ -117,7 +117,7 @@ specific path information for commands and files. WSGIApplicationGroup %{GLOBAL} WSGIPassAuthorization On WSGIDaemonProcess pyramid user=chrism group=staff threads=4 \ - python-path=/Users/chrism/myproject/env/lib/python3.5/site-packages + python-path=/Users/chrism/myproject/env/lib/python3.8/site-packages WSGIScriptAlias /myapp /Users/chrism/myproject/pyramid.wsgi diff --git a/docs/tutorials/wiki/installation.rst b/docs/tutorials/wiki/installation.rst index 37e3498b2..cfa021540 100644 --- a/docs/tutorials/wiki/installation.rst +++ b/docs/tutorials/wiki/installation.rst @@ -127,8 +127,6 @@ On Unix On Windows ^^^^^^^^^^ -Python 3.7: - .. code-block:: doscon python -m venv %VENV% diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index a0872e605..9dacc5f96 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -73,6 +73,3 @@ The expected result should look like the following: ......................... 25 passed in 6.87 seconds - -If you use Python 3.7, you may see deprecation warnings from the docutils 0.14 package. -You can apply a [patch](https://sourceforge.net/p/docutils/patches/144/) to fix the issue, or ignore it and wait for the next release of docutils. -- cgit v1.2.3 From e268aa622f57fd76b06fc6203448143f4fbe7652 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 23 Dec 2019 12:08:50 -0600 Subject: restore py35 --- docs/narr/install.rst | 6 +++--- docs/quick_tutorial/requirements.rst | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/narr/install.rst b/docs/narr/install.rst index 903769b59..8e2bfa866 100644 --- a/docs/narr/install.rst +++ b/docs/narr/install.rst @@ -5,7 +5,7 @@ Installing :app:`Pyramid` .. note:: - This installation guide emphasizes the use of Python 3.6 and greater for + This installation guide emphasizes the use of Python 3.5 and greater for simplicity. @@ -15,13 +15,13 @@ Installing :app:`Pyramid` Before You Install Pyramid -------------------------- -Install Python version 3.6 or greater for your operating system, and satisfy +Install Python version 3.5 or greater for your operating system, and satisfy the :ref:`requirements-for-installing-packages`, as described in the following sections. .. sidebar:: Python Versions - As of this writing, :app:`Pyramid` is tested against Python 3.6, Python 3.7, Python 3.8, and PyPy3. + As of this writing, :app:`Pyramid` is tested against Python 3.5, 3.6, Python 3.7, Python 3.8, and PyPy3. :app:`Pyramid` is known to run on all popular Unix-like systems such as Linux, macOS, and FreeBSD, as well as on Windows platforms. It is also known to diff --git a/docs/quick_tutorial/requirements.rst b/docs/quick_tutorial/requirements.rst index 901f6134d..fd1726dbd 100644 --- a/docs/quick_tutorial/requirements.rst +++ b/docs/quick_tutorial/requirements.rst @@ -19,7 +19,7 @@ virtual environment.) This *Quick Tutorial* is based on: -* **Python 3.8**. Pyramid fully supports Python 3.6+. +* **Python 3.8**. Pyramid fully supports Python 3.5+. This tutorial uses **Python 3.8**. * **venv**. We believe in virtual environments. -- cgit v1.2.3 From 912dc539ca793959d7465995f906279dad21ccc9 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 23 Dec 2019 14:07:04 -0600 Subject: fix links in docs to cookiecutter --- docs/conf.py | 1 - docs/glossary.rst | 2 +- docs/narr/cookiecutters.rst | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/conf.py b/docs/conf.py index 9f2b56225..365af5fdb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -64,7 +64,6 @@ extensions = [ intersphinx_mapping = { 'colander': ('https://docs.pylonsproject.org/projects/colander/en/latest/', None), 'cookbook': ('https://docs.pylonsproject.org/projects/pyramid-cookbook/en/latest/', None), - 'cookiecutter': ('https://cookiecutter.readthedocs.io/en/latest/', None), 'deform': ('https://docs.pylonsproject.org/projects/deform/en/latest/', None), 'jinja2': ('https://docs.pylonsproject.org/projects/pyramid-jinja2/en/latest/', None), 'pylonswebframework': ('https://docs.pylonsproject.org/projects/pylons-webframework/en/latest/', None), diff --git a/docs/glossary.rst b/docs/glossary.rst index ac60ebd24..81358e688 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -1157,7 +1157,7 @@ Glossary packaging. cookiecutter - A command-line utility that creates projects from :ref:`cookiecutters ` (project templates), e.g., creating a Python package project from a Python package project template. + A command-line utility that creates projects from `cookiecutters `__ (project templates), e.g., creating a Python package project from a Python package project template. .. versionadded:: 1.8 Added cookiecutter support. diff --git a/docs/narr/cookiecutters.rst b/docs/narr/cookiecutters.rst index c6829056c..066d6c2e5 100644 --- a/docs/narr/cookiecutters.rst +++ b/docs/narr/cookiecutters.rst @@ -3,7 +3,7 @@ Pyramid cookiecutters ===================== -A :term:`cookiecutter` is a command-line utility that creates projects from :ref:`cookiecutters ` (project templates). +A :term:`cookiecutter` is a command-line utility that creates projects from `cookiecutters `__ (project templates). `pyramid-cookiecutter-starter `_ -- cgit v1.2.3