From 82c3b20c458fbe0354b8394ea73fce0dfcebc2e7 Mon Sep 17 00:00:00 2001 From: awais qureshi Date: Wed, 24 Apr 2024 16:46:12 +0500 Subject: [PATCH] feat!: upgrading pymongo. It contains breaking changes also. --- CHANGELOG.rst | 4 +++ opaque_keys/__init__.py | 2 +- opaque_keys/edx/locator.py | 4 +-- opaque_keys/edx/tests/test_asset_locators.py | 2 +- .../edx/tests/test_block_usage_locators.py | 2 +- requirements/base.in | 4 +-- requirements/base.txt | 6 ++-- requirements/ci.txt | 10 +++---- requirements/dev.txt | 28 +++++++++++-------- requirements/django-test.txt | 22 +++++++++------ requirements/doc.txt | 24 +++++++++------- requirements/pip.txt | 2 +- requirements/test.txt | 22 +++++++++------ 13 files changed, 77 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2e871f56..8301c48f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,7 @@ +# 2.9.0 + +* Upgrade pymongo to 4.4. It contains few breaking changes. + # 2.6.0 * Added support for python 3.12 diff --git a/opaque_keys/__init__.py b/opaque_keys/__init__.py index 9ff7c965..684846b0 100644 --- a/opaque_keys/__init__.py +++ b/opaque_keys/__init__.py @@ -14,7 +14,7 @@ from stevedore.enabled import EnabledExtensionManager from typing_extensions import Self # For python 3.11 plus, can just use "from typing import Self" -__version__ = '2.8.0' +__version__ = '2.9.0' class InvalidKeyError(Exception): diff --git a/opaque_keys/edx/locator.py b/opaque_keys/edx/locator.py index 88bc9b18..26d9946a 100644 --- a/opaque_keys/edx/locator.py +++ b/opaque_keys/edx/locator.py @@ -260,7 +260,7 @@ def version(self) -> str | None: DeprecationWarning, stacklevel=2 ) - return self.version_guid + return self.version_guid # type: ignore @property def offering(self): @@ -474,7 +474,7 @@ def __init__( raise ValueError(f"Invalid run. Should be '{self.RUN}' or None.") if version_guid: - version_guid = self.as_object_id(version_guid) + version_guid = self.as_object_id(version_guid) # type: ignore for name, value in [['org', org], ['library', library], ['branch', branch]]: if not (value is None or self.ALLOWED_ID_RE.match(value)): diff --git a/opaque_keys/edx/tests/test_asset_locators.py b/opaque_keys/edx/tests/test_asset_locators.py index 39a6b203..dc4e895b 100644 --- a/opaque_keys/edx/tests/test_asset_locators.py +++ b/opaque_keys/edx/tests/test_asset_locators.py @@ -51,7 +51,7 @@ def test_deprecated_son(self, key_cls, prefix, tag, source): source_key = key_cls(*source, deprecated=True) son = source_key.to_deprecated_son(prefix=prefix, tag=tag) self.assertEqual( - son.keys(), + list(son.keys()), [prefix + key for key in ('tag', 'org', 'course', 'category', 'name', 'revision')] ) diff --git a/opaque_keys/edx/tests/test_block_usage_locators.py b/opaque_keys/edx/tests/test_block_usage_locators.py index 4d863e9f..1d2a5748 100644 --- a/opaque_keys/edx/tests/test_block_usage_locators.py +++ b/opaque_keys/edx/tests/test_block_usage_locators.py @@ -205,7 +205,7 @@ def test_map_into_course_location(self, deprecated_source, deprecated_dest): def test_to_deprecated_son(self, key_cls, prefix, tag, source): source_key = key_cls(*source, deprecated=True) son = source_key.to_deprecated_son(prefix=prefix, tag=tag) - self.assertEqual(son.keys(), + self.assertEqual(list(son.keys()), [prefix + key for key in ('tag', 'org', 'course', 'category', 'name', 'revision')]) self.assertEqual(son[prefix + 'tag'], tag) diff --git a/requirements/base.in b/requirements/base.in index 88fa1359..0d729c70 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -1,7 +1,7 @@ # Core requirements for using this application -c constraints.txt -# migration guide here: https://pymongo.readthedocs.io/en/4.0/migrate-to-pymongo4.html -pymongo>=2.7.2,<4.0 +# https://pymongo.readthedocs.io/en/4.4.0/migrate-to-pymongo4.html#son-items-now-returns-dict-items-object +pymongo>=2.7.2,<4.4.1 stevedore>=0.14.1 typing-extensions diff --git a/requirements/base.txt b/requirements/base.txt index dd9dcc24..914bd7ad 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -4,11 +4,13 @@ # # make upgrade # +dnspython==2.6.1 + # via pymongo pbr==6.0.0 # via stevedore -pymongo==3.13.0 +pymongo==4.4.0 # via -r requirements/base.in stevedore==5.2.0 # via -r requirements/base.in -typing-extensions==4.10.0 +typing-extensions==4.11.0 # via -r requirements/base.in diff --git a/requirements/ci.txt b/requirements/ci.txt index 2e918e8d..f588892d 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -10,11 +10,11 @@ chardet==5.2.0 # via tox colorama==0.4.6 # via tox -coverage==7.4.4 +coverage==7.5.0 # via -r requirements/ci.in distlib==0.3.8 # via virtualenv -filelock==3.13.3 +filelock==3.13.4 # via # tox # virtualenv @@ -22,11 +22,11 @@ packaging==24.0 # via # pyproject-api # tox -platformdirs==4.2.0 +platformdirs==4.2.1 # via # tox # virtualenv -pluggy==1.4.0 +pluggy==1.5.0 # via tox pyproject-api==1.6.1 # via tox @@ -36,5 +36,5 @@ tomli==2.0.1 # tox tox==4.14.2 # via -r requirements/ci.in -virtualenv==20.25.1 +virtualenv==20.26.0 # via tox diff --git a/requirements/dev.txt b/requirements/dev.txt index 9cccb815..4f797872 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -62,7 +62,7 @@ click-log==0.4.0 # via # -r requirements/doc.txt # edx-lint -code-annotations==1.7.0 +code-annotations==1.8.0 # via # -r requirements/doc.txt # edx-lint @@ -70,7 +70,7 @@ colorama==0.4.6 # via # -r requirements/ci.txt # tox -coverage[toml]==7.4.4 +coverage[toml]==7.5.0 # via # -r requirements/ci.txt # -r requirements/doc.txt @@ -85,6 +85,10 @@ distlib==0.3.8 # via # -r requirements/ci.txt # virtualenv +dnspython==2.6.1 + # via + # -r requirements/doc.txt + # pymongo docutils==0.19 # via # -r requirements/doc.txt @@ -93,23 +97,23 @@ docutils==0.19 # sphinx edx-lint==5.3.6 # via -r requirements/doc.txt -exceptiongroup==1.2.0 +exceptiongroup==1.2.1 # via # -r requirements/doc.txt # hypothesis # pytest -execnet==2.0.2 +execnet==2.1.1 # via # -r requirements/doc.txt # pytest-xdist -filelock==3.13.3 +filelock==3.13.4 # via # -r requirements/ci.txt # tox # virtualenv -hypothesis==6.100.0 +hypothesis==6.100.1 # via -r requirements/doc.txt -idna==3.6 +idna==3.7 # via # -r requirements/doc.txt # requests @@ -173,14 +177,14 @@ pbr==6.0.0 # stevedore pip-tools==7.4.1 # via -r requirements/pip-tools.txt -platformdirs==4.2.0 +platformdirs==4.2.1 # via # -r requirements/ci.txt # -r requirements/doc.txt # pylint # tox # virtualenv -pluggy==1.4.0 +pluggy==1.5.0 # via # -r requirements/ci.txt # -r requirements/doc.txt @@ -219,7 +223,7 @@ pylint-plugin-utils==0.8.2 # -r requirements/doc.txt # pylint-celery # pylint-django -pymongo==3.13.0 +pymongo==4.4.0 # via -r requirements/doc.txt pyproject-api==1.6.1 # via @@ -332,7 +336,7 @@ tomlkit==0.12.4 # pylint tox==4.14.2 # via -r requirements/ci.txt -typing-extensions==4.10.0 +typing-extensions==4.11.0 # via # -r requirements/doc.txt # astroid @@ -343,7 +347,7 @@ urllib3==2.2.1 # via # -r requirements/doc.txt # requests -virtualenv==20.25.1 +virtualenv==20.26.0 # via # -r requirements/ci.txt # tox diff --git a/requirements/django-test.txt b/requirements/django-test.txt index 0b339f09..762b25a2 100644 --- a/requirements/django-test.txt +++ b/requirements/django-test.txt @@ -23,11 +23,11 @@ click-log==0.4.0 # via # -r requirements/test.txt # edx-lint -code-annotations==1.7.0 +code-annotations==1.8.0 # via # -r requirements/test.txt # edx-lint -coverage[toml]==7.4.4 +coverage[toml]==7.5.0 # via # -r requirements/test.txt # pytest-cov @@ -37,18 +37,22 @@ dill==0.3.8 # via # -r requirements/test.txt # pylint +dnspython==2.6.1 + # via + # -r requirements/test.txt + # pymongo edx-lint==5.3.6 # via -r requirements/test.txt -exceptiongroup==1.2.0 +exceptiongroup==1.2.1 # via # -r requirements/test.txt # hypothesis # pytest -execnet==2.0.2 +execnet==2.1.1 # via # -r requirements/test.txt # pytest-xdist -hypothesis==6.100.0 +hypothesis==6.100.1 # via -r requirements/test.txt iniconfig==2.0.0 # via @@ -86,11 +90,11 @@ pbr==6.0.0 # via # -r requirements/test.txt # stevedore -platformdirs==4.2.0 +platformdirs==4.2.1 # via # -r requirements/test.txt # pylint -pluggy==1.4.0 +pluggy==1.5.0 # via # -r requirements/test.txt # pytest @@ -116,7 +120,7 @@ pylint-plugin-utils==0.8.2 # -r requirements/test.txt # pylint-celery # pylint-django -pymongo==3.13.0 +pymongo==4.4.0 # via -r requirements/test.txt pytest==8.1.1 # via @@ -165,7 +169,7 @@ tomlkit==0.12.4 # via # -r requirements/test.txt # pylint -typing-extensions==4.10.0 +typing-extensions==4.11.0 # via # -r requirements/test.txt # astroid diff --git a/requirements/doc.txt b/requirements/doc.txt index 99ab847b..d7f9fe72 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -37,11 +37,11 @@ click-log==0.4.0 # via # -r requirements/test.txt # edx-lint -code-annotations==1.7.0 +code-annotations==1.8.0 # via # -r requirements/test.txt # edx-lint -coverage[toml]==7.4.4 +coverage[toml]==7.5.0 # via # -r requirements/test.txt # pytest-cov @@ -51,6 +51,10 @@ dill==0.3.8 # via # -r requirements/test.txt # pylint +dnspython==2.6.1 + # via + # -r requirements/test.txt + # pymongo docutils==0.19 # via # pydata-sphinx-theme @@ -58,18 +62,18 @@ docutils==0.19 # sphinx edx-lint==5.3.6 # via -r requirements/test.txt -exceptiongroup==1.2.0 +exceptiongroup==1.2.1 # via # -r requirements/test.txt # hypothesis # pytest -execnet==2.0.2 +execnet==2.1.1 # via # -r requirements/test.txt # pytest-xdist -hypothesis==6.100.0 +hypothesis==6.100.1 # via -r requirements/test.txt -idna==3.6 +idna==3.7 # via requests imagesize==1.4.1 # via sphinx @@ -116,11 +120,11 @@ pbr==6.0.0 # via # -r requirements/test.txt # stevedore -platformdirs==4.2.0 +platformdirs==4.2.1 # via # -r requirements/test.txt # pylint -pluggy==1.4.0 +pluggy==1.5.0 # via # -r requirements/test.txt # pytest @@ -154,7 +158,7 @@ pylint-plugin-utils==0.8.2 # -r requirements/test.txt # pylint-celery # pylint-django -pymongo==3.13.0 +pymongo==4.4.0 # via -r requirements/test.txt pytest==8.1.1 # via @@ -229,7 +233,7 @@ tomlkit==0.12.4 # via # -r requirements/test.txt # pylint -typing-extensions==4.10.0 +typing-extensions==4.11.0 # via # -r requirements/test.txt # astroid diff --git a/requirements/pip.txt b/requirements/pip.txt index cf449024..e3ffcc7b 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -10,5 +10,5 @@ wheel==0.43.0 # The following packages are considered to be unsafe in a requirements file: pip==24.0 # via -r requirements/pip.in -setuptools==69.2.0 +setuptools==69.5.1 # via -r requirements/pip.in diff --git a/requirements/test.txt b/requirements/test.txt index 9f1ae85e..4b80179b 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -17,9 +17,9 @@ click==8.1.7 # edx-lint click-log==0.4.0 # via edx-lint -code-annotations==1.7.0 +code-annotations==1.8.0 # via edx-lint -coverage[toml]==7.4.4 +coverage[toml]==7.5.0 # via # -r requirements/test.in # pytest-cov @@ -27,15 +27,19 @@ ddt==1.7.2 # via -r requirements/test.in dill==0.3.8 # via pylint +dnspython==2.6.1 + # via + # -r requirements/base.txt + # pymongo edx-lint==5.3.6 # via -r requirements/test.in -exceptiongroup==1.2.0 +exceptiongroup==1.2.1 # via # hypothesis # pytest -execnet==2.0.2 +execnet==2.1.1 # via pytest-xdist -hypothesis==6.100.0 +hypothesis==6.100.1 # via -r requirements/test.in iniconfig==2.0.0 # via pytest @@ -59,9 +63,9 @@ pbr==6.0.0 # via # -r requirements/base.txt # stevedore -platformdirs==4.2.0 +platformdirs==4.2.1 # via pylint -pluggy==1.4.0 +pluggy==1.5.0 # via pytest pycodestyle==2.11.1 # via -r requirements/test.in @@ -79,7 +83,7 @@ pylint-plugin-utils==0.8.2 # via # pylint-celery # pylint-django -pymongo==3.13.0 +pymongo==4.4.0 # via -r requirements/base.txt pytest==8.1.1 # via @@ -112,7 +116,7 @@ tomli==2.0.1 # pytest tomlkit==0.12.4 # via pylint -typing-extensions==4.10.0 +typing-extensions==4.11.0 # via # -r requirements/base.txt # astroid