summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook.git@proton.me>2022-10-08 13:59:20 -0500
committerJordan Cook <jordan.cook.git@proton.me>2022-10-08 14:35:58 -0500
commit2cfccd966876349ffbfd5a44a6db684966468b95 (patch)
tree76dd40e3f5700cb1fc33a86863e4406390dbf7eb
parent7d7c9fb9f637ce99a274742eab67aa59b871ad53 (diff)
parent5ed7ec906f5d6012ac54d4d521fb99404e8a9dbf (diff)
downloadrequests-cache-2cfccd966876349ffbfd5a44a6db684966468b95.tar.gz
Merge pull request #702 from requests-cache/dependabot/pip/cattrs-22.2.0
Bump cattrs from 22.1.0 to 22.2.0
-rw-r--r--HISTORY.md16
-rw-r--r--poetry.lock50
-rw-r--r--pyproject.toml7
-rw-r--r--requests_cache/serializers/cattrs.py16
4 files changed, 44 insertions, 45 deletions
diff --git a/HISTORY.md b/HISTORY.md
index 8fd923b..b3ba499 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -30,28 +30,29 @@
* The constant `requests_cache.DO_NOT_CACHE` may be used to completely disable caching for a request
**Backends:**
-* SQLite:
+* **SQLite**:
* Improve performance for removing expired responses with `delete()`
* Add `size()` method to get estimated size of the database (including in-memory databases)
* Add `sorted()` method with sorting and other query options
* Add `wal` parameter to enable write-ahead logging
-* Redis:
+* **Redis**:
* Add `ttl_offset` argument to add a delay between cache expiration and deletion
-* MongoDB:
+* **MongoDB**:
* Store responses in plain (human-readable) document format instead of fully serialized binary
* Add optional integration with MongoDB TTL to improve performance for removing expired responses
* Disabled by default. See 'Backends: MongoDB' docs for details.
-* DynamoDB:
+* *DynamoDB**:
* Store responses in plain (human-readable) document format instead of fully serialized binary
* Create default table in on-demand mode instead of provisioned
* Add optional integration with DynamoDB TTL to improve performance for removing expired responses
* This is enabled by default, but may be disabled
-* Filesystem:
+* **Filesystem**:
* The default file format has been changed from pickle to JSON
-* Filesystem, MongoDB, and DynamoDB:
+* **Filesystem, MongoDB, and DynamoDB**:
* Decode JSON and text response bodies so the saved response can be fully human-readable/editable.
May be disabled with `decode_content=False`.
-* SQLite, Redis, MongoDB, and GridFS: Close open database connections when `CachedSession` is used as a contextmanager, or if `CachedSession.close()` is called
+* **SQLite, Redis, MongoDB, and GridFS**:
+ * Close open database connections when `CachedSession` is used as a contextmanager, or if `CachedSession.close()` is called
**Request matching & filtering:**
* Add serializer name to cache keys to avoid errors due to switching serializers
@@ -92,6 +93,7 @@
* Fix issue on Windows with occasional missing `CachedResponse.created_at` timestamp
* Add `CachedRequest.path_url` property for compatibility with `RequestEncodingMixin`
* Add compatibility with cattrs 22.1+
+* Fix potential `AttributeError` due to undetected imports when requests-cache is bundled in a PyInstaller package
**Dependencies:**
* Replace `appdirs` with `platformdirs`
diff --git a/poetry.lock b/poetry.lock
index df69ae1..7ffd61f 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -73,14 +73,14 @@ lxml = ["lxml"]
[[package]]
name = "boto3"
-version = "1.24.82"
+version = "1.24.89"
description = "The AWS SDK for Python"
category = "dev"
optional = true
python-versions = ">= 3.7"
[package.dependencies]
-botocore = ">=1.27.82,<1.28.0"
+botocore = ">=1.27.89,<1.28.0"
jmespath = ">=0.7.1,<2.0.0"
s3transfer = ">=0.6.0,<0.7.0"
@@ -89,7 +89,7 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"]
[[package]]
name = "botocore"
-version = "1.27.82"
+version = "1.27.89"
description = "Low-level, data-driven core of boto 3."
category = "dev"
optional = true
@@ -117,16 +117,16 @@ six = ">=1.9.0"
[[package]]
name = "cattrs"
-version = "22.1.0"
+version = "22.2.0"
description = "Composable complex class support for attrs and dataclasses."
category = "dev"
optional = false
-python-versions = ">=3.7,<4.0"
+python-versions = ">=3.7"
[package.dependencies]
attrs = ">=20"
-exceptiongroup = {version = "*", markers = "python_version <= \"3.10\""}
-typing_extensions = {version = "*", markers = "python_version >= \"3.7\" and python_version < \"3.8\""}
+exceptiongroup = {version = "*", markers = "python_version < \"3.11\""}
+typing_extensions = {version = "*", markers = "python_version < \"3.8\""}
[[package]]
name = "certifi"
@@ -190,7 +190,7 @@ test = ["hypothesis (==3.55.3)", "flake8 (==3.7.8)"]
[[package]]
name = "coverage"
-version = "6.4.4"
+version = "6.5.0"
description = "Code coverage measurement for Python"
category = "dev"
optional = false
@@ -268,7 +268,7 @@ testing = ["covdefaults (>=2.2)", "coverage (>=6.4.2)", "pytest (>=7.1.2)", "pyt
[[package]]
name = "furo"
-version = "2022.9.15"
+version = "2022.9.29"
description = "A clean customisable Sphinx documentation theme."
category = "dev"
optional = true
@@ -282,7 +282,7 @@ sphinx-basic-ng = "*"
[[package]]
name = "identify"
-version = "2.5.5"
+version = "2.5.6"
description = "File identification library for Python"
category = "dev"
optional = false
@@ -309,7 +309,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[[package]]
name = "importlib-metadata"
-version = "4.12.0"
+version = "4.13.0"
description = "Read metadata from Python packages"
category = "dev"
optional = false
@@ -320,9 +320,9 @@ typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""}
zipp = ">=0.5"
[package.extras]
-docs = ["sphinx", "jaraco.packaging (>=9)", "rst.linker (>=1.9)"]
+docs = ["sphinx (>=3.5)", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "furo", "jaraco.tidelift (>=1.4)"]
perf = ["ipython"]
-testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.3)", "packaging", "pyfakefs", "flufl-flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)", "importlib-resources (>=1.3)"]
+testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "flake8 (<5)", "pytest-cov", "pytest-enabler (>=1.3)", "packaging", "pyfakefs", "flufl-flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)", "importlib-resources (>=1.3)"]
[[package]]
name = "iniconfig"
@@ -745,7 +745,7 @@ six = ">=1.5"
[[package]]
name = "pytz"
-version = "2022.2.1"
+version = "2022.4"
description = "World timezone definitions, modern and historical"
category = "dev"
optional = true
@@ -829,7 +829,7 @@ tests = ["pytest (>=7.0.0)", "coverage (>=6.0.0)", "pytest-cov", "pytest-asyncio
[[package]]
name = "rich"
-version = "12.5.1"
+version = "12.6.0"
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
category = "dev"
optional = false
@@ -859,14 +859,14 @@ crt = ["botocore[crt] (>=1.20.29,<2.0a.0)"]
[[package]]
name = "setuptools"
-version = "65.4.0"
+version = "65.4.1"
description = "Easily download, build, install, upgrade, and uninstall Python packages"
category = "dev"
optional = false
python-versions = ">=3.7"
[package.extras]
-docs = ["sphinx", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "jaraco.tidelift (>=1.4)", "sphinx-notfound-page (==0.8.3)", "sphinx-hoverxref (<2)", "pygments-github-lexers (==0.0.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-reredirects", "sphinxcontrib-towncrier", "furo"]
+docs = ["sphinx (>=3.5)", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "jaraco.tidelift (>=1.4)", "sphinx-notfound-page (==0.8.3)", "sphinx-hoverxref (<2)", "pygments-github-lexers (==0.0.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-reredirects", "sphinxcontrib-towncrier", "furo"]
testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "flake8 (<5)", "pytest-enabler (>=1.3)", "pytest-perf", "mock", "flake8-2020", "virtualenv (>=13.0.0)", "wheel", "pip (>=19.1)", "jaraco.envs (>=2.2)", "pytest-xdist", "jaraco.path (>=3.2.0)", "build", "filelock (>=3.4.0)", "pip-run (>=8.8)", "ini2toml[lite] (>=0.9)", "tomli-w (>=1.0.0)", "pytest-black (>=0.3.7)", "pytest-cov", "pytest-mypy (>=0.9.1)"]
testing-integration = ["pytest", "pytest-xdist", "pytest-enabler", "virtualenv (>=13.0.0)", "tomli", "wheel", "jaraco.path (>=3.2.0)", "jaraco.envs (>=2.2)", "build", "filelock (>=3.4.0)"]
@@ -896,7 +896,7 @@ python-versions = ">=3.6"
[[package]]
name = "sphinx"
-version = "5.2.2"
+version = "5.2.3"
description = "Python documentation generator"
category = "dev"
optional = false
@@ -974,14 +974,14 @@ test = ["pytest", "pytest-cov", "cython", "codecov", "coverage"]
[[package]]
name = "sphinx-basic-ng"
-version = "0.0.1a12"
+version = "1.0.0b1"
description = "A modern skeleton for Sphinx themes."
category = "dev"
optional = true
python-versions = ">=3.7"
[package.dependencies]
-sphinx = ">=4.0,<6.0"
+sphinx = ">=4.0"
[package.extras]
docs = ["furo", "myst-parser", "sphinx-copybutton", "sphinx-inline-tabs", "ipython"]
@@ -1183,7 +1183,7 @@ python-versions = ">= 3.7"
[[package]]
name = "typing-extensions"
-version = "4.3.0"
+version = "4.4.0"
description = "Backported and Experimental Type Hints for Python 3.7+"
category = "dev"
optional = false
@@ -1260,15 +1260,15 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
[[package]]
name = "zipp"
-version = "3.8.1"
+version = "3.9.0"
description = "Backport of pathlib-compatible object wrapper for zip files"
category = "dev"
optional = false
python-versions = ">=3.7"
[package.extras]
-docs = ["sphinx", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "jaraco.tidelift (>=1.4)"]
-testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.3)", "jaraco-itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)"]
+docs = ["sphinx (>=3.5)", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "furo", "jaraco.tidelift (>=1.4)"]
+testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "flake8 (<5)", "pytest-cov", "pytest-enabler (>=1.3)", "jaraco-itertools", "func-timeout", "jaraco-functools", "more-itertools", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)"]
[extras]
all = ["boto3", "botocore", "itsdangerous", "pymongo", "pyyaml", "redis", "ujson"]
@@ -1284,7 +1284,7 @@ yaml = ["pyyaml"]
[metadata]
lock-version = "1.1"
python-versions = "^3.7" # requests requires python >=3.7, <4.0
-content-hash = "ea39161c795ec7ea80f5a3f51caedba1bb995f379c31eb4b994295d2d5052c1f"
+content-hash = "7d2ec76726f4603b958b36d5ce358d205ce359f2ce6e67bae5981e53391cf299"
[metadata.files]
alabaster = []
diff --git a/pyproject.toml b/pyproject.toml
index e2377f6..51a78a7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -31,13 +31,10 @@ python = "^3.7" # requests requires python >=3.7, <4.0
requests = ">=2.22" # Needs no introduction
urllib3 = ">=1.25.5" # Use a slightly newer version than required by requests (for bugfixes)
attrs = ">=21.2" # For response data models
-cattrs = ">=22.1" # For response serialization
+cattrs = ">=22.2" # For response serialization
platformdirs = ">=2.5" # For features that use platform-specific system directories
url-normalize = ">=1.4" # For more accurate request matching
-# Temporary workaround until cattrs 22.2.0 is released
-exceptiongroup = {version=">=1.0.0-rc.8", python="<3.11"}
-
# Optional backend dependencies
boto3 = {optional=true, version=">=1.15"}
botocore = {optional=true, version=">=1.18"}
@@ -86,7 +83,7 @@ docs = ["furo", "linkify-it-py", "myst-parser", "sphinx", "sphinx-autodoc-ty
[tool.poetry.dev-dependencies]
# For unit + integration tests
-coverage = "^6.3"
+coverage = "^6.5"
psutil = "^5.0"
pytest = "^7.1"
pytest-clarity = "^1.0.1"
diff --git a/requests_cache/serializers/cattrs.py b/requests_cache/serializers/cattrs.py
index d5c3dda..abe6458 100644
--- a/requests_cache/serializers/cattrs.py
+++ b/requests_cache/serializers/cattrs.py
@@ -16,7 +16,7 @@ from decimal import Decimal
from json import JSONDecodeError
from typing import Callable, Dict, ForwardRef, MutableMapping
-from cattr import GenConverter
+from cattr import Converter
from requests.cookies import RequestsCookieJar, cookiejar_from_dict
from requests.exceptions import RequestException
from requests.structures import CaseInsensitiveDict
@@ -36,7 +36,7 @@ class CattrStage(Stage):
Args:
factory: A callable that returns a ``cattrs`` converter to start from instead of a new
- ``GenConverter``. Mainly useful for preconf converters.
+ ``Converter``. Mainly useful for preconf converters.
decode_content: Save response body in human-readable format, if possible
Notes on ``decode_content`` option:
@@ -50,7 +50,7 @@ class CattrStage(Stage):
"""
def __init__(
- self, factory: Callable[..., GenConverter] = None, decode_content: bool = False, **kwargs
+ self, factory: Callable[..., Converter] = None, decode_content: bool = False, **kwargs
):
self.converter = init_converter(factory, **kwargs)
self.decode_content = decode_content
@@ -68,10 +68,10 @@ class CattrStage(Stage):
def init_converter(
- factory: Callable[..., GenConverter] = None,
+ factory: Callable[..., Converter] = None,
convert_datetime: bool = True,
convert_timedelta: bool = True,
-) -> GenConverter:
+) -> Converter:
"""Make a converter to structure and unstructure nested objects within a
:py:class:`.CachedResponse`
@@ -80,7 +80,7 @@ def init_converter(
convert_datetime: May be set to ``False`` for pre-configured converters that already have
datetime support
"""
- factory = factory or GenConverter
+ factory = factory or Converter
converter = factory(omit_if_default=True)
# Convert datetimes to and from iso-formatted strings
@@ -120,9 +120,9 @@ def init_converter(
return converter
-def make_decimal_timedelta_converter(**kwargs) -> GenConverter:
+def make_decimal_timedelta_converter(**kwargs) -> Converter:
"""Make a converter that uses Decimals instead of floats to represent timedelta objects"""
- converter = GenConverter(**kwargs)
+ converter = Converter(**kwargs)
converter.register_unstructure_hook(
timedelta, lambda obj: Decimal(str(obj.total_seconds())) if obj else None
)